index.es.js 1.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402
  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, defineComponent, openBlock, createElementBlock, createElementVNode, warn, isVNode, Fragment, Comment, getCurrentInstance, computed, inject, onMounted, watchEffect, onBeforeUnmount, isRef, onBeforeMount, provide, 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$1 = 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$1)
  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$1 ? window : void 0;
  2086. function useEventListener(...args) {
  2087. let target;
  2088. let event;
  2089. let listener;
  2090. let options;
  2091. if (isString$1(args[0])) {
  2092. [event, listener, options] = args;
  2093. target = defaultWindow;
  2094. } else {
  2095. [target, event, listener, options] = args;
  2096. }
  2097. if (!target)
  2098. return noop;
  2099. let cleanup = noop;
  2100. const stopWatch = watch(() => unrefElement(target), (el) => {
  2101. cleanup();
  2102. if (!el)
  2103. return;
  2104. el.addEventListener(event, listener, options);
  2105. cleanup = () => {
  2106. el.removeEventListener(event, listener, options);
  2107. cleanup = noop;
  2108. };
  2109. }, { immediate: true, flush: "post" });
  2110. const stop = () => {
  2111. stopWatch();
  2112. cleanup();
  2113. };
  2114. tryOnScopeDispose(stop);
  2115. return stop;
  2116. }
  2117. function onClickOutside(target, handler3, options = {}) {
  2118. const { window: window2 = defaultWindow, ignore, capture = true } = options;
  2119. if (!window2)
  2120. return;
  2121. const shouldListen = ref(true);
  2122. const listener = (event) => {
  2123. const el = unrefElement(target);
  2124. const composedPath = event.composedPath();
  2125. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  2126. return;
  2127. if (ignore && ignore.length > 0) {
  2128. if (ignore.some((target2) => {
  2129. const el2 = unrefElement(target2);
  2130. return el2 && (event.target === el2 || composedPath.includes(el2));
  2131. }))
  2132. return;
  2133. }
  2134. handler3(event);
  2135. };
  2136. const cleanup = [
  2137. useEventListener(window2, "click", listener, { passive: true, capture }),
  2138. useEventListener(window2, "pointerdown", (e) => {
  2139. const el = unrefElement(target);
  2140. shouldListen.value = !!el && !e.composedPath().includes(el);
  2141. }, { passive: true })
  2142. ];
  2143. const stop = () => cleanup.forEach((fn2) => fn2());
  2144. return stop;
  2145. }
  2146. const _global$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  2147. const globalKey$1 = "__vueuse_ssr_handlers__";
  2148. _global$1[globalKey$1] = _global$1[globalKey$1] || {};
  2149. _global$1[globalKey$1];
  2150. var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
  2151. var __hasOwnProp$c = Object.prototype.hasOwnProperty;
  2152. var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
  2153. var __objRest$2 = (source, exclude) => {
  2154. var target = {};
  2155. for (var prop in source)
  2156. if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
  2157. target[prop] = source[prop];
  2158. if (source != null && __getOwnPropSymbols$c)
  2159. for (var prop of __getOwnPropSymbols$c(source)) {
  2160. if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
  2161. target[prop] = source[prop];
  2162. }
  2163. return target;
  2164. };
  2165. function useResizeObserver(target, callback, options = {}) {
  2166. const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  2167. let observer;
  2168. const isSupported = window2 && "ResizeObserver" in window2;
  2169. const cleanup = () => {
  2170. if (observer) {
  2171. observer.disconnect();
  2172. observer = void 0;
  2173. }
  2174. };
  2175. const stopWatch = watch(() => unrefElement(target), (el) => {
  2176. cleanup();
  2177. if (isSupported && window2 && el) {
  2178. observer = new ResizeObserver(callback);
  2179. observer.observe(el, observerOptions);
  2180. }
  2181. }, { immediate: true, flush: "post" });
  2182. const stop = () => {
  2183. cleanup();
  2184. stopWatch();
  2185. };
  2186. tryOnScopeDispose(stop);
  2187. return {
  2188. isSupported,
  2189. stop
  2190. };
  2191. }
  2192. var _a$1, _b$1;
  2193. isClient$1 && (window == null ? void 0 : window.navigator) && ((_a$1 = window == null ? void 0 : window.navigator) == null ? void 0 : _a$1.platform) && /iP(ad|hone|od)/.test((_b$1 = window == null ? void 0 : window.navigator) == null ? void 0 : _b$1.platform);
  2194. const isInContainer = (el, container) => {
  2195. if (!isClient$1 || !el || !container)
  2196. return false;
  2197. const elRect = el.getBoundingClientRect();
  2198. let containerRect;
  2199. if (container instanceof Element) {
  2200. containerRect = container.getBoundingClientRect();
  2201. } else {
  2202. containerRect = {
  2203. top: 0,
  2204. right: window.innerWidth,
  2205. bottom: window.innerHeight,
  2206. left: 0
  2207. };
  2208. }
  2209. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  2210. };
  2211. const resizeHandler = function(entries) {
  2212. for (const entry of entries) {
  2213. const listeners = entry.target.__resizeListeners__ || [];
  2214. if (listeners.length) {
  2215. listeners.forEach((fn2) => {
  2216. fn2();
  2217. });
  2218. }
  2219. }
  2220. };
  2221. const addResizeListener = function(element, fn2) {
  2222. if (!isClient$1 || !element)
  2223. return;
  2224. if (!element.__resizeListeners__) {
  2225. element.__resizeListeners__ = [];
  2226. element.__ro__ = new ResizeObserver(resizeHandler);
  2227. element.__ro__.observe(element);
  2228. }
  2229. element.__resizeListeners__.push(fn2);
  2230. };
  2231. const removeResizeListener = function(element, fn2) {
  2232. var _a2;
  2233. if (!element || !element.__resizeListeners__)
  2234. return;
  2235. element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn2), 1);
  2236. if (!element.__resizeListeners__.length) {
  2237. (_a2 = element.__ro__) == null ? void 0 : _a2.disconnect();
  2238. }
  2239. };
  2240. const NOOP = () => {
  2241. };
  2242. const hasOwnProperty = Object.prototype.hasOwnProperty;
  2243. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  2244. const isArray = Array.isArray;
  2245. const isFunction = (val) => typeof val === "function";
  2246. const isString = (val) => typeof val === "string";
  2247. const isObject$1 = (val) => val !== null && typeof val === "object";
  2248. const isPromise = (val) => {
  2249. return isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
  2250. };
  2251. const objectToString = Object.prototype.toString;
  2252. const toTypeString = (value) => objectToString.call(value);
  2253. const toRawType = (value) => {
  2254. return toTypeString(value).slice(8, -1);
  2255. };
  2256. const cacheStringFunction = (fn2) => {
  2257. const cache = /* @__PURE__ */ Object.create(null);
  2258. return (str) => {
  2259. const hit = cache[str];
  2260. return hit || (cache[str] = fn2(str));
  2261. };
  2262. };
  2263. const camelizeRE = /-(\w)/g;
  2264. const camelize = cacheStringFunction((str) => {
  2265. return str.replace(camelizeRE, (_2, c) => c ? c.toUpperCase() : "");
  2266. });
  2267. const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  2268. const isUndefined = (val) => val === void 0;
  2269. const isEmpty = (val) => !val && val !== 0 || isArray(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  2270. const isElement$1 = (e) => {
  2271. if (typeof Element === "undefined")
  2272. return false;
  2273. return e instanceof Element;
  2274. };
  2275. const escapeStringRegexp = (string3 = "") => string3.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  2276. const entriesOf = (arr) => Object.entries(arr);
  2277. const getProp = (obj, path, defaultValue) => {
  2278. return {
  2279. get value() {
  2280. return get(obj, path, defaultValue);
  2281. },
  2282. set value(val) {
  2283. set(obj, path, val);
  2284. }
  2285. };
  2286. };
  2287. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  2288. const hasClass = (el, cls) => {
  2289. if (!el || !cls)
  2290. return false;
  2291. if (cls.includes(" "))
  2292. throw new Error("className should not contain space.");
  2293. return el.classList.contains(cls);
  2294. };
  2295. const addClass = (el, cls) => {
  2296. if (!el || !cls.trim())
  2297. return;
  2298. el.classList.add(...classNameToArray(cls));
  2299. };
  2300. const removeClass = (el, cls) => {
  2301. if (!el || !cls.trim())
  2302. return;
  2303. el.classList.remove(...classNameToArray(cls));
  2304. };
  2305. const getStyle = (element, styleName) => {
  2306. var _a2;
  2307. if (!isClient$1 || !element || !styleName)
  2308. return "";
  2309. camelize(styleName);
  2310. try {
  2311. const style = element.style[styleName];
  2312. if (style)
  2313. return style;
  2314. const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
  2315. return computed2 ? computed2[styleName] : "";
  2316. } catch (e) {
  2317. return element.style[styleName];
  2318. }
  2319. };
  2320. const isScroll = (el, isVertical) => {
  2321. if (!isClient$1)
  2322. return false;
  2323. const key = {
  2324. undefined: "overflow",
  2325. true: "overflow-y",
  2326. false: "overflow-x"
  2327. }[String(isVertical)];
  2328. const overflow = getStyle(el, key);
  2329. return ["scroll", "auto", "overlay"].some((s2) => overflow.includes(s2));
  2330. };
  2331. const getScrollContainer = (el, isVertical) => {
  2332. if (!isClient$1)
  2333. return;
  2334. let parent = el;
  2335. while (parent) {
  2336. if ([window, document, document.documentElement].includes(parent))
  2337. return window;
  2338. if (isScroll(parent, isVertical))
  2339. return parent;
  2340. parent = parent.parentNode;
  2341. }
  2342. return parent;
  2343. };
  2344. let scrollBarWidth;
  2345. const getScrollBarWidth = () => {
  2346. var _a2;
  2347. if (!isClient$1)
  2348. return 0;
  2349. if (scrollBarWidth !== void 0)
  2350. return scrollBarWidth;
  2351. const outer = document.createElement("div");
  2352. outer.className = "el-scrollbar__wrap";
  2353. outer.style.visibility = "hidden";
  2354. outer.style.width = "100px";
  2355. outer.style.position = "absolute";
  2356. outer.style.top = "-9999px";
  2357. document.body.appendChild(outer);
  2358. const widthNoScroll = outer.offsetWidth;
  2359. outer.style.overflow = "scroll";
  2360. const inner = document.createElement("div");
  2361. inner.style.width = "100%";
  2362. outer.appendChild(inner);
  2363. const widthWithScroll = inner.offsetWidth;
  2364. (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
  2365. scrollBarWidth = widthNoScroll - widthWithScroll;
  2366. return scrollBarWidth;
  2367. };
  2368. function scrollIntoView(container, selected) {
  2369. if (!isClient$1)
  2370. return;
  2371. if (!selected) {
  2372. container.scrollTop = 0;
  2373. return;
  2374. }
  2375. const offsetParents = [];
  2376. let pointer = selected.offsetParent;
  2377. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  2378. offsetParents.push(pointer);
  2379. pointer = pointer.offsetParent;
  2380. }
  2381. const top2 = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  2382. const bottom2 = top2 + selected.offsetHeight;
  2383. const viewRectTop = container.scrollTop;
  2384. const viewRectBottom = viewRectTop + container.clientHeight;
  2385. if (top2 < viewRectTop) {
  2386. container.scrollTop = top2;
  2387. } else if (bottom2 > viewRectBottom) {
  2388. container.scrollTop = bottom2 - container.clientHeight;
  2389. }
  2390. }
  2391. var _export_sfc$2 = (sfc, props) => {
  2392. const target = sfc.__vccOpts || sfc;
  2393. for (const [key, val] of props) {
  2394. target[key] = val;
  2395. }
  2396. return target;
  2397. };
  2398. const _sfc_main$1x = defineComponent({
  2399. name: "ArrowDown"
  2400. });
  2401. const _hoisted_1$12 = {
  2402. viewBox: "0 0 1024 1024",
  2403. xmlns: "http://www.w3.org/2000/svg"
  2404. };
  2405. const _hoisted_2$V = /* @__PURE__ */ createElementVNode("path", {
  2406. fill: "currentColor",
  2407. 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"
  2408. }, null, -1);
  2409. const _hoisted_3$I = [
  2410. _hoisted_2$V
  2411. ];
  2412. function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
  2413. return openBlock(), createElementBlock("svg", _hoisted_1$12, _hoisted_3$I);
  2414. }
  2415. var arrowDown = /* @__PURE__ */ _export_sfc$2(_sfc_main$1x, [["render", _sfc_render$13]]);
  2416. const _sfc_main$1w = defineComponent({
  2417. name: "ArrowLeft"
  2418. });
  2419. const _hoisted_1$11 = {
  2420. viewBox: "0 0 1024 1024",
  2421. xmlns: "http://www.w3.org/2000/svg"
  2422. };
  2423. const _hoisted_2$U = /* @__PURE__ */ createElementVNode("path", {
  2424. fill: "currentColor",
  2425. 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"
  2426. }, null, -1);
  2427. const _hoisted_3$H = [
  2428. _hoisted_2$U
  2429. ];
  2430. function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
  2431. return openBlock(), createElementBlock("svg", _hoisted_1$11, _hoisted_3$H);
  2432. }
  2433. var arrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1w, [["render", _sfc_render$12]]);
  2434. const _sfc_main$1v = defineComponent({
  2435. name: "ArrowRight"
  2436. });
  2437. const _hoisted_1$10 = {
  2438. viewBox: "0 0 1024 1024",
  2439. xmlns: "http://www.w3.org/2000/svg"
  2440. };
  2441. const _hoisted_2$T = /* @__PURE__ */ createElementVNode("path", {
  2442. fill: "currentColor",
  2443. 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"
  2444. }, null, -1);
  2445. const _hoisted_3$G = [
  2446. _hoisted_2$T
  2447. ];
  2448. function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
  2449. return openBlock(), createElementBlock("svg", _hoisted_1$10, _hoisted_3$G);
  2450. }
  2451. var arrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1v, [["render", _sfc_render$11]]);
  2452. const _sfc_main$1u = defineComponent({
  2453. name: "ArrowUp"
  2454. });
  2455. const _hoisted_1$$ = {
  2456. viewBox: "0 0 1024 1024",
  2457. xmlns: "http://www.w3.org/2000/svg"
  2458. };
  2459. const _hoisted_2$S = /* @__PURE__ */ createElementVNode("path", {
  2460. fill: "currentColor",
  2461. 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"
  2462. }, null, -1);
  2463. const _hoisted_3$F = [
  2464. _hoisted_2$S
  2465. ];
  2466. function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
  2467. return openBlock(), createElementBlock("svg", _hoisted_1$$, _hoisted_3$F);
  2468. }
  2469. var arrowUp = /* @__PURE__ */ _export_sfc$2(_sfc_main$1u, [["render", _sfc_render$10]]);
  2470. const _sfc_main$1t = defineComponent({
  2471. name: "Calendar"
  2472. });
  2473. const _hoisted_1$_ = {
  2474. viewBox: "0 0 1024 1024",
  2475. xmlns: "http://www.w3.org/2000/svg"
  2476. };
  2477. const _hoisted_2$R = /* @__PURE__ */ createElementVNode("path", {
  2478. fill: "currentColor",
  2479. 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"
  2480. }, null, -1);
  2481. const _hoisted_3$E = [
  2482. _hoisted_2$R
  2483. ];
  2484. function _sfc_render$$(_ctx, _cache, $props, $setup, $data, $options) {
  2485. return openBlock(), createElementBlock("svg", _hoisted_1$_, _hoisted_3$E);
  2486. }
  2487. var calendar = /* @__PURE__ */ _export_sfc$2(_sfc_main$1t, [["render", _sfc_render$$]]);
  2488. const _sfc_main$1s = defineComponent({
  2489. name: "Check"
  2490. });
  2491. const _hoisted_1$Z = {
  2492. viewBox: "0 0 1024 1024",
  2493. xmlns: "http://www.w3.org/2000/svg"
  2494. };
  2495. const _hoisted_2$Q = /* @__PURE__ */ createElementVNode("path", {
  2496. fill: "currentColor",
  2497. 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"
  2498. }, null, -1);
  2499. const _hoisted_3$D = [
  2500. _hoisted_2$Q
  2501. ];
  2502. function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
  2503. return openBlock(), createElementBlock("svg", _hoisted_1$Z, _hoisted_3$D);
  2504. }
  2505. var check = /* @__PURE__ */ _export_sfc$2(_sfc_main$1s, [["render", _sfc_render$_]]);
  2506. const _sfc_main$1r = defineComponent({
  2507. name: "CircleCheck"
  2508. });
  2509. const _hoisted_1$Y = {
  2510. viewBox: "0 0 1024 1024",
  2511. xmlns: "http://www.w3.org/2000/svg"
  2512. };
  2513. const _hoisted_2$P = /* @__PURE__ */ createElementVNode("path", {
  2514. fill: "currentColor",
  2515. 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"
  2516. }, null, -1);
  2517. const _hoisted_3$C = /* @__PURE__ */ createElementVNode("path", {
  2518. fill: "currentColor",
  2519. 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"
  2520. }, null, -1);
  2521. const _hoisted_4$h = [
  2522. _hoisted_2$P,
  2523. _hoisted_3$C
  2524. ];
  2525. function _sfc_render$Z(_ctx, _cache, $props, $setup, $data, $options) {
  2526. return openBlock(), createElementBlock("svg", _hoisted_1$Y, _hoisted_4$h);
  2527. }
  2528. var circleCheck = /* @__PURE__ */ _export_sfc$2(_sfc_main$1r, [["render", _sfc_render$Z]]);
  2529. const _sfc_main$1q = defineComponent({
  2530. name: "CircleClose"
  2531. });
  2532. const _hoisted_1$X = {
  2533. viewBox: "0 0 1024 1024",
  2534. xmlns: "http://www.w3.org/2000/svg"
  2535. };
  2536. const _hoisted_2$O = /* @__PURE__ */ createElementVNode("path", {
  2537. fill: "currentColor",
  2538. 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"
  2539. }, null, -1);
  2540. const _hoisted_3$B = /* @__PURE__ */ createElementVNode("path", {
  2541. fill: "currentColor",
  2542. 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"
  2543. }, null, -1);
  2544. const _hoisted_4$g = [
  2545. _hoisted_2$O,
  2546. _hoisted_3$B
  2547. ];
  2548. function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
  2549. return openBlock(), createElementBlock("svg", _hoisted_1$X, _hoisted_4$g);
  2550. }
  2551. var circleClose = /* @__PURE__ */ _export_sfc$2(_sfc_main$1q, [["render", _sfc_render$Y]]);
  2552. const _sfc_main$1p = defineComponent({
  2553. name: "Clock"
  2554. });
  2555. const _hoisted_1$W = {
  2556. viewBox: "0 0 1024 1024",
  2557. xmlns: "http://www.w3.org/2000/svg"
  2558. };
  2559. const _hoisted_2$N = /* @__PURE__ */ createElementVNode("path", {
  2560. fill: "currentColor",
  2561. 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"
  2562. }, null, -1);
  2563. const _hoisted_3$A = /* @__PURE__ */ createElementVNode("path", {
  2564. fill: "currentColor",
  2565. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
  2566. }, null, -1);
  2567. const _hoisted_4$f = /* @__PURE__ */ createElementVNode("path", {
  2568. fill: "currentColor",
  2569. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z"
  2570. }, null, -1);
  2571. const _hoisted_5$c = [
  2572. _hoisted_2$N,
  2573. _hoisted_3$A,
  2574. _hoisted_4$f
  2575. ];
  2576. function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
  2577. return openBlock(), createElementBlock("svg", _hoisted_1$W, _hoisted_5$c);
  2578. }
  2579. var clock = /* @__PURE__ */ _export_sfc$2(_sfc_main$1p, [["render", _sfc_render$X]]);
  2580. const _sfc_main$1o = defineComponent({
  2581. name: "Close"
  2582. });
  2583. const _hoisted_1$V = {
  2584. viewBox: "0 0 1024 1024",
  2585. xmlns: "http://www.w3.org/2000/svg"
  2586. };
  2587. const _hoisted_2$M = /* @__PURE__ */ createElementVNode("path", {
  2588. fill: "currentColor",
  2589. 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"
  2590. }, null, -1);
  2591. const _hoisted_3$z = [
  2592. _hoisted_2$M
  2593. ];
  2594. function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
  2595. return openBlock(), createElementBlock("svg", _hoisted_1$V, _hoisted_3$z);
  2596. }
  2597. var close = /* @__PURE__ */ _export_sfc$2(_sfc_main$1o, [["render", _sfc_render$W]]);
  2598. const _sfc_main$1n = defineComponent({
  2599. name: "DArrowLeft"
  2600. });
  2601. const _hoisted_1$U = {
  2602. viewBox: "0 0 1024 1024",
  2603. xmlns: "http://www.w3.org/2000/svg"
  2604. };
  2605. const _hoisted_2$L = /* @__PURE__ */ createElementVNode("path", {
  2606. fill: "currentColor",
  2607. 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"
  2608. }, null, -1);
  2609. const _hoisted_3$y = [
  2610. _hoisted_2$L
  2611. ];
  2612. function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
  2613. return openBlock(), createElementBlock("svg", _hoisted_1$U, _hoisted_3$y);
  2614. }
  2615. var dArrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1n, [["render", _sfc_render$V]]);
  2616. const _sfc_main$1m = defineComponent({
  2617. name: "DArrowRight"
  2618. });
  2619. const _hoisted_1$T = {
  2620. viewBox: "0 0 1024 1024",
  2621. xmlns: "http://www.w3.org/2000/svg"
  2622. };
  2623. const _hoisted_2$K = /* @__PURE__ */ createElementVNode("path", {
  2624. fill: "currentColor",
  2625. 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"
  2626. }, null, -1);
  2627. const _hoisted_3$x = [
  2628. _hoisted_2$K
  2629. ];
  2630. function _sfc_render$U(_ctx, _cache, $props, $setup, $data, $options) {
  2631. return openBlock(), createElementBlock("svg", _hoisted_1$T, _hoisted_3$x);
  2632. }
  2633. var dArrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1m, [["render", _sfc_render$U]]);
  2634. const _sfc_main$1l = defineComponent({
  2635. name: "Delete"
  2636. });
  2637. const _hoisted_1$S = {
  2638. viewBox: "0 0 1024 1024",
  2639. xmlns: "http://www.w3.org/2000/svg"
  2640. };
  2641. const _hoisted_2$J = /* @__PURE__ */ createElementVNode("path", {
  2642. fill: "currentColor",
  2643. 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"
  2644. }, null, -1);
  2645. const _hoisted_3$w = [
  2646. _hoisted_2$J
  2647. ];
  2648. function _sfc_render$T(_ctx, _cache, $props, $setup, $data, $options) {
  2649. return openBlock(), createElementBlock("svg", _hoisted_1$S, _hoisted_3$w);
  2650. }
  2651. var _delete = /* @__PURE__ */ _export_sfc$2(_sfc_main$1l, [["render", _sfc_render$T]]);
  2652. const _sfc_main$1k = defineComponent({
  2653. name: "Document"
  2654. });
  2655. const _hoisted_1$R = {
  2656. viewBox: "0 0 1024 1024",
  2657. xmlns: "http://www.w3.org/2000/svg"
  2658. };
  2659. const _hoisted_2$I = /* @__PURE__ */ createElementVNode("path", {
  2660. fill: "currentColor",
  2661. 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"
  2662. }, null, -1);
  2663. const _hoisted_3$v = [
  2664. _hoisted_2$I
  2665. ];
  2666. function _sfc_render$S(_ctx, _cache, $props, $setup, $data, $options) {
  2667. return openBlock(), createElementBlock("svg", _hoisted_1$R, _hoisted_3$v);
  2668. }
  2669. var document$1 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1k, [["render", _sfc_render$S]]);
  2670. const _sfc_main$1j = defineComponent({
  2671. name: "FullScreen"
  2672. });
  2673. const _hoisted_1$Q = {
  2674. viewBox: "0 0 1024 1024",
  2675. xmlns: "http://www.w3.org/2000/svg"
  2676. };
  2677. const _hoisted_2$H = /* @__PURE__ */ createElementVNode("path", {
  2678. fill: "currentColor",
  2679. 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"
  2680. }, null, -1);
  2681. const _hoisted_3$u = [
  2682. _hoisted_2$H
  2683. ];
  2684. function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
  2685. return openBlock(), createElementBlock("svg", _hoisted_1$Q, _hoisted_3$u);
  2686. }
  2687. var fullScreen = /* @__PURE__ */ _export_sfc$2(_sfc_main$1j, [["render", _sfc_render$R]]);
  2688. const _sfc_main$1i = defineComponent({
  2689. name: "Hide"
  2690. });
  2691. const _hoisted_1$P = {
  2692. viewBox: "0 0 1024 1024",
  2693. xmlns: "http://www.w3.org/2000/svg"
  2694. };
  2695. const _hoisted_2$G = /* @__PURE__ */ createElementVNode("path", {
  2696. 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",
  2697. fill: "currentColor"
  2698. }, null, -1);
  2699. const _hoisted_3$t = /* @__PURE__ */ createElementVNode("path", {
  2700. 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",
  2701. fill: "currentColor"
  2702. }, null, -1);
  2703. const _hoisted_4$e = [
  2704. _hoisted_2$G,
  2705. _hoisted_3$t
  2706. ];
  2707. function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
  2708. return openBlock(), createElementBlock("svg", _hoisted_1$P, _hoisted_4$e);
  2709. }
  2710. var hide$2 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1i, [["render", _sfc_render$Q]]);
  2711. const _sfc_main$1h = defineComponent({
  2712. name: "Loading"
  2713. });
  2714. const _hoisted_1$O = {
  2715. viewBox: "0 0 1024 1024",
  2716. xmlns: "http://www.w3.org/2000/svg"
  2717. };
  2718. const _hoisted_2$F = /* @__PURE__ */ createElementVNode("path", {
  2719. fill: "currentColor",
  2720. 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"
  2721. }, null, -1);
  2722. const _hoisted_3$s = [
  2723. _hoisted_2$F
  2724. ];
  2725. function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
  2726. return openBlock(), createElementBlock("svg", _hoisted_1$O, _hoisted_3$s);
  2727. }
  2728. var loading = /* @__PURE__ */ _export_sfc$2(_sfc_main$1h, [["render", _sfc_render$P]]);
  2729. const _sfc_main$1g = defineComponent({
  2730. name: "Minus"
  2731. });
  2732. const _hoisted_1$N = {
  2733. viewBox: "0 0 1024 1024",
  2734. xmlns: "http://www.w3.org/2000/svg"
  2735. };
  2736. const _hoisted_2$E = /* @__PURE__ */ createElementVNode("path", {
  2737. fill: "currentColor",
  2738. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  2739. }, null, -1);
  2740. const _hoisted_3$r = [
  2741. _hoisted_2$E
  2742. ];
  2743. function _sfc_render$O(_ctx, _cache, $props, $setup, $data, $options) {
  2744. return openBlock(), createElementBlock("svg", _hoisted_1$N, _hoisted_3$r);
  2745. }
  2746. var minus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1g, [["render", _sfc_render$O]]);
  2747. const _sfc_main$1f = defineComponent({
  2748. name: "Plus"
  2749. });
  2750. const _hoisted_1$M = {
  2751. viewBox: "0 0 1024 1024",
  2752. xmlns: "http://www.w3.org/2000/svg"
  2753. };
  2754. const _hoisted_2$D = /* @__PURE__ */ createElementVNode("path", {
  2755. fill: "currentColor",
  2756. 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"
  2757. }, null, -1);
  2758. const _hoisted_3$q = [
  2759. _hoisted_2$D
  2760. ];
  2761. function _sfc_render$N(_ctx, _cache, $props, $setup, $data, $options) {
  2762. return openBlock(), createElementBlock("svg", _hoisted_1$M, _hoisted_3$q);
  2763. }
  2764. var plus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1f, [["render", _sfc_render$N]]);
  2765. const _sfc_main$1e = defineComponent({
  2766. name: "RefreshLeft"
  2767. });
  2768. const _hoisted_1$L = {
  2769. viewBox: "0 0 1024 1024",
  2770. xmlns: "http://www.w3.org/2000/svg"
  2771. };
  2772. const _hoisted_2$C = /* @__PURE__ */ createElementVNode("path", {
  2773. fill: "currentColor",
  2774. 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"
  2775. }, null, -1);
  2776. const _hoisted_3$p = [
  2777. _hoisted_2$C
  2778. ];
  2779. function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
  2780. return openBlock(), createElementBlock("svg", _hoisted_1$L, _hoisted_3$p);
  2781. }
  2782. var refreshLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1e, [["render", _sfc_render$M]]);
  2783. const _sfc_main$1d = defineComponent({
  2784. name: "RefreshRight"
  2785. });
  2786. const _hoisted_1$K = {
  2787. viewBox: "0 0 1024 1024",
  2788. xmlns: "http://www.w3.org/2000/svg"
  2789. };
  2790. const _hoisted_2$B = /* @__PURE__ */ createElementVNode("path", {
  2791. fill: "currentColor",
  2792. 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"
  2793. }, null, -1);
  2794. const _hoisted_3$o = [
  2795. _hoisted_2$B
  2796. ];
  2797. function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
  2798. return openBlock(), createElementBlock("svg", _hoisted_1$K, _hoisted_3$o);
  2799. }
  2800. var refreshRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1d, [["render", _sfc_render$L]]);
  2801. const _sfc_main$1c = defineComponent({
  2802. name: "ScaleToOriginal"
  2803. });
  2804. const _hoisted_1$J = {
  2805. viewBox: "0 0 1024 1024",
  2806. xmlns: "http://www.w3.org/2000/svg"
  2807. };
  2808. const _hoisted_2$A = /* @__PURE__ */ createElementVNode("path", {
  2809. fill: "currentColor",
  2810. 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"
  2811. }, null, -1);
  2812. const _hoisted_3$n = [
  2813. _hoisted_2$A
  2814. ];
  2815. function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
  2816. return openBlock(), createElementBlock("svg", _hoisted_1$J, _hoisted_3$n);
  2817. }
  2818. var scaleToOriginal = /* @__PURE__ */ _export_sfc$2(_sfc_main$1c, [["render", _sfc_render$K]]);
  2819. const _sfc_main$1b = defineComponent({
  2820. name: "StarFilled"
  2821. });
  2822. const _hoisted_1$I = {
  2823. viewBox: "0 0 1024 1024",
  2824. xmlns: "http://www.w3.org/2000/svg"
  2825. };
  2826. const _hoisted_2$z = /* @__PURE__ */ createElementVNode("path", {
  2827. fill: "currentColor",
  2828. 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"
  2829. }, null, -1);
  2830. const _hoisted_3$m = [
  2831. _hoisted_2$z
  2832. ];
  2833. function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
  2834. return openBlock(), createElementBlock("svg", _hoisted_1$I, _hoisted_3$m);
  2835. }
  2836. var starFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$1b, [["render", _sfc_render$J]]);
  2837. const _sfc_main$1a = defineComponent({
  2838. name: "Star"
  2839. });
  2840. const _hoisted_1$H = {
  2841. viewBox: "0 0 1024 1024",
  2842. xmlns: "http://www.w3.org/2000/svg"
  2843. };
  2844. const _hoisted_2$y = /* @__PURE__ */ createElementVNode("path", {
  2845. fill: "currentColor",
  2846. 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"
  2847. }, null, -1);
  2848. const _hoisted_3$l = [
  2849. _hoisted_2$y
  2850. ];
  2851. function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
  2852. return openBlock(), createElementBlock("svg", _hoisted_1$H, _hoisted_3$l);
  2853. }
  2854. var star = /* @__PURE__ */ _export_sfc$2(_sfc_main$1a, [["render", _sfc_render$I]]);
  2855. const _sfc_main$19 = defineComponent({
  2856. name: "View"
  2857. });
  2858. const _hoisted_1$G = {
  2859. viewBox: "0 0 1024 1024",
  2860. xmlns: "http://www.w3.org/2000/svg"
  2861. };
  2862. const _hoisted_2$x = /* @__PURE__ */ createElementVNode("path", {
  2863. fill: "currentColor",
  2864. 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"
  2865. }, null, -1);
  2866. const _hoisted_3$k = [
  2867. _hoisted_2$x
  2868. ];
  2869. function _sfc_render$H(_ctx, _cache, $props, $setup, $data, $options) {
  2870. return openBlock(), createElementBlock("svg", _hoisted_1$G, _hoisted_3$k);
  2871. }
  2872. var view = /* @__PURE__ */ _export_sfc$2(_sfc_main$19, [["render", _sfc_render$H]]);
  2873. const _sfc_main$18 = defineComponent({
  2874. name: "WarningFilled"
  2875. });
  2876. const _hoisted_1$F = {
  2877. viewBox: "0 0 1024 1024",
  2878. xmlns: "http://www.w3.org/2000/svg"
  2879. };
  2880. const _hoisted_2$w = /* @__PURE__ */ createElementVNode("path", {
  2881. fill: "currentColor",
  2882. 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"
  2883. }, null, -1);
  2884. const _hoisted_3$j = [
  2885. _hoisted_2$w
  2886. ];
  2887. function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
  2888. return openBlock(), createElementBlock("svg", _hoisted_1$F, _hoisted_3$j);
  2889. }
  2890. var warningFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$18, [["render", _sfc_render$G]]);
  2891. const _sfc_main$17 = defineComponent({
  2892. name: "ZoomIn"
  2893. });
  2894. const _hoisted_1$E = {
  2895. viewBox: "0 0 1024 1024",
  2896. xmlns: "http://www.w3.org/2000/svg"
  2897. };
  2898. const _hoisted_2$v = /* @__PURE__ */ createElementVNode("path", {
  2899. fill: "currentColor",
  2900. 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"
  2901. }, null, -1);
  2902. const _hoisted_3$i = [
  2903. _hoisted_2$v
  2904. ];
  2905. function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
  2906. return openBlock(), createElementBlock("svg", _hoisted_1$E, _hoisted_3$i);
  2907. }
  2908. var zoomIn = /* @__PURE__ */ _export_sfc$2(_sfc_main$17, [["render", _sfc_render$F]]);
  2909. const _sfc_main$16 = defineComponent({
  2910. name: "ZoomOut"
  2911. });
  2912. const _hoisted_1$D = {
  2913. viewBox: "0 0 1024 1024",
  2914. xmlns: "http://www.w3.org/2000/svg"
  2915. };
  2916. const _hoisted_2$u = /* @__PURE__ */ createElementVNode("path", {
  2917. fill: "currentColor",
  2918. 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"
  2919. }, null, -1);
  2920. const _hoisted_3$h = [
  2921. _hoisted_2$u
  2922. ];
  2923. function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
  2924. return openBlock(), createElementBlock("svg", _hoisted_1$D, _hoisted_3$h);
  2925. }
  2926. var zoomOut = /* @__PURE__ */ _export_sfc$2(_sfc_main$16, [["render", _sfc_render$E]]);
  2927. const wrapperKey = Symbol();
  2928. const propKey = "__elPropsReservedKey";
  2929. function buildProp(option, key) {
  2930. if (!isObject$1(option) || !!option[propKey])
  2931. return option;
  2932. const { values, required: required4, default: defaultValue, type: type4, validator } = option;
  2933. const _validator = values || validator ? (val) => {
  2934. let valid = false;
  2935. let allowedValues = [];
  2936. if (values) {
  2937. allowedValues = Array.from(values);
  2938. if (hasOwn(option, "default")) {
  2939. allowedValues.push(defaultValue);
  2940. }
  2941. valid || (valid = allowedValues.includes(val));
  2942. }
  2943. if (validator)
  2944. valid || (valid = validator(val));
  2945. if (!valid && allowedValues.length > 0) {
  2946. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  2947. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  2948. }
  2949. return valid;
  2950. } : void 0;
  2951. const prop = {
  2952. type: isObject$1(type4) && Object.getOwnPropertySymbols(type4).includes(wrapperKey) ? type4[wrapperKey] : type4,
  2953. required: !!required4,
  2954. validator: _validator,
  2955. [propKey]: true
  2956. };
  2957. if (hasOwn(option, "default"))
  2958. prop.default = defaultValue;
  2959. return prop;
  2960. }
  2961. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  2962. key,
  2963. buildProp(option, key)
  2964. ]));
  2965. const definePropType = (val) => ({ [wrapperKey]: val });
  2966. const iconPropType = definePropType([
  2967. String,
  2968. Object,
  2969. Function
  2970. ]);
  2971. const CloseComponents = {
  2972. Close: close
  2973. };
  2974. const ValidateComponentsMap = {
  2975. validating: loading,
  2976. success: circleCheck,
  2977. error: circleClose
  2978. };
  2979. const withInstall = (main2, extra) => {
  2980. main2.install = (app) => {
  2981. for (const comp of [main2, ...Object.values(extra != null ? extra : {})]) {
  2982. app.component(comp.name, comp);
  2983. }
  2984. };
  2985. if (extra) {
  2986. for (const [key, comp] of Object.entries(extra)) {
  2987. main2[key] = comp;
  2988. }
  2989. }
  2990. return main2;
  2991. };
  2992. const withNoopInstall = (component) => {
  2993. component.install = NOOP;
  2994. return component;
  2995. };
  2996. class ElementPlusError extends Error {
  2997. constructor(m2) {
  2998. super(m2);
  2999. this.name = "ElementPlusError";
  3000. }
  3001. }
  3002. function throwError(scope, m2) {
  3003. throw new ElementPlusError(`[${scope}] ${m2}`);
  3004. }
  3005. function debugWarn(scope, message) {
  3006. }
  3007. function addUnit(value, defaultUnit = "px") {
  3008. if (!value)
  3009. return "";
  3010. if (isString(value)) {
  3011. return value;
  3012. } else if (isNumber(value)) {
  3013. return `${value}${defaultUnit}`;
  3014. }
  3015. }
  3016. const EVENT_CODE = {
  3017. tab: "Tab",
  3018. enter: "Enter",
  3019. space: "Space",
  3020. left: "ArrowLeft",
  3021. up: "ArrowUp",
  3022. right: "ArrowRight",
  3023. down: "ArrowDown",
  3024. esc: "Escape",
  3025. delete: "Delete",
  3026. backspace: "Backspace",
  3027. numpadEnter: "NumpadEnter",
  3028. pageUp: "PageUp",
  3029. pageDown: "PageDown",
  3030. home: "Home",
  3031. end: "End"
  3032. };
  3033. const datePickTypes = [
  3034. "year",
  3035. "month",
  3036. "date",
  3037. "dates",
  3038. "week",
  3039. "datetime",
  3040. "datetimerange",
  3041. "daterange",
  3042. "monthrange"
  3043. ];
  3044. const UPDATE_MODEL_EVENT = "update:modelValue";
  3045. const CHANGE_EVENT = "change";
  3046. const INPUT_EVENT = "input";
  3047. const componentSizes = ["", "default", "small", "large"];
  3048. const componentSizeMap = {
  3049. large: 40,
  3050. default: 32,
  3051. small: 24
  3052. };
  3053. const getComponentSize = (size = "default") => {
  3054. return componentSizeMap[size || "default"];
  3055. };
  3056. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  3057. const isValidDatePickType = (val) => [...datePickTypes].includes(val);
  3058. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  3059. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  3060. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  3061. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  3062. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  3063. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  3064. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  3065. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  3066. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  3067. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  3068. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  3069. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  3070. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  3071. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  3072. return PatchFlags2;
  3073. })(PatchFlags || {});
  3074. function isFragment(node) {
  3075. return isVNode(node) && node.type === Fragment;
  3076. }
  3077. function isComment(node) {
  3078. return isVNode(node) && node.type === Comment;
  3079. }
  3080. function isValidElementNode(node) {
  3081. return isVNode(node) && !isFragment(node) && !isComment(node);
  3082. }
  3083. const unique = (arr) => [...new Set(arr)];
  3084. const castArray = (arr) => {
  3085. if (!arr && arr !== 0)
  3086. return [];
  3087. return Array.isArray(arr) ? arr : [arr];
  3088. };
  3089. const isFirefox = () => isClient$1 && /firefox/i.test(window.navigator.userAgent);
  3090. const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
  3091. const generateId = () => Math.floor(Math.random() * 1e4);
  3092. const mutable = (val) => val;
  3093. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  3094. const LISTENER_PREFIX = /^on[A-Z]/;
  3095. const useAttrs = (params = {}) => {
  3096. const { excludeListeners = false, excludeKeys = [] } = params;
  3097. const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
  3098. const instance = getCurrentInstance();
  3099. if (!instance) {
  3100. return computed(() => ({}));
  3101. }
  3102. return computed(() => {
  3103. var _a2;
  3104. return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  3105. });
  3106. };
  3107. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  3108. const configProviderContextKey = Symbol();
  3109. const dialogInjectionKey = Symbol("dialogInjectionKey");
  3110. const formContextKey = Symbol("formContextKey");
  3111. const formItemContextKey = Symbol("formItemContextKey");
  3112. const radioGroupKey = Symbol("radioGroupKey");
  3113. const scrollbarContextKey = Symbol("scrollbarContextKey");
  3114. const uploadContextKey = Symbol("uploadContextKey");
  3115. const POPPER_INJECTION_KEY = Symbol("popper");
  3116. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  3117. const useProp = (name) => {
  3118. const vm = getCurrentInstance();
  3119. return computed(() => {
  3120. var _a2, _b2;
  3121. return (_b2 = (_a2 = vm.proxy) == null ? void 0 : _a2.$props[name]) != null ? _b2 : void 0;
  3122. });
  3123. };
  3124. const globalConfig = ref();
  3125. function useGlobalConfig(key, defaultValue = void 0) {
  3126. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  3127. if (key) {
  3128. return computed(() => {
  3129. var _a2, _b2;
  3130. return (_b2 = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b2 : defaultValue;
  3131. });
  3132. } else {
  3133. return config;
  3134. }
  3135. }
  3136. const useSizeProp = buildProp({
  3137. type: String,
  3138. values: componentSizes,
  3139. required: false
  3140. });
  3141. const useSize = (fallback, ignore = {}) => {
  3142. const emptyRef = ref(void 0);
  3143. const size = ignore.prop ? emptyRef : useProp("size");
  3144. const globalConfig2 = ignore.global ? emptyRef : useGlobalConfig("size");
  3145. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  3146. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  3147. return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  3148. };
  3149. const useDisabled$1 = (fallback) => {
  3150. const disabled = useProp("disabled");
  3151. const form = inject(formContextKey, void 0);
  3152. return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  3153. };
  3154. const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type: type4 = "API" }, condition) => {
  3155. watch(() => unref(condition), (val) => {
  3156. }, {
  3157. immediate: true
  3158. });
  3159. };
  3160. const useDraggable = (targetRef, dragRef, draggable) => {
  3161. let transform = {
  3162. offsetX: 0,
  3163. offsetY: 0
  3164. };
  3165. const onMousedown = (e) => {
  3166. const downX = e.clientX;
  3167. const downY = e.clientY;
  3168. const { offsetX, offsetY } = transform;
  3169. const targetRect = targetRef.value.getBoundingClientRect();
  3170. const targetLeft = targetRect.left;
  3171. const targetTop = targetRect.top;
  3172. const targetWidth = targetRect.width;
  3173. const targetHeight = targetRect.height;
  3174. const clientWidth = document.documentElement.clientWidth;
  3175. const clientHeight = document.documentElement.clientHeight;
  3176. const minLeft = -targetLeft + offsetX;
  3177. const minTop = -targetTop + offsetY;
  3178. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  3179. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  3180. const onMousemove = (e2) => {
  3181. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  3182. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  3183. transform = {
  3184. offsetX: moveX,
  3185. offsetY: moveY
  3186. };
  3187. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  3188. };
  3189. const onMouseup = () => {
  3190. document.removeEventListener("mousemove", onMousemove);
  3191. document.removeEventListener("mouseup", onMouseup);
  3192. };
  3193. document.addEventListener("mousemove", onMousemove);
  3194. document.addEventListener("mouseup", onMouseup);
  3195. };
  3196. const onDraggable = () => {
  3197. if (dragRef.value && targetRef.value) {
  3198. dragRef.value.addEventListener("mousedown", onMousedown);
  3199. }
  3200. };
  3201. const offDraggable = () => {
  3202. if (dragRef.value && targetRef.value) {
  3203. dragRef.value.removeEventListener("mousedown", onMousedown);
  3204. }
  3205. };
  3206. onMounted(() => {
  3207. watchEffect(() => {
  3208. if (draggable.value) {
  3209. onDraggable();
  3210. } else {
  3211. offDraggable();
  3212. }
  3213. });
  3214. });
  3215. onBeforeUnmount(() => {
  3216. offDraggable();
  3217. });
  3218. };
  3219. const useFocus = (el) => {
  3220. return {
  3221. focus: () => {
  3222. var _a2, _b2;
  3223. (_b2 = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  3224. }
  3225. };
  3226. };
  3227. const useFormItem = () => {
  3228. const form = inject(formContextKey, void 0);
  3229. const formItem = inject(formItemContextKey, void 0);
  3230. return {
  3231. form,
  3232. formItem
  3233. };
  3234. };
  3235. var English = {
  3236. name: "en",
  3237. el: {
  3238. colorpicker: {
  3239. confirm: "OK",
  3240. clear: "Clear"
  3241. },
  3242. datepicker: {
  3243. now: "Now",
  3244. today: "Today",
  3245. cancel: "Cancel",
  3246. clear: "Clear",
  3247. confirm: "OK",
  3248. selectDate: "Select date",
  3249. selectTime: "Select time",
  3250. startDate: "Start Date",
  3251. startTime: "Start Time",
  3252. endDate: "End Date",
  3253. endTime: "End Time",
  3254. prevYear: "Previous Year",
  3255. nextYear: "Next Year",
  3256. prevMonth: "Previous Month",
  3257. nextMonth: "Next Month",
  3258. year: "",
  3259. month1: "January",
  3260. month2: "February",
  3261. month3: "March",
  3262. month4: "April",
  3263. month5: "May",
  3264. month6: "June",
  3265. month7: "July",
  3266. month8: "August",
  3267. month9: "September",
  3268. month10: "October",
  3269. month11: "November",
  3270. month12: "December",
  3271. week: "week",
  3272. weeks: {
  3273. sun: "Sun",
  3274. mon: "Mon",
  3275. tue: "Tue",
  3276. wed: "Wed",
  3277. thu: "Thu",
  3278. fri: "Fri",
  3279. sat: "Sat"
  3280. },
  3281. months: {
  3282. jan: "Jan",
  3283. feb: "Feb",
  3284. mar: "Mar",
  3285. apr: "Apr",
  3286. may: "May",
  3287. jun: "Jun",
  3288. jul: "Jul",
  3289. aug: "Aug",
  3290. sep: "Sep",
  3291. oct: "Oct",
  3292. nov: "Nov",
  3293. dec: "Dec"
  3294. }
  3295. },
  3296. select: {
  3297. loading: "Loading",
  3298. noMatch: "No matching data",
  3299. noData: "No data",
  3300. placeholder: "Select"
  3301. },
  3302. cascader: {
  3303. noMatch: "No matching data",
  3304. loading: "Loading",
  3305. placeholder: "Select",
  3306. noData: "No data"
  3307. },
  3308. pagination: {
  3309. goto: "Go to",
  3310. pagesize: "/page",
  3311. total: "Total {total}",
  3312. pageClassifier: "",
  3313. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  3314. },
  3315. messagebox: {
  3316. title: "Message",
  3317. confirm: "OK",
  3318. cancel: "Cancel",
  3319. error: "Illegal input"
  3320. },
  3321. upload: {
  3322. deleteTip: "press delete to remove",
  3323. delete: "Delete",
  3324. preview: "Preview",
  3325. continue: "Continue"
  3326. },
  3327. table: {
  3328. emptyText: "No Data",
  3329. confirmFilter: "Confirm",
  3330. resetFilter: "Reset",
  3331. clearFilter: "All",
  3332. sumText: "Sum"
  3333. },
  3334. tree: {
  3335. emptyText: "No Data"
  3336. },
  3337. transfer: {
  3338. noMatch: "No matching data",
  3339. noData: "No data",
  3340. titles: ["List 1", "List 2"],
  3341. filterPlaceholder: "Enter keyword",
  3342. noCheckedFormat: "{total} items",
  3343. hasCheckedFormat: "{checked}/{total} checked"
  3344. },
  3345. image: {
  3346. error: "FAILED"
  3347. },
  3348. pageHeader: {
  3349. title: "Back"
  3350. },
  3351. popconfirm: {
  3352. confirmButtonText: "Yes",
  3353. cancelButtonText: "No"
  3354. }
  3355. }
  3356. };
  3357. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  3358. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_2, key) => {
  3359. var _a2;
  3360. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  3361. });
  3362. const buildLocaleContext = (locale) => {
  3363. const lang = computed(() => unref(locale).name);
  3364. const localeRef = isRef(locale) ? locale : ref(locale);
  3365. return {
  3366. lang,
  3367. locale: localeRef,
  3368. t: buildTranslator(locale)
  3369. };
  3370. };
  3371. const useLocale = () => {
  3372. const locale = useGlobalConfig("locale");
  3373. return buildLocaleContext(computed(() => locale.value || English));
  3374. };
  3375. const useLockscreen = (trigger) => {
  3376. if (!isRef(trigger)) {
  3377. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  3378. }
  3379. if (!isClient$1 || hasClass(document.body, "el-popup-parent--hidden")) {
  3380. return;
  3381. }
  3382. let scrollBarWidth2 = 0;
  3383. let withoutHiddenClass = false;
  3384. let bodyPaddingRight = "0";
  3385. let computedBodyPaddingRight = 0;
  3386. const cleanup = () => {
  3387. removeClass(document.body, "el-popup-parent--hidden");
  3388. if (withoutHiddenClass) {
  3389. document.body.style.paddingRight = bodyPaddingRight;
  3390. }
  3391. };
  3392. watch(trigger, (val) => {
  3393. if (!val) {
  3394. cleanup();
  3395. return;
  3396. }
  3397. withoutHiddenClass = !hasClass(document.body, "el-popup-parent--hidden");
  3398. if (withoutHiddenClass) {
  3399. bodyPaddingRight = document.body.style.paddingRight;
  3400. computedBodyPaddingRight = Number.parseInt(getStyle(document.body, "paddingRight"), 10);
  3401. }
  3402. scrollBarWidth2 = getScrollBarWidth();
  3403. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  3404. const bodyOverflowY = getStyle(document.body, "overflowY");
  3405. if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  3406. document.body.style.paddingRight = `${computedBodyPaddingRight + scrollBarWidth2}px`;
  3407. }
  3408. addClass(document.body, "el-popup-parent--hidden");
  3409. });
  3410. onScopeDispose(() => cleanup());
  3411. };
  3412. const modalStack = [];
  3413. const closeModal = (e) => {
  3414. if (modalStack.length === 0)
  3415. return;
  3416. if (e.code === EVENT_CODE.esc) {
  3417. e.stopPropagation();
  3418. const topModal = modalStack[modalStack.length - 1];
  3419. topModal.handleClose();
  3420. }
  3421. };
  3422. const useModal = (instance, visibleRef) => {
  3423. watch(visibleRef, (val) => {
  3424. if (val) {
  3425. modalStack.push(instance);
  3426. } else {
  3427. modalStack.splice(modalStack.indexOf(instance), 1);
  3428. }
  3429. });
  3430. };
  3431. if (isClient$1)
  3432. useEventListener(document, "keydown", closeModal);
  3433. const _prop = buildProp({
  3434. type: definePropType(Boolean),
  3435. default: null
  3436. });
  3437. const _event = buildProp({
  3438. type: definePropType(Function)
  3439. });
  3440. const createModelToggleComposable = (name) => {
  3441. const useModelToggleProps2 = {
  3442. [name]: _prop,
  3443. [`onUpdate:${name}`]: _event
  3444. };
  3445. const useModelToggleEmits2 = [`update:${name}`];
  3446. const useModelToggle2 = ({
  3447. indicator,
  3448. shouldHideWhenRouteChanges,
  3449. shouldProceed,
  3450. onShow,
  3451. onHide
  3452. }) => {
  3453. const instance = getCurrentInstance();
  3454. const props = instance.props;
  3455. const { emit } = instance;
  3456. const updateEventKey = `update:${name}`;
  3457. const hasUpdateHandler = computed(() => isFunction(props[`onUpdate:${name}`]));
  3458. const isModelBindingAbsent = computed(() => props[name] === null);
  3459. const doShow = () => {
  3460. if (indicator.value === true) {
  3461. return;
  3462. }
  3463. indicator.value = true;
  3464. if (isFunction(onShow)) {
  3465. onShow();
  3466. }
  3467. };
  3468. const doHide = () => {
  3469. if (indicator.value === false) {
  3470. return;
  3471. }
  3472. indicator.value = false;
  3473. if (isFunction(onHide)) {
  3474. onHide();
  3475. }
  3476. };
  3477. const show = () => {
  3478. if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
  3479. return;
  3480. const shouldEmit = hasUpdateHandler.value && isClient$1;
  3481. if (shouldEmit) {
  3482. emit(updateEventKey, true);
  3483. }
  3484. if (isModelBindingAbsent.value || !shouldEmit) {
  3485. doShow();
  3486. }
  3487. };
  3488. const hide2 = () => {
  3489. if (props.disabled === true || !isClient$1)
  3490. return;
  3491. const shouldEmit = hasUpdateHandler.value && isClient$1;
  3492. if (shouldEmit) {
  3493. emit(updateEventKey, false);
  3494. }
  3495. if (isModelBindingAbsent.value || !shouldEmit) {
  3496. doHide();
  3497. }
  3498. };
  3499. const onChange = (val) => {
  3500. if (!isBoolean(val))
  3501. return;
  3502. if (props.disabled && val) {
  3503. if (hasUpdateHandler.value) {
  3504. emit(updateEventKey, false);
  3505. }
  3506. } else if (indicator.value !== val) {
  3507. if (val) {
  3508. doShow();
  3509. } else {
  3510. doHide();
  3511. }
  3512. }
  3513. };
  3514. const toggle = () => {
  3515. if (indicator.value) {
  3516. hide2();
  3517. } else {
  3518. show();
  3519. }
  3520. };
  3521. watch(() => props[name], onChange);
  3522. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  3523. watch(() => __spreadValues({}, instance.proxy.$route), () => {
  3524. if (shouldHideWhenRouteChanges.value && indicator.value) {
  3525. hide2();
  3526. }
  3527. });
  3528. }
  3529. onMounted(() => {
  3530. onChange(props[name]);
  3531. });
  3532. return {
  3533. hide: hide2,
  3534. show,
  3535. toggle
  3536. };
  3537. };
  3538. return {
  3539. useModelToggle: useModelToggle2,
  3540. useModelToggleProps: useModelToggleProps2,
  3541. useModelToggleEmits: useModelToggleEmits2
  3542. };
  3543. };
  3544. const useRestoreActive = (toggle, initialFocus) => {
  3545. let previousActive;
  3546. watch(() => toggle.value, (val) => {
  3547. var _a2, _b2;
  3548. if (val) {
  3549. previousActive = document.activeElement;
  3550. if (isRef(initialFocus)) {
  3551. (_b2 = (_a2 = initialFocus.value).focus) == null ? void 0 : _b2.call(_a2);
  3552. }
  3553. } else {
  3554. {
  3555. previousActive.focus();
  3556. }
  3557. }
  3558. });
  3559. };
  3560. const useSameTarget = (handleClick) => {
  3561. if (!handleClick) {
  3562. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  3563. }
  3564. let mousedownTarget = false;
  3565. let mouseupTarget = false;
  3566. const onClick = (e) => {
  3567. if (mousedownTarget && mouseupTarget) {
  3568. handleClick(e);
  3569. }
  3570. mousedownTarget = mouseupTarget = false;
  3571. };
  3572. const onMousedown = (e) => {
  3573. mousedownTarget = e.target === e.currentTarget;
  3574. };
  3575. const onMouseup = (e) => {
  3576. mouseupTarget = e.target === e.currentTarget;
  3577. };
  3578. return { onClick, onMousedown, onMouseup };
  3579. };
  3580. function useTimeout() {
  3581. let timeoutHandle;
  3582. const registerTimeout = (fn2, delay) => {
  3583. cancelTimeout();
  3584. timeoutHandle = window.setTimeout(fn2, delay);
  3585. };
  3586. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  3587. tryOnScopeDispose(() => cancelTimeout());
  3588. return {
  3589. registerTimeout,
  3590. cancelTimeout
  3591. };
  3592. }
  3593. const defaultIdInjection = {
  3594. prefix: Math.floor(Math.random() * 1e4),
  3595. current: 0
  3596. };
  3597. const ID_INJECTION_KEY = Symbol("elIdInjection");
  3598. const useId = (deterministicId) => {
  3599. const idInjection = inject(ID_INJECTION_KEY, defaultIdInjection);
  3600. const idRef = computed(() => unref(deterministicId) || `el-id-${idInjection.prefix}-${idInjection.current++}`);
  3601. return idRef;
  3602. };
  3603. const useEscapeKeydown = (handler3) => {
  3604. const cachedHandler = (e) => {
  3605. const event = e;
  3606. if (event.key === EVENT_CODE.esc) {
  3607. handler3 == null ? void 0 : handler3(event);
  3608. }
  3609. };
  3610. onMounted(() => {
  3611. on(document, "keydown", cachedHandler);
  3612. });
  3613. onBeforeUnmount(() => {
  3614. off(document, "keydown", cachedHandler);
  3615. });
  3616. };
  3617. let cachedContainer;
  3618. const POPPER_CONTAINER_ID = `el-popper-container-${generateId()}`;
  3619. const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`;
  3620. const createContainer = () => {
  3621. const container = document.createElement("div");
  3622. container.id = POPPER_CONTAINER_ID;
  3623. document.body.appendChild(container);
  3624. return container;
  3625. };
  3626. const usePopperContainer = () => {
  3627. onBeforeMount(() => {
  3628. if (!isClient$1)
  3629. return;
  3630. if (!cachedContainer || !document.body.querySelector(POPPER_CONTAINER_SELECTOR)) {
  3631. cachedContainer = createContainer();
  3632. }
  3633. });
  3634. };
  3635. const useDelayedToggleProps = buildProps({
  3636. showAfter: {
  3637. type: Number,
  3638. default: 0
  3639. },
  3640. hideAfter: {
  3641. type: Number,
  3642. default: 200
  3643. }
  3644. });
  3645. const useDelayedToggle = ({
  3646. showAfter,
  3647. hideAfter,
  3648. open,
  3649. close: close2
  3650. }) => {
  3651. const { registerTimeout } = useTimeout();
  3652. const onOpen = () => {
  3653. registerTimeout(() => {
  3654. open();
  3655. }, unref(showAfter));
  3656. };
  3657. const onClose = () => {
  3658. registerTimeout(() => {
  3659. close2();
  3660. }, unref(hideAfter));
  3661. };
  3662. return {
  3663. onOpen,
  3664. onClose
  3665. };
  3666. };
  3667. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  3668. const useForwardRef = (forwardRef) => {
  3669. const setForwardRef = (el) => {
  3670. forwardRef.value = el;
  3671. };
  3672. provide(FORWARD_REF_INJECTION_KEY, {
  3673. setForwardRef
  3674. });
  3675. };
  3676. const useForwardRefDirective = (setForwardRef) => {
  3677. return {
  3678. mounted(el) {
  3679. setForwardRef(el);
  3680. },
  3681. updated(el) {
  3682. setForwardRef(el);
  3683. },
  3684. unmounted() {
  3685. setForwardRef(null);
  3686. }
  3687. };
  3688. };
  3689. const defaultNamespace = "el";
  3690. const statePrefix = "is-";
  3691. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  3692. let cls = `${namespace}-${block}`;
  3693. if (blockSuffix) {
  3694. cls += `-${blockSuffix}`;
  3695. }
  3696. if (element) {
  3697. cls += `__${element}`;
  3698. }
  3699. if (modifier) {
  3700. cls += `--${modifier}`;
  3701. }
  3702. return cls;
  3703. };
  3704. const useNamespace = (block) => {
  3705. const globalConfig2 = useGlobalConfig("namespace");
  3706. const namespace = computed(() => globalConfig2.value || defaultNamespace);
  3707. const b2 = (blockSuffix = "") => _bem(unref(namespace), block, blockSuffix, "", "");
  3708. const e = (element) => element ? _bem(unref(namespace), block, "", element, "") : "";
  3709. const m2 = (modifier) => modifier ? _bem(unref(namespace), block, "", "", modifier) : "";
  3710. const be = (blockSuffix, element) => blockSuffix && element ? _bem(unref(namespace), block, blockSuffix, element, "") : "";
  3711. const em = (element, modifier) => element && modifier ? _bem(unref(namespace), block, "", element, modifier) : "";
  3712. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(unref(namespace), block, blockSuffix, "", modifier) : "";
  3713. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(unref(namespace), block, blockSuffix, element, modifier) : "";
  3714. const is = (name, ...args) => {
  3715. const state = args.length >= 1 ? args[0] : true;
  3716. return name && state ? `${statePrefix}${name}` : "";
  3717. };
  3718. return {
  3719. namespace,
  3720. b: b2,
  3721. e,
  3722. m: m2,
  3723. be,
  3724. em,
  3725. bm,
  3726. bem,
  3727. is
  3728. };
  3729. };
  3730. const zIndex = ref(0);
  3731. const useZIndex = () => {
  3732. const initialZIndex = useGlobalConfig("zIndex", 2e3);
  3733. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  3734. const nextZIndex = () => {
  3735. zIndex.value++;
  3736. return currentZIndex.value;
  3737. };
  3738. return {
  3739. initialZIndex,
  3740. currentZIndex,
  3741. nextZIndex
  3742. };
  3743. };
  3744. var _export_sfc$1 = (sfc, props) => {
  3745. const target = sfc.__vccOpts || sfc;
  3746. for (const [key, val] of props) {
  3747. target[key] = val;
  3748. }
  3749. return target;
  3750. };
  3751. const iconProps = buildProps({
  3752. size: {
  3753. type: definePropType([Number, String])
  3754. },
  3755. color: {
  3756. type: String
  3757. }
  3758. });
  3759. const __default__$l = {
  3760. name: "ElIcon",
  3761. inheritAttrs: false
  3762. };
  3763. const _sfc_main$15 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$l), {
  3764. props: iconProps,
  3765. setup(__props) {
  3766. const props = __props;
  3767. const ns = useNamespace("icon");
  3768. const style = computed(() => {
  3769. if (!props.size && !props.color)
  3770. return {};
  3771. return {
  3772. fontSize: isUndefined(props.size) ? void 0 : addUnit(props.size),
  3773. "--color": props.color
  3774. };
  3775. });
  3776. return (_ctx, _cache) => {
  3777. return openBlock(), createElementBlock("i", mergeProps({
  3778. class: unref(ns).b(),
  3779. style: unref(style)
  3780. }, _ctx.$attrs), [
  3781. renderSlot(_ctx.$slots, "default")
  3782. ], 16);
  3783. };
  3784. }
  3785. }));
  3786. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  3787. const ElIcon = withInstall(Icon);
  3788. let hiddenTextarea = void 0;
  3789. const HIDDEN_STYLE = `
  3790. height:0 !important;
  3791. visibility:hidden !important;
  3792. overflow:hidden !important;
  3793. position:absolute !important;
  3794. z-index:-1000 !important;
  3795. top:0 !important;
  3796. right:0 !important;
  3797. `;
  3798. const CONTEXT_STYLE = [
  3799. "letter-spacing",
  3800. "line-height",
  3801. "padding-top",
  3802. "padding-bottom",
  3803. "font-family",
  3804. "font-weight",
  3805. "font-size",
  3806. "text-rendering",
  3807. "text-transform",
  3808. "width",
  3809. "text-indent",
  3810. "padding-left",
  3811. "padding-right",
  3812. "border-width",
  3813. "box-sizing"
  3814. ];
  3815. function calculateNodeStyling(targetElement) {
  3816. const style = window.getComputedStyle(targetElement);
  3817. const boxSizing = style.getPropertyValue("box-sizing");
  3818. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  3819. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  3820. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  3821. return { contextStyle, paddingSize, borderSize, boxSizing };
  3822. }
  3823. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  3824. var _a2;
  3825. if (!hiddenTextarea) {
  3826. hiddenTextarea = document.createElement("textarea");
  3827. document.body.appendChild(hiddenTextarea);
  3828. }
  3829. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  3830. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  3831. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  3832. let height = hiddenTextarea.scrollHeight;
  3833. const result = {};
  3834. if (boxSizing === "border-box") {
  3835. height = height + borderSize;
  3836. } else if (boxSizing === "content-box") {
  3837. height = height - paddingSize;
  3838. }
  3839. hiddenTextarea.value = "";
  3840. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  3841. if (isNumber(minRows)) {
  3842. let minHeight = singleRowHeight * minRows;
  3843. if (boxSizing === "border-box") {
  3844. minHeight = minHeight + paddingSize + borderSize;
  3845. }
  3846. height = Math.max(minHeight, height);
  3847. result.minHeight = `${minHeight}px`;
  3848. }
  3849. if (isNumber(maxRows)) {
  3850. let maxHeight = singleRowHeight * maxRows;
  3851. if (boxSizing === "border-box") {
  3852. maxHeight = maxHeight + paddingSize + borderSize;
  3853. }
  3854. height = Math.min(maxHeight, height);
  3855. }
  3856. result.height = `${height}px`;
  3857. (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
  3858. hiddenTextarea = void 0;
  3859. return result;
  3860. }
  3861. const inputProps = buildProps({
  3862. size: useSizeProp,
  3863. disabled: Boolean,
  3864. modelValue: {
  3865. type: definePropType([
  3866. String,
  3867. Number,
  3868. Object
  3869. ]),
  3870. default: ""
  3871. },
  3872. type: {
  3873. type: String,
  3874. default: "text"
  3875. },
  3876. resize: {
  3877. type: String,
  3878. values: ["none", "both", "horizontal", "vertical"]
  3879. },
  3880. autosize: {
  3881. type: definePropType([Boolean, Object]),
  3882. default: false
  3883. },
  3884. autocomplete: {
  3885. type: String,
  3886. default: "off"
  3887. },
  3888. placeholder: {
  3889. type: String
  3890. },
  3891. form: {
  3892. type: String,
  3893. default: ""
  3894. },
  3895. readonly: {
  3896. type: Boolean,
  3897. default: false
  3898. },
  3899. clearable: {
  3900. type: Boolean,
  3901. default: false
  3902. },
  3903. showPassword: {
  3904. type: Boolean,
  3905. default: false
  3906. },
  3907. showWordLimit: {
  3908. type: Boolean,
  3909. default: false
  3910. },
  3911. suffixIcon: {
  3912. type: iconPropType,
  3913. default: ""
  3914. },
  3915. prefixIcon: {
  3916. type: iconPropType,
  3917. default: ""
  3918. },
  3919. label: {
  3920. type: String
  3921. },
  3922. tabindex: {
  3923. type: [Number, String]
  3924. },
  3925. validateEvent: {
  3926. type: Boolean,
  3927. default: true
  3928. },
  3929. inputStyle: {
  3930. type: definePropType([Object, Array, String]),
  3931. default: () => mutable({})
  3932. }
  3933. });
  3934. const inputEmits = {
  3935. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  3936. input: (value) => isString(value),
  3937. change: (value) => isString(value),
  3938. focus: (evt) => evt instanceof FocusEvent,
  3939. blur: (evt) => evt instanceof FocusEvent,
  3940. clear: () => true,
  3941. mouseleave: (evt) => evt instanceof MouseEvent,
  3942. mouseenter: (evt) => evt instanceof MouseEvent,
  3943. keydown: (evt) => evt instanceof Event,
  3944. compositionstart: (evt) => evt instanceof CompositionEvent,
  3945. compositionupdate: (evt) => evt instanceof CompositionEvent,
  3946. compositionend: (evt) => evt instanceof CompositionEvent
  3947. };
  3948. const _hoisted_1$C = ["type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder"];
  3949. const _hoisted_2$t = ["tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder"];
  3950. const __default__$k = {
  3951. name: "ElInput",
  3952. inheritAttrs: false
  3953. };
  3954. const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$k), {
  3955. props: inputProps,
  3956. emits: inputEmits,
  3957. setup(__props, { expose, emit }) {
  3958. const props = __props;
  3959. const PENDANT_MAP = {
  3960. suffix: "append",
  3961. prefix: "prepend"
  3962. };
  3963. const instance = getCurrentInstance();
  3964. const rawAttrs = useAttrs$1();
  3965. const slots = useSlots();
  3966. const attrs = useAttrs();
  3967. const { form, formItem } = useFormItem();
  3968. const inputSize = useSize();
  3969. const inputDisabled = useDisabled$1();
  3970. const nsInput = useNamespace("input");
  3971. const nsTextarea = useNamespace("textarea");
  3972. const input = shallowRef();
  3973. const textarea = shallowRef();
  3974. const focused = ref(false);
  3975. const hovering = ref(false);
  3976. const isComposing = ref(false);
  3977. const passwordVisible = ref(false);
  3978. const textareaCalcStyle = shallowRef(props.inputStyle);
  3979. const _ref = computed(() => input.value || textarea.value);
  3980. const needStatusIcon = computed(() => {
  3981. var _a2;
  3982. return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
  3983. });
  3984. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  3985. const validateIcon = computed(() => ValidateComponentsMap[validateState.value]);
  3986. const passwordIcon = computed(() => passwordVisible.value ? view : hide$2);
  3987. const containerStyle = computed(() => [
  3988. rawAttrs.style,
  3989. props.inputStyle
  3990. ]);
  3991. const textareaStyle = computed(() => [
  3992. props.inputStyle,
  3993. textareaCalcStyle.value,
  3994. { resize: props.resize }
  3995. ]);
  3996. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  3997. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  3998. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !props.readonly && (!!nativeInputValue.value || focused.value));
  3999. const isWordLimitVisible = computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  4000. const textLength = computed(() => Array.from(nativeInputValue.value).length);
  4001. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  4002. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  4003. const resizeTextarea = () => {
  4004. const { type: type4, autosize } = props;
  4005. if (!isClient$1 || type4 !== "textarea")
  4006. return;
  4007. if (autosize) {
  4008. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  4009. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  4010. textareaCalcStyle.value = __spreadValues({}, calcTextareaHeight(textarea.value, minRows, maxRows));
  4011. } else {
  4012. textareaCalcStyle.value = {
  4013. minHeight: calcTextareaHeight(textarea.value).minHeight
  4014. };
  4015. }
  4016. };
  4017. const setNativeInputValue = () => {
  4018. const input2 = _ref.value;
  4019. if (!input2 || input2.value === nativeInputValue.value)
  4020. return;
  4021. input2.value = nativeInputValue.value;
  4022. };
  4023. const calcIconOffset = (place) => {
  4024. const { el } = instance.vnode;
  4025. if (!el)
  4026. return;
  4027. const elList = Array.from(el.querySelectorAll(`.${nsInput.e(place)}`));
  4028. const target = elList.find((item) => item.parentNode === el);
  4029. if (!target)
  4030. return;
  4031. const pendant = PENDANT_MAP[place];
  4032. if (slots[pendant]) {
  4033. target.style.transform = `translateX(${place === "suffix" ? "-" : ""}${el.querySelector(`.${nsInput.be("group", pendant)}`).offsetWidth}px)`;
  4034. } else {
  4035. target.removeAttribute("style");
  4036. }
  4037. };
  4038. const updateIconOffset = () => {
  4039. calcIconOffset("prefix");
  4040. calcIconOffset("suffix");
  4041. };
  4042. const handleInput = async (event) => {
  4043. const { value } = event.target;
  4044. if (isComposing.value)
  4045. return;
  4046. if (value === nativeInputValue.value)
  4047. return;
  4048. emit(UPDATE_MODEL_EVENT, value);
  4049. emit("input", value);
  4050. await nextTick();
  4051. setNativeInputValue();
  4052. };
  4053. const handleChange2 = (event) => {
  4054. emit("change", event.target.value);
  4055. };
  4056. const handleCompositionStart = (event) => {
  4057. emit("compositionstart", event);
  4058. isComposing.value = true;
  4059. };
  4060. const handleCompositionUpdate = (event) => {
  4061. var _a2;
  4062. emit("compositionupdate", event);
  4063. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  4064. const lastCharacter = text[text.length - 1] || "";
  4065. isComposing.value = !isKorean(lastCharacter);
  4066. };
  4067. const handleCompositionEnd = (event) => {
  4068. emit("compositionend", event);
  4069. if (isComposing.value) {
  4070. isComposing.value = false;
  4071. handleInput(event);
  4072. }
  4073. };
  4074. const handlePasswordVisible = () => {
  4075. passwordVisible.value = !passwordVisible.value;
  4076. focus();
  4077. };
  4078. const focus = async () => {
  4079. var _a2;
  4080. await nextTick();
  4081. (_a2 = _ref.value) == null ? void 0 : _a2.focus();
  4082. };
  4083. const blur = () => {
  4084. var _a2;
  4085. return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
  4086. };
  4087. const handleFocus = (event) => {
  4088. focused.value = true;
  4089. emit("focus", event);
  4090. };
  4091. const handleBlur = (event) => {
  4092. var _a2;
  4093. focused.value = false;
  4094. emit("blur", event);
  4095. if (props.validateEvent) {
  4096. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  4097. }
  4098. };
  4099. const handleMouseLeave = (evt) => {
  4100. hovering.value = false;
  4101. emit("mouseleave", evt);
  4102. };
  4103. const handleMouseEnter = (evt) => {
  4104. hovering.value = true;
  4105. emit("mouseenter", evt);
  4106. };
  4107. const handleKeydown = (evt) => {
  4108. emit("keydown", evt);
  4109. };
  4110. const select = () => {
  4111. var _a2;
  4112. (_a2 = _ref.value) == null ? void 0 : _a2.select();
  4113. };
  4114. const clear = () => {
  4115. emit(UPDATE_MODEL_EVENT, "");
  4116. emit("change", "");
  4117. emit("clear");
  4118. emit("input", "");
  4119. };
  4120. watch(() => props.modelValue, () => {
  4121. var _a2;
  4122. nextTick(() => resizeTextarea());
  4123. if (props.validateEvent) {
  4124. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  4125. }
  4126. });
  4127. watch(nativeInputValue, () => setNativeInputValue());
  4128. watch(() => props.type, async () => {
  4129. await nextTick();
  4130. setNativeInputValue();
  4131. resizeTextarea();
  4132. updateIconOffset();
  4133. });
  4134. onMounted(async () => {
  4135. setNativeInputValue();
  4136. updateIconOffset();
  4137. await nextTick();
  4138. resizeTextarea();
  4139. });
  4140. onUpdated(async () => {
  4141. await nextTick();
  4142. updateIconOffset();
  4143. });
  4144. expose({
  4145. input,
  4146. textarea,
  4147. ref: _ref,
  4148. textareaStyle,
  4149. autosize: toRef(props, "autosize"),
  4150. focus,
  4151. blur,
  4152. select,
  4153. clear,
  4154. resizeTextarea
  4155. });
  4156. return (_ctx, _cache) => {
  4157. return withDirectives((openBlock(), createElementBlock("div", {
  4158. class: normalizeClass([
  4159. _ctx.type === "textarea" ? unref(nsTextarea).b() : unref(nsInput).b(),
  4160. unref(nsInput).m(unref(inputSize)),
  4161. unref(nsInput).is("disabled", unref(inputDisabled)),
  4162. unref(nsInput).is("exceed", unref(inputExceed)),
  4163. {
  4164. [unref(nsInput).b("group")]: _ctx.$slots.prepend || _ctx.$slots.append,
  4165. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  4166. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend,
  4167. [unref(nsInput).m("prefix")]: _ctx.$slots.prefix || _ctx.prefixIcon,
  4168. [unref(nsInput).m("suffix")]: _ctx.$slots.suffix || _ctx.suffixIcon || _ctx.clearable || _ctx.showPassword,
  4169. [unref(nsInput).bm("suffix", "password-clear")]: unref(showClear) && unref(showPwdVisible)
  4170. },
  4171. _ctx.$attrs.class
  4172. ]),
  4173. style: normalizeStyle(unref(containerStyle)),
  4174. onMouseenter: handleMouseEnter,
  4175. onMouseleave: handleMouseLeave
  4176. }, [
  4177. createCommentVNode(" input "),
  4178. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4179. createCommentVNode(" prepend slot "),
  4180. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  4181. key: 0,
  4182. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  4183. }, [
  4184. renderSlot(_ctx.$slots, "prepend")
  4185. ], 2)) : createCommentVNode("v-if", true),
  4186. createElementVNode("div", {
  4187. class: normalizeClass([unref(nsInput).e("wrapper"), unref(nsInput).is("focus", focused.value)])
  4188. }, [
  4189. createCommentVNode(" prefix slot "),
  4190. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  4191. key: 0,
  4192. class: normalizeClass(unref(nsInput).e("prefix"))
  4193. }, [
  4194. createElementVNode("span", {
  4195. class: normalizeClass(unref(nsInput).e("prefix-inner"))
  4196. }, [
  4197. renderSlot(_ctx.$slots, "prefix"),
  4198. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4199. key: 0,
  4200. class: normalizeClass(unref(nsInput).e("icon"))
  4201. }, {
  4202. default: withCtx(() => [
  4203. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  4204. ]),
  4205. _: 1
  4206. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4207. ], 2)
  4208. ], 2)) : createCommentVNode("v-if", true),
  4209. createElementVNode("input", mergeProps({
  4210. ref_key: "input",
  4211. ref: input,
  4212. class: unref(nsInput).e("inner")
  4213. }, unref(attrs), {
  4214. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  4215. disabled: unref(inputDisabled),
  4216. readonly: _ctx.readonly,
  4217. autocomplete: _ctx.autocomplete,
  4218. tabindex: _ctx.tabindex,
  4219. "aria-label": _ctx.label,
  4220. placeholder: _ctx.placeholder,
  4221. style: _ctx.inputStyle,
  4222. onCompositionstart: handleCompositionStart,
  4223. onCompositionupdate: handleCompositionUpdate,
  4224. onCompositionend: handleCompositionEnd,
  4225. onInput: handleInput,
  4226. onFocus: handleFocus,
  4227. onBlur: handleBlur,
  4228. onChange: handleChange2,
  4229. onKeydown: handleKeydown
  4230. }), null, 16, _hoisted_1$C),
  4231. createCommentVNode(" suffix slot "),
  4232. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  4233. key: 1,
  4234. class: normalizeClass(unref(nsInput).e("suffix"))
  4235. }, [
  4236. createElementVNode("span", {
  4237. class: normalizeClass(unref(nsInput).e("suffix-inner"))
  4238. }, [
  4239. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4240. renderSlot(_ctx.$slots, "suffix"),
  4241. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4242. key: 0,
  4243. class: normalizeClass(unref(nsInput).e("icon"))
  4244. }, {
  4245. default: withCtx(() => [
  4246. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  4247. ]),
  4248. _: 1
  4249. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4250. ], 64)) : createCommentVNode("v-if", true),
  4251. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  4252. key: 1,
  4253. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  4254. onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
  4255. }, ["prevent"])),
  4256. onClick: clear
  4257. }, {
  4258. default: withCtx(() => [
  4259. createVNode(unref(circleClose))
  4260. ]),
  4261. _: 1
  4262. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4263. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  4264. key: 2,
  4265. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  4266. onClick: handlePasswordVisible
  4267. }, {
  4268. default: withCtx(() => [
  4269. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  4270. ]),
  4271. _: 1
  4272. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4273. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4274. key: 3,
  4275. class: normalizeClass(unref(nsInput).e("count"))
  4276. }, [
  4277. createElementVNode("span", {
  4278. class: normalizeClass(unref(nsInput).e("count-inner"))
  4279. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
  4280. ], 2)) : createCommentVNode("v-if", true)
  4281. ], 2),
  4282. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  4283. key: 0,
  4284. class: normalizeClass([
  4285. unref(nsInput).e("icon"),
  4286. unref(nsInput).e("validateIcon"),
  4287. unref(nsInput).is("loading", unref(validateState) === "validating")
  4288. ])
  4289. }, {
  4290. default: withCtx(() => [
  4291. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  4292. ]),
  4293. _: 1
  4294. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4295. ], 2)) : createCommentVNode("v-if", true)
  4296. ], 2),
  4297. createCommentVNode(" append slot "),
  4298. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  4299. key: 1,
  4300. class: normalizeClass(unref(nsInput).be("group", "append"))
  4301. }, [
  4302. renderSlot(_ctx.$slots, "append")
  4303. ], 2)) : createCommentVNode("v-if", true)
  4304. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  4305. createCommentVNode(" textarea "),
  4306. createElementVNode("textarea", mergeProps({
  4307. ref_key: "textarea",
  4308. ref: textarea,
  4309. class: unref(nsTextarea).e("inner")
  4310. }, unref(attrs), {
  4311. tabindex: _ctx.tabindex,
  4312. disabled: unref(inputDisabled),
  4313. readonly: _ctx.readonly,
  4314. autocomplete: _ctx.autocomplete,
  4315. style: unref(textareaStyle),
  4316. "aria-label": _ctx.label,
  4317. placeholder: _ctx.placeholder,
  4318. onCompositionstart: handleCompositionStart,
  4319. onCompositionupdate: handleCompositionUpdate,
  4320. onCompositionend: handleCompositionEnd,
  4321. onInput: handleInput,
  4322. onFocus: handleFocus,
  4323. onBlur: handleBlur,
  4324. onChange: handleChange2,
  4325. onKeydown: handleKeydown
  4326. }), null, 16, _hoisted_2$t),
  4327. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4328. key: 0,
  4329. class: normalizeClass(unref(nsInput).e("count"))
  4330. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)) : createCommentVNode("v-if", true)
  4331. ], 64))
  4332. ], 38)), [
  4333. [vShow, _ctx.type !== "hidden"]
  4334. ]);
  4335. };
  4336. }
  4337. }));
  4338. var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$14, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
  4339. const ElInput = withInstall(Input);
  4340. const BAR_MAP = {
  4341. vertical: {
  4342. offset: "offsetHeight",
  4343. scroll: "scrollTop",
  4344. scrollSize: "scrollHeight",
  4345. size: "height",
  4346. key: "vertical",
  4347. axis: "Y",
  4348. client: "clientY",
  4349. direction: "top"
  4350. },
  4351. horizontal: {
  4352. offset: "offsetWidth",
  4353. scroll: "scrollLeft",
  4354. scrollSize: "scrollWidth",
  4355. size: "width",
  4356. key: "horizontal",
  4357. axis: "X",
  4358. client: "clientX",
  4359. direction: "left"
  4360. }
  4361. };
  4362. const renderThumbStyle = ({ move, size, bar }) => ({
  4363. [bar.size]: size,
  4364. transform: `translate${bar.axis}(${move}%)`
  4365. });
  4366. const thumbProps = buildProps({
  4367. vertical: Boolean,
  4368. size: String,
  4369. move: Number,
  4370. ratio: {
  4371. type: Number,
  4372. required: true
  4373. },
  4374. always: Boolean
  4375. });
  4376. const COMPONENT_NAME$4 = "Thumb";
  4377. const _sfc_main$13 = defineComponent({
  4378. name: COMPONENT_NAME$4,
  4379. props: thumbProps,
  4380. setup(props) {
  4381. const scrollbar = inject(scrollbarContextKey);
  4382. const ns = useNamespace("scrollbar");
  4383. if (!scrollbar)
  4384. throwError(COMPONENT_NAME$4, "can not inject scrollbar context");
  4385. const instance = ref();
  4386. const thumb = ref();
  4387. const thumbState = ref({});
  4388. const visible = ref(false);
  4389. let cursorDown = false;
  4390. let cursorLeave = false;
  4391. let originalOnSelectStart = isClient$1 ? document.onselectstart : null;
  4392. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  4393. const thumbStyle = computed(() => renderThumbStyle({
  4394. size: props.size,
  4395. move: props.move,
  4396. bar: bar.value
  4397. }));
  4398. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  4399. const clickThumbHandler = (e) => {
  4400. var _a2;
  4401. e.stopPropagation();
  4402. if (e.ctrlKey || [1, 2].includes(e.button))
  4403. return;
  4404. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  4405. startDrag(e);
  4406. const el = e.currentTarget;
  4407. if (!el)
  4408. return;
  4409. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  4410. };
  4411. const clickTrackHandler = (e) => {
  4412. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  4413. return;
  4414. const offset2 = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  4415. const thumbHalf = thumb.value[bar.value.offset] / 2;
  4416. const thumbPositionPercentage = (offset2 - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4417. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4418. };
  4419. const startDrag = (e) => {
  4420. e.stopImmediatePropagation();
  4421. cursorDown = true;
  4422. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  4423. document.addEventListener("mouseup", mouseUpDocumentHandler);
  4424. originalOnSelectStart = document.onselectstart;
  4425. document.onselectstart = () => false;
  4426. };
  4427. const mouseMoveDocumentHandler = (e) => {
  4428. if (!instance.value || !thumb.value)
  4429. return;
  4430. if (cursorDown === false)
  4431. return;
  4432. const prevPage = thumbState.value[bar.value.axis];
  4433. if (!prevPage)
  4434. return;
  4435. const offset2 = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  4436. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  4437. const thumbPositionPercentage = (offset2 - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4438. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4439. };
  4440. const mouseUpDocumentHandler = () => {
  4441. cursorDown = false;
  4442. thumbState.value[bar.value.axis] = 0;
  4443. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  4444. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4445. restoreOnselectstart();
  4446. if (cursorLeave)
  4447. visible.value = false;
  4448. };
  4449. const mouseMoveScrollbarHandler = () => {
  4450. cursorLeave = false;
  4451. visible.value = !!props.size;
  4452. };
  4453. const mouseLeaveScrollbarHandler = () => {
  4454. cursorLeave = true;
  4455. visible.value = cursorDown;
  4456. };
  4457. onBeforeUnmount(() => {
  4458. restoreOnselectstart();
  4459. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4460. });
  4461. const restoreOnselectstart = () => {
  4462. if (document.onselectstart !== originalOnSelectStart)
  4463. document.onselectstart = originalOnSelectStart;
  4464. };
  4465. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  4466. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  4467. return {
  4468. ns,
  4469. instance,
  4470. thumb,
  4471. bar,
  4472. thumbStyle,
  4473. visible,
  4474. clickTrackHandler,
  4475. clickThumbHandler
  4476. };
  4477. }
  4478. });
  4479. function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
  4480. return openBlock(), createBlock(Transition, {
  4481. name: _ctx.ns.b("fade")
  4482. }, {
  4483. default: withCtx(() => [
  4484. withDirectives(createElementVNode("div", {
  4485. ref: "instance",
  4486. class: normalizeClass([_ctx.ns.e("bar"), _ctx.ns.is(_ctx.bar.key)]),
  4487. onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
  4488. }, [
  4489. createElementVNode("div", {
  4490. ref: "thumb",
  4491. class: normalizeClass(_ctx.ns.e("thumb")),
  4492. style: normalizeStyle(_ctx.thumbStyle),
  4493. onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
  4494. }, null, 38)
  4495. ], 34), [
  4496. [vShow, _ctx.always || _ctx.visible]
  4497. ])
  4498. ]),
  4499. _: 1
  4500. }, 8, ["name"]);
  4501. }
  4502. var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$13, [["render", _sfc_render$D], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
  4503. const barProps = buildProps({
  4504. always: {
  4505. type: Boolean,
  4506. default: true
  4507. },
  4508. width: {
  4509. type: String,
  4510. default: ""
  4511. },
  4512. height: {
  4513. type: String,
  4514. default: ""
  4515. },
  4516. ratioX: {
  4517. type: Number,
  4518. default: 1
  4519. },
  4520. ratioY: {
  4521. type: Number,
  4522. default: 1
  4523. }
  4524. });
  4525. const _sfc_main$12 = defineComponent({
  4526. components: {
  4527. Thumb
  4528. },
  4529. props: barProps,
  4530. setup(props) {
  4531. const moveX = ref(0);
  4532. const moveY = ref(0);
  4533. const GAP = 4;
  4534. const handleScroll = (wrap) => {
  4535. if (wrap) {
  4536. const offsetHeight = wrap.offsetHeight - GAP;
  4537. const offsetWidth = wrap.offsetWidth - GAP;
  4538. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  4539. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  4540. }
  4541. };
  4542. return {
  4543. handleScroll,
  4544. moveX,
  4545. moveY
  4546. };
  4547. }
  4548. });
  4549. function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
  4550. const _component_thumb = resolveComponent("thumb");
  4551. return openBlock(), createElementBlock(Fragment, null, [
  4552. createVNode(_component_thumb, {
  4553. move: _ctx.moveX,
  4554. ratio: _ctx.ratioX,
  4555. size: _ctx.width,
  4556. always: _ctx.always
  4557. }, null, 8, ["move", "ratio", "size", "always"]),
  4558. createVNode(_component_thumb, {
  4559. move: _ctx.moveY,
  4560. ratio: _ctx.ratioY,
  4561. size: _ctx.height,
  4562. vertical: "",
  4563. always: _ctx.always
  4564. }, null, 8, ["move", "ratio", "size", "always"])
  4565. ], 64);
  4566. }
  4567. var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$12, [["render", _sfc_render$C], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
  4568. const scrollbarProps = buildProps({
  4569. height: {
  4570. type: [String, Number],
  4571. default: ""
  4572. },
  4573. maxHeight: {
  4574. type: [String, Number],
  4575. default: ""
  4576. },
  4577. native: {
  4578. type: Boolean,
  4579. default: false
  4580. },
  4581. wrapStyle: {
  4582. type: definePropType([String, Object, Array]),
  4583. default: ""
  4584. },
  4585. wrapClass: {
  4586. type: [String, Array],
  4587. default: ""
  4588. },
  4589. viewClass: {
  4590. type: [String, Array],
  4591. default: ""
  4592. },
  4593. viewStyle: {
  4594. type: [String, Array, Object],
  4595. default: ""
  4596. },
  4597. noresize: Boolean,
  4598. tag: {
  4599. type: String,
  4600. default: "div"
  4601. },
  4602. always: {
  4603. type: Boolean,
  4604. default: false
  4605. },
  4606. minSize: {
  4607. type: Number,
  4608. default: 20
  4609. }
  4610. });
  4611. const scrollbarEmits = {
  4612. scroll: ({
  4613. scrollTop,
  4614. scrollLeft
  4615. }) => isNumber(scrollTop) && isNumber(scrollLeft)
  4616. };
  4617. const _sfc_main$11 = defineComponent({
  4618. name: "ElScrollbar",
  4619. components: {
  4620. Bar
  4621. },
  4622. props: scrollbarProps,
  4623. emits: scrollbarEmits,
  4624. setup(props, { emit }) {
  4625. const ns = useNamespace("scrollbar");
  4626. let stopResizeObserver = void 0;
  4627. let stopResizeListener = void 0;
  4628. const scrollbar$ = ref();
  4629. const wrap$ = ref();
  4630. const resize$ = ref();
  4631. const sizeWidth = ref("0");
  4632. const sizeHeight = ref("0");
  4633. const barRef = ref();
  4634. const moveX = ref(0);
  4635. const moveY = ref(0);
  4636. const ratioY = ref(1);
  4637. const ratioX = ref(1);
  4638. const GAP = 4;
  4639. const style = computed(() => {
  4640. const style2 = {};
  4641. if (props.height)
  4642. style2.height = addUnit(props.height);
  4643. if (props.maxHeight)
  4644. style2.maxHeight = addUnit(props.maxHeight);
  4645. return [props.wrapStyle, style2];
  4646. });
  4647. const handleScroll = () => {
  4648. var _a2;
  4649. if (wrap$.value) {
  4650. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4651. emit("scroll", {
  4652. scrollTop: wrap$.value.scrollTop,
  4653. scrollLeft: wrap$.value.scrollLeft
  4654. });
  4655. }
  4656. };
  4657. function scrollTo(arg1, arg2) {
  4658. if (isObject$1(arg1)) {
  4659. wrap$.value.scrollTo(arg1);
  4660. } else if (isNumber(arg1) && isNumber(arg2)) {
  4661. wrap$.value.scrollTo(arg1, arg2);
  4662. }
  4663. }
  4664. const setScrollTop = (value) => {
  4665. if (!isNumber(value)) {
  4666. return;
  4667. }
  4668. wrap$.value.scrollTop = value;
  4669. };
  4670. const setScrollLeft = (value) => {
  4671. if (!isNumber(value)) {
  4672. return;
  4673. }
  4674. wrap$.value.scrollLeft = value;
  4675. };
  4676. const update = () => {
  4677. if (!wrap$.value)
  4678. return;
  4679. const offsetHeight = wrap$.value.offsetHeight - GAP;
  4680. const offsetWidth = wrap$.value.offsetWidth - GAP;
  4681. const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight;
  4682. const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth;
  4683. const height = Math.max(originalHeight, props.minSize);
  4684. const width = Math.max(originalWidth, props.minSize);
  4685. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  4686. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  4687. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  4688. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  4689. };
  4690. watch(() => props.noresize, (noresize) => {
  4691. if (noresize) {
  4692. stopResizeObserver == null ? void 0 : stopResizeObserver();
  4693. stopResizeListener == null ? void 0 : stopResizeListener();
  4694. } else {
  4695. ({ stop: stopResizeObserver } = useResizeObserver(resize$, update));
  4696. stopResizeListener = useEventListener("resize", update);
  4697. }
  4698. }, { immediate: true });
  4699. watch(() => [props.maxHeight, props.height], () => {
  4700. if (!props.native)
  4701. nextTick(() => {
  4702. var _a2;
  4703. update();
  4704. if (wrap$.value) {
  4705. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4706. }
  4707. });
  4708. });
  4709. provide(scrollbarContextKey, reactive({
  4710. scrollbarElement: scrollbar$,
  4711. wrapElement: wrap$
  4712. }));
  4713. onMounted(() => {
  4714. if (!props.native)
  4715. nextTick(() => update());
  4716. });
  4717. onUpdated(() => update());
  4718. return {
  4719. ns,
  4720. scrollbar$,
  4721. wrap$,
  4722. resize$,
  4723. barRef,
  4724. moveX,
  4725. moveY,
  4726. ratioX,
  4727. ratioY,
  4728. sizeWidth,
  4729. sizeHeight,
  4730. style,
  4731. update,
  4732. handleScroll,
  4733. scrollTo,
  4734. setScrollTop,
  4735. setScrollLeft
  4736. };
  4737. }
  4738. });
  4739. function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
  4740. const _component_bar = resolveComponent("bar");
  4741. return openBlock(), createElementBlock("div", {
  4742. ref: "scrollbar$",
  4743. class: normalizeClass(_ctx.ns.b())
  4744. }, [
  4745. createElementVNode("div", {
  4746. ref: "wrap$",
  4747. class: normalizeClass([
  4748. _ctx.wrapClass,
  4749. _ctx.ns.e("wrap"),
  4750. { [_ctx.ns.em("wrap", "hidden-default")]: !_ctx.native }
  4751. ]),
  4752. style: normalizeStyle(_ctx.style),
  4753. onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
  4754. }, [
  4755. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  4756. ref: "resize$",
  4757. class: normalizeClass([_ctx.ns.e("view"), _ctx.viewClass]),
  4758. style: normalizeStyle(_ctx.viewStyle)
  4759. }, {
  4760. default: withCtx(() => [
  4761. renderSlot(_ctx.$slots, "default")
  4762. ]),
  4763. _: 3
  4764. }, 8, ["class", "style"]))
  4765. ], 38),
  4766. !_ctx.native ? (openBlock(), createBlock(_component_bar, {
  4767. key: 0,
  4768. ref: "barRef",
  4769. height: _ctx.sizeHeight,
  4770. width: _ctx.sizeWidth,
  4771. always: _ctx.always,
  4772. "ratio-x": _ctx.ratioX,
  4773. "ratio-y": _ctx.ratioY
  4774. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
  4775. ], 2);
  4776. }
  4777. var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$11, [["render", _sfc_render$B], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
  4778. const ElScrollbar = withInstall(Scrollbar);
  4779. const __default__$j = {
  4780. name: "ElPopperRoot",
  4781. inheritAttrs: false
  4782. };
  4783. const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$j), {
  4784. setup(__props, { expose }) {
  4785. const triggerRef2 = ref();
  4786. const popperInstanceRef = ref();
  4787. const contentRef = ref();
  4788. const referenceRef = ref();
  4789. const popperProvides = {
  4790. triggerRef: triggerRef2,
  4791. popperInstanceRef,
  4792. contentRef,
  4793. referenceRef
  4794. };
  4795. expose(popperProvides);
  4796. provide(POPPER_INJECTION_KEY, popperProvides);
  4797. return (_ctx, _cache) => {
  4798. return renderSlot(_ctx.$slots, "default");
  4799. };
  4800. }
  4801. }));
  4802. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$10, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
  4803. const usePopperArrowProps = buildProps({
  4804. arrowOffset: {
  4805. type: Number,
  4806. default: 5
  4807. }
  4808. });
  4809. const __default__$i = {
  4810. name: "ElPopperArrow",
  4811. inheritAttrs: false
  4812. };
  4813. const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$i), {
  4814. props: usePopperArrowProps,
  4815. setup(__props, { expose }) {
  4816. const props = __props;
  4817. const ns = useNamespace("popper");
  4818. const { arrowOffset, arrowRef } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  4819. watch(() => props.arrowOffset, (val) => {
  4820. arrowOffset.value = val;
  4821. });
  4822. onBeforeUnmount(() => {
  4823. arrowRef.value = void 0;
  4824. });
  4825. expose({
  4826. arrowRef
  4827. });
  4828. return (_ctx, _cache) => {
  4829. return openBlock(), createElementBlock("span", {
  4830. ref_key: "arrowRef",
  4831. ref: arrowRef,
  4832. class: normalizeClass(unref(ns).e("arrow")),
  4833. "data-popper-arrow": ""
  4834. }, null, 2);
  4835. };
  4836. }
  4837. }));
  4838. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
  4839. const NAME = "ElOnlyChild";
  4840. const OnlyChild = defineComponent({
  4841. name: NAME,
  4842. setup(_2, {
  4843. slots,
  4844. attrs
  4845. }) {
  4846. var _a2;
  4847. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  4848. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  4849. return () => {
  4850. var _a22;
  4851. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  4852. if (!defaultSlot)
  4853. return null;
  4854. if (defaultSlot.length > 1) {
  4855. return null;
  4856. }
  4857. const firstLegitNode = findFirstLegitChild(defaultSlot);
  4858. if (!firstLegitNode) {
  4859. return null;
  4860. }
  4861. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  4862. };
  4863. }
  4864. });
  4865. function findFirstLegitChild(node) {
  4866. if (!node)
  4867. return null;
  4868. const children = node;
  4869. for (const child of children) {
  4870. if (isObject$1(child)) {
  4871. switch (child.type) {
  4872. case Comment:
  4873. continue;
  4874. case Text:
  4875. return wrapTextContent(child);
  4876. case "svg":
  4877. return wrapTextContent(child);
  4878. case Fragment:
  4879. return findFirstLegitChild(child.children);
  4880. default:
  4881. return child;
  4882. }
  4883. }
  4884. return wrapTextContent(child);
  4885. }
  4886. return null;
  4887. }
  4888. function wrapTextContent(s2) {
  4889. return createVNode("span", {
  4890. "class": "el-only-child__content"
  4891. }, [s2]);
  4892. }
  4893. const usePopperTriggerProps = buildProps({
  4894. virtualRef: {
  4895. type: definePropType(Object)
  4896. },
  4897. virtualTriggering: Boolean,
  4898. onMouseenter: Function,
  4899. onMouseleave: Function,
  4900. onClick: Function,
  4901. onKeydown: Function,
  4902. onFocus: Function,
  4903. onBlur: Function,
  4904. onContextmenu: Function,
  4905. id: String,
  4906. open: Boolean
  4907. });
  4908. const __default__$h = {
  4909. name: "ElPopperTrigger",
  4910. inheritAttrs: false
  4911. };
  4912. const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$h), {
  4913. props: usePopperTriggerProps,
  4914. setup(__props, { expose }) {
  4915. const props = __props;
  4916. const { triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  4917. useForwardRef(triggerRef2);
  4918. onMounted(() => {
  4919. watch(() => props.virtualRef, (virtualEl) => {
  4920. if (virtualEl) {
  4921. triggerRef2.value = unrefElement(virtualEl);
  4922. }
  4923. }, {
  4924. immediate: true
  4925. });
  4926. watch(() => triggerRef2.value, (el, prevEl) => {
  4927. if (isElement$1(el)) {
  4928. [
  4929. "onMouseenter",
  4930. "onMouseleave",
  4931. "onClick",
  4932. "onKeydown",
  4933. "onFocus",
  4934. "onBlur",
  4935. "onContextmenu"
  4936. ].forEach((eventName) => {
  4937. var _a2;
  4938. const handler3 = props[eventName];
  4939. if (handler3) {
  4940. el.addEventListener(eventName.slice(2).toLowerCase(), handler3);
  4941. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler3);
  4942. }
  4943. });
  4944. }
  4945. }, {
  4946. immediate: true
  4947. });
  4948. });
  4949. expose({
  4950. triggerRef: triggerRef2
  4951. });
  4952. return (_ctx, _cache) => {
  4953. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  4954. "aria-describedby": _ctx.open ? _ctx.id : void 0
  4955. }), {
  4956. default: withCtx(() => [
  4957. renderSlot(_ctx.$slots, "default")
  4958. ]),
  4959. _: 3
  4960. }, 16, ["aria-describedby"])) : createCommentVNode("v-if", true);
  4961. };
  4962. }
  4963. }));
  4964. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$_, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
  4965. var top = "top";
  4966. var bottom = "bottom";
  4967. var right = "right";
  4968. var left = "left";
  4969. var auto = "auto";
  4970. var basePlacements = [top, bottom, right, left];
  4971. var start = "start";
  4972. var end = "end";
  4973. var clippingParents = "clippingParents";
  4974. var viewport = "viewport";
  4975. var popper = "popper";
  4976. var reference = "reference";
  4977. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  4978. return acc.concat([placement + "-" + start, placement + "-" + end]);
  4979. }, []);
  4980. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  4981. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  4982. }, []);
  4983. var beforeRead = "beforeRead";
  4984. var read = "read";
  4985. var afterRead = "afterRead";
  4986. var beforeMain = "beforeMain";
  4987. var main = "main";
  4988. var afterMain = "afterMain";
  4989. var beforeWrite = "beforeWrite";
  4990. var write = "write";
  4991. var afterWrite = "afterWrite";
  4992. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  4993. function getNodeName(element) {
  4994. return element ? (element.nodeName || "").toLowerCase() : null;
  4995. }
  4996. function getWindow(node) {
  4997. if (node == null) {
  4998. return window;
  4999. }
  5000. if (node.toString() !== "[object Window]") {
  5001. var ownerDocument = node.ownerDocument;
  5002. return ownerDocument ? ownerDocument.defaultView || window : window;
  5003. }
  5004. return node;
  5005. }
  5006. function isElement(node) {
  5007. var OwnElement = getWindow(node).Element;
  5008. return node instanceof OwnElement || node instanceof Element;
  5009. }
  5010. function isHTMLElement(node) {
  5011. var OwnElement = getWindow(node).HTMLElement;
  5012. return node instanceof OwnElement || node instanceof HTMLElement;
  5013. }
  5014. function isShadowRoot(node) {
  5015. if (typeof ShadowRoot === "undefined") {
  5016. return false;
  5017. }
  5018. var OwnElement = getWindow(node).ShadowRoot;
  5019. return node instanceof OwnElement || node instanceof ShadowRoot;
  5020. }
  5021. function applyStyles(_ref) {
  5022. var state = _ref.state;
  5023. Object.keys(state.elements).forEach(function(name) {
  5024. var style = state.styles[name] || {};
  5025. var attributes = state.attributes[name] || {};
  5026. var element = state.elements[name];
  5027. if (!isHTMLElement(element) || !getNodeName(element)) {
  5028. return;
  5029. }
  5030. Object.assign(element.style, style);
  5031. Object.keys(attributes).forEach(function(name2) {
  5032. var value = attributes[name2];
  5033. if (value === false) {
  5034. element.removeAttribute(name2);
  5035. } else {
  5036. element.setAttribute(name2, value === true ? "" : value);
  5037. }
  5038. });
  5039. });
  5040. }
  5041. function effect$2(_ref2) {
  5042. var state = _ref2.state;
  5043. var initialStyles = {
  5044. popper: {
  5045. position: state.options.strategy,
  5046. left: "0",
  5047. top: "0",
  5048. margin: "0"
  5049. },
  5050. arrow: {
  5051. position: "absolute"
  5052. },
  5053. reference: {}
  5054. };
  5055. Object.assign(state.elements.popper.style, initialStyles.popper);
  5056. state.styles = initialStyles;
  5057. if (state.elements.arrow) {
  5058. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  5059. }
  5060. return function() {
  5061. Object.keys(state.elements).forEach(function(name) {
  5062. var element = state.elements[name];
  5063. var attributes = state.attributes[name] || {};
  5064. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  5065. var style = styleProperties.reduce(function(style2, property) {
  5066. style2[property] = "";
  5067. return style2;
  5068. }, {});
  5069. if (!isHTMLElement(element) || !getNodeName(element)) {
  5070. return;
  5071. }
  5072. Object.assign(element.style, style);
  5073. Object.keys(attributes).forEach(function(attribute) {
  5074. element.removeAttribute(attribute);
  5075. });
  5076. });
  5077. };
  5078. }
  5079. var applyStyles$1 = {
  5080. name: "applyStyles",
  5081. enabled: true,
  5082. phase: "write",
  5083. fn: applyStyles,
  5084. effect: effect$2,
  5085. requires: ["computeStyles"]
  5086. };
  5087. function getBasePlacement(placement) {
  5088. return placement.split("-")[0];
  5089. }
  5090. var max = Math.max;
  5091. var min = Math.min;
  5092. var round = Math.round;
  5093. function getBoundingClientRect(element, includeScale) {
  5094. if (includeScale === void 0) {
  5095. includeScale = false;
  5096. }
  5097. var rect = element.getBoundingClientRect();
  5098. var scaleX = 1;
  5099. var scaleY = 1;
  5100. if (isHTMLElement(element) && includeScale) {
  5101. var offsetHeight = element.offsetHeight;
  5102. var offsetWidth = element.offsetWidth;
  5103. if (offsetWidth > 0) {
  5104. scaleX = round(rect.width) / offsetWidth || 1;
  5105. }
  5106. if (offsetHeight > 0) {
  5107. scaleY = round(rect.height) / offsetHeight || 1;
  5108. }
  5109. }
  5110. return {
  5111. width: rect.width / scaleX,
  5112. height: rect.height / scaleY,
  5113. top: rect.top / scaleY,
  5114. right: rect.right / scaleX,
  5115. bottom: rect.bottom / scaleY,
  5116. left: rect.left / scaleX,
  5117. x: rect.left / scaleX,
  5118. y: rect.top / scaleY
  5119. };
  5120. }
  5121. function getLayoutRect(element) {
  5122. var clientRect = getBoundingClientRect(element);
  5123. var width = element.offsetWidth;
  5124. var height = element.offsetHeight;
  5125. if (Math.abs(clientRect.width - width) <= 1) {
  5126. width = clientRect.width;
  5127. }
  5128. if (Math.abs(clientRect.height - height) <= 1) {
  5129. height = clientRect.height;
  5130. }
  5131. return {
  5132. x: element.offsetLeft,
  5133. y: element.offsetTop,
  5134. width,
  5135. height
  5136. };
  5137. }
  5138. function contains(parent, child) {
  5139. var rootNode = child.getRootNode && child.getRootNode();
  5140. if (parent.contains(child)) {
  5141. return true;
  5142. } else if (rootNode && isShadowRoot(rootNode)) {
  5143. var next = child;
  5144. do {
  5145. if (next && parent.isSameNode(next)) {
  5146. return true;
  5147. }
  5148. next = next.parentNode || next.host;
  5149. } while (next);
  5150. }
  5151. return false;
  5152. }
  5153. function getComputedStyle$1(element) {
  5154. return getWindow(element).getComputedStyle(element);
  5155. }
  5156. function isTableElement(element) {
  5157. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  5158. }
  5159. function getDocumentElement(element) {
  5160. return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
  5161. }
  5162. function getParentNode(element) {
  5163. if (getNodeName(element) === "html") {
  5164. return element;
  5165. }
  5166. return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
  5167. }
  5168. function getTrueOffsetParent(element) {
  5169. if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
  5170. return null;
  5171. }
  5172. return element.offsetParent;
  5173. }
  5174. function getContainingBlock(element) {
  5175. var isFirefox2 = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
  5176. var isIE = navigator.userAgent.indexOf("Trident") !== -1;
  5177. if (isIE && isHTMLElement(element)) {
  5178. var elementCss = getComputedStyle$1(element);
  5179. if (elementCss.position === "fixed") {
  5180. return null;
  5181. }
  5182. }
  5183. var currentNode = getParentNode(element);
  5184. if (isShadowRoot(currentNode)) {
  5185. currentNode = currentNode.host;
  5186. }
  5187. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  5188. var css = getComputedStyle$1(currentNode);
  5189. 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") {
  5190. return currentNode;
  5191. } else {
  5192. currentNode = currentNode.parentNode;
  5193. }
  5194. }
  5195. return null;
  5196. }
  5197. function getOffsetParent(element) {
  5198. var window2 = getWindow(element);
  5199. var offsetParent = getTrueOffsetParent(element);
  5200. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
  5201. offsetParent = getTrueOffsetParent(offsetParent);
  5202. }
  5203. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
  5204. return window2;
  5205. }
  5206. return offsetParent || getContainingBlock(element) || window2;
  5207. }
  5208. function getMainAxisFromPlacement(placement) {
  5209. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  5210. }
  5211. function within(min$1, value, max$1) {
  5212. return max(min$1, min(value, max$1));
  5213. }
  5214. function withinMaxClamp(min2, value, max2) {
  5215. var v2 = within(min2, value, max2);
  5216. return v2 > max2 ? max2 : v2;
  5217. }
  5218. function getFreshSideObject() {
  5219. return {
  5220. top: 0,
  5221. right: 0,
  5222. bottom: 0,
  5223. left: 0
  5224. };
  5225. }
  5226. function mergePaddingObject(paddingObject) {
  5227. return Object.assign({}, getFreshSideObject(), paddingObject);
  5228. }
  5229. function expandToHashMap(value, keys2) {
  5230. return keys2.reduce(function(hashMap, key) {
  5231. hashMap[key] = value;
  5232. return hashMap;
  5233. }, {});
  5234. }
  5235. var toPaddingObject = function toPaddingObject2(padding, state) {
  5236. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  5237. placement: state.placement
  5238. })) : padding;
  5239. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5240. };
  5241. function arrow(_ref) {
  5242. var _state$modifiersData$;
  5243. var state = _ref.state, name = _ref.name, options = _ref.options;
  5244. var arrowElement = state.elements.arrow;
  5245. var popperOffsets2 = state.modifiersData.popperOffsets;
  5246. var basePlacement = getBasePlacement(state.placement);
  5247. var axis = getMainAxisFromPlacement(basePlacement);
  5248. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  5249. var len = isVertical ? "height" : "width";
  5250. if (!arrowElement || !popperOffsets2) {
  5251. return;
  5252. }
  5253. var paddingObject = toPaddingObject(options.padding, state);
  5254. var arrowRect = getLayoutRect(arrowElement);
  5255. var minProp = axis === "y" ? top : left;
  5256. var maxProp = axis === "y" ? bottom : right;
  5257. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  5258. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  5259. var arrowOffsetParent = getOffsetParent(arrowElement);
  5260. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  5261. var centerToReference = endDiff / 2 - startDiff / 2;
  5262. var min2 = paddingObject[minProp];
  5263. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  5264. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  5265. var offset2 = within(min2, center, max2);
  5266. var axisProp = axis;
  5267. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  5268. }
  5269. function effect$1(_ref2) {
  5270. var state = _ref2.state, options = _ref2.options;
  5271. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  5272. if (arrowElement == null) {
  5273. return;
  5274. }
  5275. if (typeof arrowElement === "string") {
  5276. arrowElement = state.elements.popper.querySelector(arrowElement);
  5277. if (!arrowElement) {
  5278. return;
  5279. }
  5280. }
  5281. if (!contains(state.elements.popper, arrowElement)) {
  5282. return;
  5283. }
  5284. state.elements.arrow = arrowElement;
  5285. }
  5286. var arrow$1 = {
  5287. name: "arrow",
  5288. enabled: true,
  5289. phase: "main",
  5290. fn: arrow,
  5291. effect: effect$1,
  5292. requires: ["popperOffsets"],
  5293. requiresIfExists: ["preventOverflow"]
  5294. };
  5295. function getVariation(placement) {
  5296. return placement.split("-")[1];
  5297. }
  5298. var unsetSides = {
  5299. top: "auto",
  5300. right: "auto",
  5301. bottom: "auto",
  5302. left: "auto"
  5303. };
  5304. function roundOffsetsByDPR(_ref) {
  5305. var x2 = _ref.x, y = _ref.y;
  5306. var win = window;
  5307. var dpr = win.devicePixelRatio || 1;
  5308. return {
  5309. x: round(x2 * dpr) / dpr || 0,
  5310. y: round(y * dpr) / dpr || 0
  5311. };
  5312. }
  5313. function mapToStyles(_ref2) {
  5314. var _Object$assign2;
  5315. 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;
  5316. 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;
  5317. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  5318. x: x2,
  5319. y
  5320. }) : {
  5321. x: x2,
  5322. y
  5323. };
  5324. x2 = _ref3.x;
  5325. y = _ref3.y;
  5326. var hasX = offsets.hasOwnProperty("x");
  5327. var hasY = offsets.hasOwnProperty("y");
  5328. var sideX = left;
  5329. var sideY = top;
  5330. var win = window;
  5331. if (adaptive) {
  5332. var offsetParent = getOffsetParent(popper2);
  5333. var heightProp = "clientHeight";
  5334. var widthProp = "clientWidth";
  5335. if (offsetParent === getWindow(popper2)) {
  5336. offsetParent = getDocumentElement(popper2);
  5337. if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
  5338. heightProp = "scrollHeight";
  5339. widthProp = "scrollWidth";
  5340. }
  5341. }
  5342. offsetParent = offsetParent;
  5343. if (placement === top || (placement === left || placement === right) && variation === end) {
  5344. sideY = bottom;
  5345. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
  5346. y -= offsetY - popperRect.height;
  5347. y *= gpuAcceleration ? 1 : -1;
  5348. }
  5349. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  5350. sideX = right;
  5351. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
  5352. x2 -= offsetX - popperRect.width;
  5353. x2 *= gpuAcceleration ? 1 : -1;
  5354. }
  5355. }
  5356. var commonStyles = Object.assign({
  5357. position
  5358. }, adaptive && unsetSides);
  5359. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  5360. x: x2,
  5361. y
  5362. }) : {
  5363. x: x2,
  5364. y
  5365. };
  5366. x2 = _ref4.x;
  5367. y = _ref4.y;
  5368. if (gpuAcceleration) {
  5369. var _Object$assign;
  5370. 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));
  5371. }
  5372. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x2 + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  5373. }
  5374. function computeStyles(_ref5) {
  5375. var state = _ref5.state, options = _ref5.options;
  5376. 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;
  5377. var commonStyles = {
  5378. placement: getBasePlacement(state.placement),
  5379. variation: getVariation(state.placement),
  5380. popper: state.elements.popper,
  5381. popperRect: state.rects.popper,
  5382. gpuAcceleration,
  5383. isFixed: state.options.strategy === "fixed"
  5384. };
  5385. if (state.modifiersData.popperOffsets != null) {
  5386. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  5387. offsets: state.modifiersData.popperOffsets,
  5388. position: state.options.strategy,
  5389. adaptive,
  5390. roundOffsets
  5391. })));
  5392. }
  5393. if (state.modifiersData.arrow != null) {
  5394. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  5395. offsets: state.modifiersData.arrow,
  5396. position: "absolute",
  5397. adaptive: false,
  5398. roundOffsets
  5399. })));
  5400. }
  5401. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5402. "data-popper-placement": state.placement
  5403. });
  5404. }
  5405. var computeStyles$1 = {
  5406. name: "computeStyles",
  5407. enabled: true,
  5408. phase: "beforeWrite",
  5409. fn: computeStyles,
  5410. data: {}
  5411. };
  5412. var passive = {
  5413. passive: true
  5414. };
  5415. function effect(_ref) {
  5416. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  5417. 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;
  5418. var window2 = getWindow(state.elements.popper);
  5419. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  5420. if (scroll) {
  5421. scrollParents.forEach(function(scrollParent) {
  5422. scrollParent.addEventListener("scroll", instance.update, passive);
  5423. });
  5424. }
  5425. if (resize) {
  5426. window2.addEventListener("resize", instance.update, passive);
  5427. }
  5428. return function() {
  5429. if (scroll) {
  5430. scrollParents.forEach(function(scrollParent) {
  5431. scrollParent.removeEventListener("scroll", instance.update, passive);
  5432. });
  5433. }
  5434. if (resize) {
  5435. window2.removeEventListener("resize", instance.update, passive);
  5436. }
  5437. };
  5438. }
  5439. var eventListeners = {
  5440. name: "eventListeners",
  5441. enabled: true,
  5442. phase: "write",
  5443. fn: function fn() {
  5444. },
  5445. effect,
  5446. data: {}
  5447. };
  5448. var hash$1 = {
  5449. left: "right",
  5450. right: "left",
  5451. bottom: "top",
  5452. top: "bottom"
  5453. };
  5454. function getOppositePlacement(placement) {
  5455. return placement.replace(/left|right|bottom|top/g, function(matched) {
  5456. return hash$1[matched];
  5457. });
  5458. }
  5459. var hash = {
  5460. start: "end",
  5461. end: "start"
  5462. };
  5463. function getOppositeVariationPlacement(placement) {
  5464. return placement.replace(/start|end/g, function(matched) {
  5465. return hash[matched];
  5466. });
  5467. }
  5468. function getWindowScroll(node) {
  5469. var win = getWindow(node);
  5470. var scrollLeft = win.pageXOffset;
  5471. var scrollTop = win.pageYOffset;
  5472. return {
  5473. scrollLeft,
  5474. scrollTop
  5475. };
  5476. }
  5477. function getWindowScrollBarX(element) {
  5478. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  5479. }
  5480. function getViewportRect(element) {
  5481. var win = getWindow(element);
  5482. var html = getDocumentElement(element);
  5483. var visualViewport = win.visualViewport;
  5484. var width = html.clientWidth;
  5485. var height = html.clientHeight;
  5486. var x2 = 0;
  5487. var y = 0;
  5488. if (visualViewport) {
  5489. width = visualViewport.width;
  5490. height = visualViewport.height;
  5491. if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
  5492. x2 = visualViewport.offsetLeft;
  5493. y = visualViewport.offsetTop;
  5494. }
  5495. }
  5496. return {
  5497. width,
  5498. height,
  5499. x: x2 + getWindowScrollBarX(element),
  5500. y
  5501. };
  5502. }
  5503. function getDocumentRect(element) {
  5504. var _element$ownerDocumen;
  5505. var html = getDocumentElement(element);
  5506. var winScroll = getWindowScroll(element);
  5507. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  5508. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  5509. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  5510. var x2 = -winScroll.scrollLeft + getWindowScrollBarX(element);
  5511. var y = -winScroll.scrollTop;
  5512. if (getComputedStyle$1(body || html).direction === "rtl") {
  5513. x2 += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  5514. }
  5515. return {
  5516. width,
  5517. height,
  5518. x: x2,
  5519. y
  5520. };
  5521. }
  5522. function isScrollParent(element) {
  5523. var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  5524. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  5525. }
  5526. function getScrollParent(node) {
  5527. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  5528. return node.ownerDocument.body;
  5529. }
  5530. if (isHTMLElement(node) && isScrollParent(node)) {
  5531. return node;
  5532. }
  5533. return getScrollParent(getParentNode(node));
  5534. }
  5535. function listScrollParents(element, list) {
  5536. var _element$ownerDocumen;
  5537. if (list === void 0) {
  5538. list = [];
  5539. }
  5540. var scrollParent = getScrollParent(element);
  5541. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  5542. var win = getWindow(scrollParent);
  5543. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  5544. var updatedList = list.concat(target);
  5545. return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
  5546. }
  5547. function rectToClientRect(rect) {
  5548. return Object.assign({}, rect, {
  5549. left: rect.x,
  5550. top: rect.y,
  5551. right: rect.x + rect.width,
  5552. bottom: rect.y + rect.height
  5553. });
  5554. }
  5555. function getInnerBoundingClientRect(element) {
  5556. var rect = getBoundingClientRect(element);
  5557. rect.top = rect.top + element.clientTop;
  5558. rect.left = rect.left + element.clientLeft;
  5559. rect.bottom = rect.top + element.clientHeight;
  5560. rect.right = rect.left + element.clientWidth;
  5561. rect.width = element.clientWidth;
  5562. rect.height = element.clientHeight;
  5563. rect.x = rect.left;
  5564. rect.y = rect.top;
  5565. return rect;
  5566. }
  5567. function getClientRectFromMixedType(element, clippingParent) {
  5568. return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  5569. }
  5570. function getClippingParents(element) {
  5571. var clippingParents2 = listScrollParents(getParentNode(element));
  5572. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
  5573. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  5574. if (!isElement(clipperElement)) {
  5575. return [];
  5576. }
  5577. return clippingParents2.filter(function(clippingParent) {
  5578. return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  5579. });
  5580. }
  5581. function getClippingRect(element, boundary, rootBoundary) {
  5582. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  5583. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  5584. var firstClippingParent = clippingParents2[0];
  5585. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  5586. var rect = getClientRectFromMixedType(element, clippingParent);
  5587. accRect.top = max(rect.top, accRect.top);
  5588. accRect.right = min(rect.right, accRect.right);
  5589. accRect.bottom = min(rect.bottom, accRect.bottom);
  5590. accRect.left = max(rect.left, accRect.left);
  5591. return accRect;
  5592. }, getClientRectFromMixedType(element, firstClippingParent));
  5593. clippingRect.width = clippingRect.right - clippingRect.left;
  5594. clippingRect.height = clippingRect.bottom - clippingRect.top;
  5595. clippingRect.x = clippingRect.left;
  5596. clippingRect.y = clippingRect.top;
  5597. return clippingRect;
  5598. }
  5599. function computeOffsets(_ref) {
  5600. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  5601. var basePlacement = placement ? getBasePlacement(placement) : null;
  5602. var variation = placement ? getVariation(placement) : null;
  5603. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  5604. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  5605. var offsets;
  5606. switch (basePlacement) {
  5607. case top:
  5608. offsets = {
  5609. x: commonX,
  5610. y: reference2.y - element.height
  5611. };
  5612. break;
  5613. case bottom:
  5614. offsets = {
  5615. x: commonX,
  5616. y: reference2.y + reference2.height
  5617. };
  5618. break;
  5619. case right:
  5620. offsets = {
  5621. x: reference2.x + reference2.width,
  5622. y: commonY
  5623. };
  5624. break;
  5625. case left:
  5626. offsets = {
  5627. x: reference2.x - element.width,
  5628. y: commonY
  5629. };
  5630. break;
  5631. default:
  5632. offsets = {
  5633. x: reference2.x,
  5634. y: reference2.y
  5635. };
  5636. }
  5637. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  5638. if (mainAxis != null) {
  5639. var len = mainAxis === "y" ? "height" : "width";
  5640. switch (variation) {
  5641. case start:
  5642. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  5643. break;
  5644. case end:
  5645. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  5646. break;
  5647. }
  5648. }
  5649. return offsets;
  5650. }
  5651. function detectOverflow(state, options) {
  5652. if (options === void 0) {
  5653. options = {};
  5654. }
  5655. var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _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;
  5656. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5657. var altContext = elementContext === popper ? reference : popper;
  5658. var popperRect = state.rects.popper;
  5659. var element = state.elements[altBoundary ? altContext : elementContext];
  5660. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
  5661. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  5662. var popperOffsets2 = computeOffsets({
  5663. reference: referenceClientRect,
  5664. element: popperRect,
  5665. strategy: "absolute",
  5666. placement
  5667. });
  5668. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  5669. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  5670. var overflowOffsets = {
  5671. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  5672. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  5673. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  5674. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  5675. };
  5676. var offsetData = state.modifiersData.offset;
  5677. if (elementContext === popper && offsetData) {
  5678. var offset2 = offsetData[placement];
  5679. Object.keys(overflowOffsets).forEach(function(key) {
  5680. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  5681. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  5682. overflowOffsets[key] += offset2[axis] * multiply;
  5683. });
  5684. }
  5685. return overflowOffsets;
  5686. }
  5687. function computeAutoPlacement(state, options) {
  5688. if (options === void 0) {
  5689. options = {};
  5690. }
  5691. 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;
  5692. var variation = getVariation(placement);
  5693. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  5694. return getVariation(placement2) === variation;
  5695. }) : basePlacements;
  5696. var allowedPlacements = placements$1.filter(function(placement2) {
  5697. return allowedAutoPlacements.indexOf(placement2) >= 0;
  5698. });
  5699. if (allowedPlacements.length === 0) {
  5700. allowedPlacements = placements$1;
  5701. }
  5702. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  5703. acc[placement2] = detectOverflow(state, {
  5704. placement: placement2,
  5705. boundary,
  5706. rootBoundary,
  5707. padding
  5708. })[getBasePlacement(placement2)];
  5709. return acc;
  5710. }, {});
  5711. return Object.keys(overflows).sort(function(a2, b2) {
  5712. return overflows[a2] - overflows[b2];
  5713. });
  5714. }
  5715. function getExpandedFallbackPlacements(placement) {
  5716. if (getBasePlacement(placement) === auto) {
  5717. return [];
  5718. }
  5719. var oppositePlacement = getOppositePlacement(placement);
  5720. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  5721. }
  5722. function flip(_ref) {
  5723. var state = _ref.state, options = _ref.options, name = _ref.name;
  5724. if (state.modifiersData[name]._skip) {
  5725. return;
  5726. }
  5727. 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;
  5728. var preferredPlacement = state.options.placement;
  5729. var basePlacement = getBasePlacement(preferredPlacement);
  5730. var isBasePlacement = basePlacement === preferredPlacement;
  5731. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  5732. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  5733. return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
  5734. placement: placement2,
  5735. boundary,
  5736. rootBoundary,
  5737. padding,
  5738. flipVariations,
  5739. allowedAutoPlacements
  5740. }) : placement2);
  5741. }, []);
  5742. var referenceRect = state.rects.reference;
  5743. var popperRect = state.rects.popper;
  5744. var checksMap = /* @__PURE__ */ new Map();
  5745. var makeFallbackChecks = true;
  5746. var firstFittingPlacement = placements2[0];
  5747. for (var i = 0; i < placements2.length; i++) {
  5748. var placement = placements2[i];
  5749. var _basePlacement = getBasePlacement(placement);
  5750. var isStartVariation = getVariation(placement) === start;
  5751. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  5752. var len = isVertical ? "width" : "height";
  5753. var overflow = detectOverflow(state, {
  5754. placement,
  5755. boundary,
  5756. rootBoundary,
  5757. altBoundary,
  5758. padding
  5759. });
  5760. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  5761. if (referenceRect[len] > popperRect[len]) {
  5762. mainVariationSide = getOppositePlacement(mainVariationSide);
  5763. }
  5764. var altVariationSide = getOppositePlacement(mainVariationSide);
  5765. var checks = [];
  5766. if (checkMainAxis) {
  5767. checks.push(overflow[_basePlacement] <= 0);
  5768. }
  5769. if (checkAltAxis) {
  5770. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  5771. }
  5772. if (checks.every(function(check2) {
  5773. return check2;
  5774. })) {
  5775. firstFittingPlacement = placement;
  5776. makeFallbackChecks = false;
  5777. break;
  5778. }
  5779. checksMap.set(placement, checks);
  5780. }
  5781. if (makeFallbackChecks) {
  5782. var numberOfChecks = flipVariations ? 3 : 1;
  5783. var _loop = function _loop2(_i2) {
  5784. var fittingPlacement = placements2.find(function(placement2) {
  5785. var checks2 = checksMap.get(placement2);
  5786. if (checks2) {
  5787. return checks2.slice(0, _i2).every(function(check2) {
  5788. return check2;
  5789. });
  5790. }
  5791. });
  5792. if (fittingPlacement) {
  5793. firstFittingPlacement = fittingPlacement;
  5794. return "break";
  5795. }
  5796. };
  5797. for (var _i = numberOfChecks; _i > 0; _i--) {
  5798. var _ret = _loop(_i);
  5799. if (_ret === "break")
  5800. break;
  5801. }
  5802. }
  5803. if (state.placement !== firstFittingPlacement) {
  5804. state.modifiersData[name]._skip = true;
  5805. state.placement = firstFittingPlacement;
  5806. state.reset = true;
  5807. }
  5808. }
  5809. var flip$1 = {
  5810. name: "flip",
  5811. enabled: true,
  5812. phase: "main",
  5813. fn: flip,
  5814. requiresIfExists: ["offset"],
  5815. data: {
  5816. _skip: false
  5817. }
  5818. };
  5819. function getSideOffsets(overflow, rect, preventedOffsets) {
  5820. if (preventedOffsets === void 0) {
  5821. preventedOffsets = {
  5822. x: 0,
  5823. y: 0
  5824. };
  5825. }
  5826. return {
  5827. top: overflow.top - rect.height - preventedOffsets.y,
  5828. right: overflow.right - rect.width + preventedOffsets.x,
  5829. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  5830. left: overflow.left - rect.width - preventedOffsets.x
  5831. };
  5832. }
  5833. function isAnySideFullyClipped(overflow) {
  5834. return [top, right, bottom, left].some(function(side) {
  5835. return overflow[side] >= 0;
  5836. });
  5837. }
  5838. function hide(_ref) {
  5839. var state = _ref.state, name = _ref.name;
  5840. var referenceRect = state.rects.reference;
  5841. var popperRect = state.rects.popper;
  5842. var preventedOffsets = state.modifiersData.preventOverflow;
  5843. var referenceOverflow = detectOverflow(state, {
  5844. elementContext: "reference"
  5845. });
  5846. var popperAltOverflow = detectOverflow(state, {
  5847. altBoundary: true
  5848. });
  5849. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  5850. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  5851. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  5852. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  5853. state.modifiersData[name] = {
  5854. referenceClippingOffsets,
  5855. popperEscapeOffsets,
  5856. isReferenceHidden,
  5857. hasPopperEscaped
  5858. };
  5859. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5860. "data-popper-reference-hidden": isReferenceHidden,
  5861. "data-popper-escaped": hasPopperEscaped
  5862. });
  5863. }
  5864. var hide$1 = {
  5865. name: "hide",
  5866. enabled: true,
  5867. phase: "main",
  5868. requiresIfExists: ["preventOverflow"],
  5869. fn: hide
  5870. };
  5871. function distanceAndSkiddingToXY(placement, rects, offset2) {
  5872. var basePlacement = getBasePlacement(placement);
  5873. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  5874. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  5875. placement
  5876. })) : offset2, skidding = _ref[0], distance = _ref[1];
  5877. skidding = skidding || 0;
  5878. distance = (distance || 0) * invertDistance;
  5879. return [left, right].indexOf(basePlacement) >= 0 ? {
  5880. x: distance,
  5881. y: skidding
  5882. } : {
  5883. x: skidding,
  5884. y: distance
  5885. };
  5886. }
  5887. function offset(_ref2) {
  5888. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  5889. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  5890. var data2 = placements.reduce(function(acc, placement) {
  5891. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  5892. return acc;
  5893. }, {});
  5894. var _data$state$placement = data2[state.placement], x2 = _data$state$placement.x, y = _data$state$placement.y;
  5895. if (state.modifiersData.popperOffsets != null) {
  5896. state.modifiersData.popperOffsets.x += x2;
  5897. state.modifiersData.popperOffsets.y += y;
  5898. }
  5899. state.modifiersData[name] = data2;
  5900. }
  5901. var offset$1 = {
  5902. name: "offset",
  5903. enabled: true,
  5904. phase: "main",
  5905. requires: ["popperOffsets"],
  5906. fn: offset
  5907. };
  5908. function popperOffsets(_ref) {
  5909. var state = _ref.state, name = _ref.name;
  5910. state.modifiersData[name] = computeOffsets({
  5911. reference: state.rects.reference,
  5912. element: state.rects.popper,
  5913. strategy: "absolute",
  5914. placement: state.placement
  5915. });
  5916. }
  5917. var popperOffsets$1 = {
  5918. name: "popperOffsets",
  5919. enabled: true,
  5920. phase: "read",
  5921. fn: popperOffsets,
  5922. data: {}
  5923. };
  5924. function getAltAxis(axis) {
  5925. return axis === "x" ? "y" : "x";
  5926. }
  5927. function preventOverflow(_ref) {
  5928. var state = _ref.state, options = _ref.options, name = _ref.name;
  5929. 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;
  5930. var overflow = detectOverflow(state, {
  5931. boundary,
  5932. rootBoundary,
  5933. padding,
  5934. altBoundary
  5935. });
  5936. var basePlacement = getBasePlacement(state.placement);
  5937. var variation = getVariation(state.placement);
  5938. var isBasePlacement = !variation;
  5939. var mainAxis = getMainAxisFromPlacement(basePlacement);
  5940. var altAxis = getAltAxis(mainAxis);
  5941. var popperOffsets2 = state.modifiersData.popperOffsets;
  5942. var referenceRect = state.rects.reference;
  5943. var popperRect = state.rects.popper;
  5944. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  5945. placement: state.placement
  5946. })) : tetherOffset;
  5947. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  5948. mainAxis: tetherOffsetValue,
  5949. altAxis: tetherOffsetValue
  5950. } : Object.assign({
  5951. mainAxis: 0,
  5952. altAxis: 0
  5953. }, tetherOffsetValue);
  5954. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  5955. var data2 = {
  5956. x: 0,
  5957. y: 0
  5958. };
  5959. if (!popperOffsets2) {
  5960. return;
  5961. }
  5962. if (checkMainAxis) {
  5963. var _offsetModifierState$;
  5964. var mainSide = mainAxis === "y" ? top : left;
  5965. var altSide = mainAxis === "y" ? bottom : right;
  5966. var len = mainAxis === "y" ? "height" : "width";
  5967. var offset2 = popperOffsets2[mainAxis];
  5968. var min$1 = offset2 + overflow[mainSide];
  5969. var max$1 = offset2 - overflow[altSide];
  5970. var additive = tether ? -popperRect[len] / 2 : 0;
  5971. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  5972. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  5973. var arrowElement = state.elements.arrow;
  5974. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  5975. width: 0,
  5976. height: 0
  5977. };
  5978. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  5979. var arrowPaddingMin = arrowPaddingObject[mainSide];
  5980. var arrowPaddingMax = arrowPaddingObject[altSide];
  5981. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  5982. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  5983. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  5984. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  5985. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  5986. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  5987. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  5988. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  5989. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  5990. popperOffsets2[mainAxis] = preventedOffset;
  5991. data2[mainAxis] = preventedOffset - offset2;
  5992. }
  5993. if (checkAltAxis) {
  5994. var _offsetModifierState$2;
  5995. var _mainSide = mainAxis === "x" ? top : left;
  5996. var _altSide = mainAxis === "x" ? bottom : right;
  5997. var _offset = popperOffsets2[altAxis];
  5998. var _len = altAxis === "y" ? "height" : "width";
  5999. var _min = _offset + overflow[_mainSide];
  6000. var _max = _offset - overflow[_altSide];
  6001. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  6002. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  6003. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  6004. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  6005. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  6006. popperOffsets2[altAxis] = _preventedOffset;
  6007. data2[altAxis] = _preventedOffset - _offset;
  6008. }
  6009. state.modifiersData[name] = data2;
  6010. }
  6011. var preventOverflow$1 = {
  6012. name: "preventOverflow",
  6013. enabled: true,
  6014. phase: "main",
  6015. fn: preventOverflow,
  6016. requiresIfExists: ["offset"]
  6017. };
  6018. function getHTMLElementScroll(element) {
  6019. return {
  6020. scrollLeft: element.scrollLeft,
  6021. scrollTop: element.scrollTop
  6022. };
  6023. }
  6024. function getNodeScroll(node) {
  6025. if (node === getWindow(node) || !isHTMLElement(node)) {
  6026. return getWindowScroll(node);
  6027. } else {
  6028. return getHTMLElementScroll(node);
  6029. }
  6030. }
  6031. function isElementScaled(element) {
  6032. var rect = element.getBoundingClientRect();
  6033. var scaleX = round(rect.width) / element.offsetWidth || 1;
  6034. var scaleY = round(rect.height) / element.offsetHeight || 1;
  6035. return scaleX !== 1 || scaleY !== 1;
  6036. }
  6037. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  6038. if (isFixed === void 0) {
  6039. isFixed = false;
  6040. }
  6041. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  6042. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  6043. var documentElement = getDocumentElement(offsetParent);
  6044. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
  6045. var scroll = {
  6046. scrollLeft: 0,
  6047. scrollTop: 0
  6048. };
  6049. var offsets = {
  6050. x: 0,
  6051. y: 0
  6052. };
  6053. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  6054. if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
  6055. scroll = getNodeScroll(offsetParent);
  6056. }
  6057. if (isHTMLElement(offsetParent)) {
  6058. offsets = getBoundingClientRect(offsetParent, true);
  6059. offsets.x += offsetParent.clientLeft;
  6060. offsets.y += offsetParent.clientTop;
  6061. } else if (documentElement) {
  6062. offsets.x = getWindowScrollBarX(documentElement);
  6063. }
  6064. }
  6065. return {
  6066. x: rect.left + scroll.scrollLeft - offsets.x,
  6067. y: rect.top + scroll.scrollTop - offsets.y,
  6068. width: rect.width,
  6069. height: rect.height
  6070. };
  6071. }
  6072. function order(modifiers) {
  6073. var map = /* @__PURE__ */ new Map();
  6074. var visited = /* @__PURE__ */ new Set();
  6075. var result = [];
  6076. modifiers.forEach(function(modifier) {
  6077. map.set(modifier.name, modifier);
  6078. });
  6079. function sort(modifier) {
  6080. visited.add(modifier.name);
  6081. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  6082. requires.forEach(function(dep) {
  6083. if (!visited.has(dep)) {
  6084. var depModifier = map.get(dep);
  6085. if (depModifier) {
  6086. sort(depModifier);
  6087. }
  6088. }
  6089. });
  6090. result.push(modifier);
  6091. }
  6092. modifiers.forEach(function(modifier) {
  6093. if (!visited.has(modifier.name)) {
  6094. sort(modifier);
  6095. }
  6096. });
  6097. return result;
  6098. }
  6099. function orderModifiers(modifiers) {
  6100. var orderedModifiers = order(modifiers);
  6101. return modifierPhases.reduce(function(acc, phase) {
  6102. return acc.concat(orderedModifiers.filter(function(modifier) {
  6103. return modifier.phase === phase;
  6104. }));
  6105. }, []);
  6106. }
  6107. function debounce(fn2) {
  6108. var pending;
  6109. return function() {
  6110. if (!pending) {
  6111. pending = new Promise(function(resolve) {
  6112. Promise.resolve().then(function() {
  6113. pending = void 0;
  6114. resolve(fn2());
  6115. });
  6116. });
  6117. }
  6118. return pending;
  6119. };
  6120. }
  6121. function mergeByName(modifiers) {
  6122. var merged = modifiers.reduce(function(merged2, current) {
  6123. var existing = merged2[current.name];
  6124. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  6125. options: Object.assign({}, existing.options, current.options),
  6126. data: Object.assign({}, existing.data, current.data)
  6127. }) : current;
  6128. return merged2;
  6129. }, {});
  6130. return Object.keys(merged).map(function(key) {
  6131. return merged[key];
  6132. });
  6133. }
  6134. var DEFAULT_OPTIONS = {
  6135. placement: "bottom",
  6136. modifiers: [],
  6137. strategy: "absolute"
  6138. };
  6139. function areValidElements() {
  6140. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  6141. args[_key] = arguments[_key];
  6142. }
  6143. return !args.some(function(element) {
  6144. return !(element && typeof element.getBoundingClientRect === "function");
  6145. });
  6146. }
  6147. function popperGenerator(generatorOptions) {
  6148. if (generatorOptions === void 0) {
  6149. generatorOptions = {};
  6150. }
  6151. 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;
  6152. return function createPopper2(reference2, popper2, options) {
  6153. if (options === void 0) {
  6154. options = defaultOptions;
  6155. }
  6156. var state = {
  6157. placement: "bottom",
  6158. orderedModifiers: [],
  6159. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  6160. modifiersData: {},
  6161. elements: {
  6162. reference: reference2,
  6163. popper: popper2
  6164. },
  6165. attributes: {},
  6166. styles: {}
  6167. };
  6168. var effectCleanupFns = [];
  6169. var isDestroyed = false;
  6170. var instance = {
  6171. state,
  6172. setOptions: function setOptions(setOptionsAction) {
  6173. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  6174. cleanupModifierEffects();
  6175. state.options = Object.assign({}, defaultOptions, state.options, options2);
  6176. state.scrollParents = {
  6177. reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  6178. popper: listScrollParents(popper2)
  6179. };
  6180. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  6181. state.orderedModifiers = orderedModifiers.filter(function(m2) {
  6182. return m2.enabled;
  6183. });
  6184. runModifierEffects();
  6185. return instance.update();
  6186. },
  6187. forceUpdate: function forceUpdate() {
  6188. if (isDestroyed) {
  6189. return;
  6190. }
  6191. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  6192. if (!areValidElements(reference3, popper3)) {
  6193. return;
  6194. }
  6195. state.rects = {
  6196. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  6197. popper: getLayoutRect(popper3)
  6198. };
  6199. state.reset = false;
  6200. state.placement = state.options.placement;
  6201. state.orderedModifiers.forEach(function(modifier) {
  6202. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  6203. });
  6204. for (var index = 0; index < state.orderedModifiers.length; index++) {
  6205. if (state.reset === true) {
  6206. state.reset = false;
  6207. index = -1;
  6208. continue;
  6209. }
  6210. 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;
  6211. if (typeof fn2 === "function") {
  6212. state = fn2({
  6213. state,
  6214. options: _options,
  6215. name,
  6216. instance
  6217. }) || state;
  6218. }
  6219. }
  6220. },
  6221. update: debounce(function() {
  6222. return new Promise(function(resolve) {
  6223. instance.forceUpdate();
  6224. resolve(state);
  6225. });
  6226. }),
  6227. destroy: function destroy() {
  6228. cleanupModifierEffects();
  6229. isDestroyed = true;
  6230. }
  6231. };
  6232. if (!areValidElements(reference2, popper2)) {
  6233. return instance;
  6234. }
  6235. instance.setOptions(options).then(function(state2) {
  6236. if (!isDestroyed && options.onFirstUpdate) {
  6237. options.onFirstUpdate(state2);
  6238. }
  6239. });
  6240. function runModifierEffects() {
  6241. state.orderedModifiers.forEach(function(_ref3) {
  6242. var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect2 = _ref3.effect;
  6243. if (typeof effect2 === "function") {
  6244. var cleanupFn = effect2({
  6245. state,
  6246. name,
  6247. instance,
  6248. options: options2
  6249. });
  6250. var noopFn = function noopFn2() {
  6251. };
  6252. effectCleanupFns.push(cleanupFn || noopFn);
  6253. }
  6254. });
  6255. }
  6256. function cleanupModifierEffects() {
  6257. effectCleanupFns.forEach(function(fn2) {
  6258. return fn2();
  6259. });
  6260. effectCleanupFns = [];
  6261. }
  6262. return instance;
  6263. };
  6264. }
  6265. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  6266. var createPopper = /* @__PURE__ */ popperGenerator({
  6267. defaultModifiers
  6268. });
  6269. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  6270. const usePopperCoreConfigProps = buildProps({
  6271. boundariesPadding: {
  6272. type: Number,
  6273. default: 0
  6274. },
  6275. fallbackPlacements: {
  6276. type: definePropType(Array),
  6277. default: () => []
  6278. },
  6279. gpuAcceleration: {
  6280. type: Boolean,
  6281. default: true
  6282. },
  6283. offset: {
  6284. type: Number,
  6285. default: 12
  6286. },
  6287. placement: {
  6288. type: String,
  6289. values: placements,
  6290. default: "bottom"
  6291. },
  6292. popperOptions: {
  6293. type: definePropType(Object),
  6294. default: () => ({})
  6295. },
  6296. strategy: {
  6297. type: String,
  6298. values: POSITIONING_STRATEGIES,
  6299. default: "absolute"
  6300. }
  6301. });
  6302. const usePopperContentProps = buildProps(__spreadProps(__spreadValues({}, usePopperCoreConfigProps), {
  6303. style: { type: definePropType([String, Array, Object]) },
  6304. className: { type: definePropType([String, Array, Object]) },
  6305. effect: {
  6306. type: String,
  6307. default: "dark"
  6308. },
  6309. visible: Boolean,
  6310. enterable: {
  6311. type: Boolean,
  6312. default: true
  6313. },
  6314. pure: Boolean,
  6315. popperClass: {
  6316. type: definePropType([String, Array, Object])
  6317. },
  6318. popperStyle: {
  6319. type: definePropType([String, Array, Object])
  6320. },
  6321. referenceEl: {
  6322. type: definePropType(Object)
  6323. },
  6324. stopPopperMouseEvent: {
  6325. type: Boolean,
  6326. default: true
  6327. },
  6328. zIndex: Number
  6329. }));
  6330. const buildPopperOptions = (props, arrowProps) => {
  6331. const { placement, strategy, popperOptions: popperOptions2 } = props;
  6332. const options = __spreadProps(__spreadValues({
  6333. placement,
  6334. strategy
  6335. }, popperOptions2), {
  6336. modifiers: genModifiers(props)
  6337. });
  6338. attachArrow(options, arrowProps);
  6339. deriveExtraModifiers(options, popperOptions2 == null ? void 0 : popperOptions2.modifiers);
  6340. return options;
  6341. };
  6342. const unwrapMeasurableEl = ($el) => {
  6343. if (!isClient$1)
  6344. return;
  6345. return unrefElement($el);
  6346. };
  6347. function genModifiers(options) {
  6348. const { offset: offset2, gpuAcceleration, fallbackPlacements } = options;
  6349. return [
  6350. {
  6351. name: "offset",
  6352. options: {
  6353. offset: [0, offset2 != null ? offset2 : 12]
  6354. }
  6355. },
  6356. {
  6357. name: "preventOverflow",
  6358. options: {
  6359. padding: {
  6360. top: 2,
  6361. bottom: 2,
  6362. left: 5,
  6363. right: 5
  6364. }
  6365. }
  6366. },
  6367. {
  6368. name: "flip",
  6369. options: {
  6370. padding: 5,
  6371. fallbackPlacements: fallbackPlacements != null ? fallbackPlacements : []
  6372. }
  6373. },
  6374. {
  6375. name: "computeStyles",
  6376. options: {
  6377. gpuAcceleration,
  6378. adaptive: gpuAcceleration
  6379. }
  6380. }
  6381. ];
  6382. }
  6383. function attachArrow(options, { arrowEl, arrowOffset }) {
  6384. options.modifiers.push({
  6385. name: "arrow",
  6386. options: {
  6387. element: arrowEl,
  6388. padding: arrowOffset != null ? arrowOffset : 5
  6389. }
  6390. });
  6391. }
  6392. function deriveExtraModifiers(options, modifiers) {
  6393. if (modifiers) {
  6394. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  6395. }
  6396. }
  6397. const __default__$g = {
  6398. name: "ElPopperContent"
  6399. };
  6400. const _sfc_main$Z = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$g), {
  6401. props: usePopperContentProps,
  6402. emits: ["mouseenter", "mouseleave"],
  6403. setup(__props, { expose }) {
  6404. const props = __props;
  6405. const { popperInstanceRef, contentRef, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  6406. const { nextZIndex } = useZIndex();
  6407. const ns = useNamespace("popper");
  6408. const popperContentRef = ref();
  6409. const arrowRef = ref();
  6410. const arrowOffset = ref();
  6411. provide(POPPER_CONTENT_INJECTION_KEY, {
  6412. arrowRef,
  6413. arrowOffset
  6414. });
  6415. const contentZIndex = ref(props.zIndex || nextZIndex());
  6416. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
  6417. const contentStyle = computed(() => [{ zIndex: unref(contentZIndex) }, props.popperStyle]);
  6418. const contentClass = computed(() => [
  6419. ns.b(),
  6420. ns.is("pure", props.pure),
  6421. ns.is(props.effect),
  6422. props.popperClass
  6423. ]);
  6424. const createPopperInstance = ({ referenceEl, popperContentEl, arrowEl }) => {
  6425. const options = buildPopperOptions(props, {
  6426. arrowEl,
  6427. arrowOffset: unref(arrowOffset)
  6428. });
  6429. return createPopper(referenceEl, popperContentEl, options);
  6430. };
  6431. const updatePopper = (shouldUpdateZIndex = true) => {
  6432. var _a2;
  6433. (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.update();
  6434. shouldUpdateZIndex && (contentZIndex.value = props.zIndex || nextZIndex());
  6435. };
  6436. const togglePopperAlive = () => {
  6437. var _a2, _b2;
  6438. const monitorable = { name: "eventListeners", enabled: props.visible };
  6439. (_b2 = (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.setOptions) == null ? void 0 : _b2.call(_a2, (options) => __spreadProps(__spreadValues({}, options), {
  6440. modifiers: [...options.modifiers || [], monitorable]
  6441. }));
  6442. updatePopper(false);
  6443. };
  6444. onMounted(() => {
  6445. let updateHandle;
  6446. watch(computedReference, (referenceEl) => {
  6447. var _a2;
  6448. updateHandle == null ? void 0 : updateHandle();
  6449. const popperInstance = unref(popperInstanceRef);
  6450. (_a2 = popperInstance == null ? void 0 : popperInstance.destroy) == null ? void 0 : _a2.call(popperInstance);
  6451. if (referenceEl) {
  6452. const popperContentEl = unref(popperContentRef);
  6453. contentRef.value = popperContentEl;
  6454. popperInstanceRef.value = createPopperInstance({
  6455. referenceEl,
  6456. popperContentEl,
  6457. arrowEl: unref(arrowRef)
  6458. });
  6459. updateHandle = watch(() => referenceEl.getBoundingClientRect(), () => updatePopper(), {
  6460. immediate: true
  6461. });
  6462. } else {
  6463. popperInstanceRef.value = void 0;
  6464. }
  6465. }, {
  6466. immediate: true
  6467. });
  6468. watch(() => props.visible, togglePopperAlive, { immediate: true });
  6469. watch(() => buildPopperOptions(props, {
  6470. arrowEl: unref(arrowRef),
  6471. arrowOffset: unref(arrowOffset)
  6472. }), (option) => {
  6473. var _a2;
  6474. return (_a2 = popperInstanceRef.value) == null ? void 0 : _a2.setOptions(option);
  6475. });
  6476. });
  6477. expose({
  6478. popperContentRef,
  6479. popperInstanceRef,
  6480. updatePopper,
  6481. contentStyle
  6482. });
  6483. return (_ctx, _cache) => {
  6484. return openBlock(), createElementBlock("div", {
  6485. ref_key: "popperContentRef",
  6486. ref: popperContentRef,
  6487. style: normalizeStyle(unref(contentStyle)),
  6488. class: normalizeClass(unref(contentClass)),
  6489. role: "tooltip",
  6490. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  6491. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  6492. }, [
  6493. renderSlot(_ctx.$slots, "default")
  6494. ], 38);
  6495. };
  6496. }
  6497. }));
  6498. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$Z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
  6499. function useDeprecateAppendToBody(scope, from) {
  6500. const vm = getCurrentInstance();
  6501. const compatTeleported = computed(() => {
  6502. return isBoolean(vm.props[from]) ? vm.props[from] : vm.props.teleported;
  6503. });
  6504. useDeprecated({
  6505. scope,
  6506. from,
  6507. replacement: "teleported",
  6508. version: "2.1.0",
  6509. ref: "https://element-plus.org/en-US/component/tooltip.html#attributes"
  6510. }, computed(() => isBoolean(vm.props[from])));
  6511. return {
  6512. compatTeleported
  6513. };
  6514. }
  6515. const ElPopper = withInstall(Popper);
  6516. const _sfc_main$Y = defineComponent({
  6517. name: "ElVisuallyHidden",
  6518. props: {
  6519. style: {
  6520. type: [String, Object, Array]
  6521. }
  6522. },
  6523. setup(props) {
  6524. return {
  6525. computedStyle: computed(() => {
  6526. return [
  6527. props.style,
  6528. {
  6529. position: "absolute",
  6530. border: 0,
  6531. width: 1,
  6532. height: 1,
  6533. padding: 0,
  6534. margin: -1,
  6535. overflow: "hidden",
  6536. clip: "rect(0, 0, 0, 0)",
  6537. whiteSpace: "nowrap",
  6538. wordWrap: "normal"
  6539. }
  6540. ];
  6541. })
  6542. };
  6543. }
  6544. });
  6545. function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
  6546. return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, { style: _ctx.computedStyle }), [
  6547. renderSlot(_ctx.$slots, "default")
  6548. ], 16);
  6549. }
  6550. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc$1(_sfc_main$Y, [["render", _sfc_render$A], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/visual-hidden/src/visual-hidden.vue"]]);
  6551. const useTooltipContentProps = buildProps(__spreadProps(__spreadValues(__spreadValues({}, useDelayedToggleProps), usePopperContentProps), {
  6552. appendTo: {
  6553. type: definePropType([String, Object]),
  6554. default: POPPER_CONTAINER_SELECTOR
  6555. },
  6556. content: {
  6557. type: String,
  6558. default: ""
  6559. },
  6560. rawContent: {
  6561. type: Boolean,
  6562. default: false
  6563. },
  6564. persistent: Boolean,
  6565. ariaLabel: String,
  6566. visible: {
  6567. type: definePropType(Boolean),
  6568. default: null
  6569. },
  6570. transition: {
  6571. type: String,
  6572. default: "el-fade-in-linear"
  6573. },
  6574. teleported: {
  6575. type: Boolean,
  6576. default: true
  6577. },
  6578. disabled: {
  6579. type: Boolean
  6580. }
  6581. }));
  6582. const useTooltipTriggerProps = buildProps(__spreadProps(__spreadValues({}, usePopperTriggerProps), {
  6583. disabled: Boolean,
  6584. trigger: {
  6585. type: definePropType([String, Array]),
  6586. default: "hover"
  6587. }
  6588. }));
  6589. const useTooltipProps = buildProps({
  6590. openDelay: {
  6591. type: Number
  6592. },
  6593. visibleArrow: {
  6594. type: Boolean,
  6595. default: void 0
  6596. },
  6597. hideAfter: {
  6598. type: Number,
  6599. default: 200
  6600. },
  6601. showArrow: {
  6602. type: Boolean,
  6603. default: true
  6604. }
  6605. });
  6606. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  6607. const _sfc_main$X = defineComponent({
  6608. name: "ElTooltipContent",
  6609. components: {
  6610. ElPopperContent,
  6611. ElVisuallyHidden
  6612. },
  6613. inheritAttrs: false,
  6614. props: useTooltipContentProps,
  6615. setup(props) {
  6616. const contentRef = ref(null);
  6617. const intermediateOpen = ref(false);
  6618. const entering = ref(false);
  6619. const leaving = ref(false);
  6620. const destroyed = ref(false);
  6621. const {
  6622. controlled,
  6623. id,
  6624. open,
  6625. trigger,
  6626. onClose,
  6627. onOpen,
  6628. onShow,
  6629. onHide,
  6630. onBeforeShow,
  6631. onBeforeHide
  6632. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6633. const persistentRef = computed(() => {
  6634. return props.persistent;
  6635. });
  6636. onBeforeUnmount(() => {
  6637. destroyed.value = true;
  6638. });
  6639. const shouldRender = computed(() => {
  6640. return unref(persistentRef) ? true : unref(open);
  6641. });
  6642. const shouldShow = computed(() => {
  6643. return props.disabled ? false : unref(open);
  6644. });
  6645. const contentStyle = computed(() => {
  6646. var _a2;
  6647. return (_a2 = props.style) != null ? _a2 : {};
  6648. });
  6649. const ariaHidden = computed(() => !unref(open));
  6650. useEscapeKeydown(onClose);
  6651. const onTransitionLeave = () => {
  6652. onHide();
  6653. };
  6654. const stopWhenControlled = () => {
  6655. if (unref(controlled))
  6656. return true;
  6657. };
  6658. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  6659. if (props.enterable && unref(trigger) === "hover") {
  6660. onOpen();
  6661. }
  6662. });
  6663. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  6664. if (unref(trigger) === "hover") {
  6665. onClose();
  6666. }
  6667. });
  6668. const onBeforeEnter = () => {
  6669. var _a2, _b2;
  6670. (_b2 = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  6671. onBeforeShow == null ? void 0 : onBeforeShow();
  6672. };
  6673. const onBeforeLeave = () => {
  6674. onBeforeHide == null ? void 0 : onBeforeHide();
  6675. };
  6676. const onAfterShow = () => {
  6677. onShow();
  6678. };
  6679. let stopHandle;
  6680. watch(() => unref(open), (val) => {
  6681. if (val) {
  6682. stopHandle = onClickOutside(computed(() => {
  6683. var _a2;
  6684. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  6685. }), () => {
  6686. if (unref(controlled))
  6687. return;
  6688. const $trigger = unref(trigger);
  6689. if ($trigger !== "hover") {
  6690. onClose();
  6691. }
  6692. });
  6693. } else {
  6694. stopHandle == null ? void 0 : stopHandle();
  6695. }
  6696. }, {
  6697. flush: "post"
  6698. });
  6699. return {
  6700. ariaHidden,
  6701. entering,
  6702. leaving,
  6703. id,
  6704. intermediateOpen,
  6705. contentStyle,
  6706. contentRef,
  6707. destroyed,
  6708. shouldRender,
  6709. shouldShow,
  6710. open,
  6711. onAfterShow,
  6712. onBeforeEnter,
  6713. onBeforeLeave,
  6714. onContentEnter,
  6715. onContentLeave,
  6716. onTransitionLeave
  6717. };
  6718. }
  6719. });
  6720. function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
  6721. const _component_el_visually_hidden = resolveComponent("el-visually-hidden");
  6722. const _component_el_popper_content = resolveComponent("el-popper-content");
  6723. return openBlock(), createBlock(Teleport, {
  6724. disabled: !_ctx.teleported,
  6725. to: _ctx.appendTo
  6726. }, [
  6727. createVNode(Transition, {
  6728. name: _ctx.transition,
  6729. onAfterLeave: _ctx.onTransitionLeave,
  6730. onBeforeEnter: _ctx.onBeforeEnter,
  6731. onAfterEnter: _ctx.onAfterShow,
  6732. onBeforeLeave: _ctx.onBeforeLeave
  6733. }, {
  6734. default: withCtx(() => [
  6735. _ctx.shouldRender ? withDirectives((openBlock(), createBlock(_component_el_popper_content, mergeProps({
  6736. key: 0,
  6737. ref: "contentRef"
  6738. }, _ctx.$attrs, {
  6739. "aria-hidden": _ctx.ariaHidden,
  6740. "boundaries-padding": _ctx.boundariesPadding,
  6741. "fallback-placements": _ctx.fallbackPlacements,
  6742. "gpu-acceleration": _ctx.gpuAcceleration,
  6743. offset: _ctx.offset,
  6744. placement: _ctx.placement,
  6745. "popper-options": _ctx.popperOptions,
  6746. strategy: _ctx.strategy,
  6747. effect: _ctx.effect,
  6748. enterable: _ctx.enterable,
  6749. pure: _ctx.pure,
  6750. "popper-class": _ctx.popperClass,
  6751. "popper-style": [_ctx.popperStyle, _ctx.contentStyle],
  6752. "reference-el": _ctx.referenceEl,
  6753. visible: _ctx.shouldShow,
  6754. "z-index": _ctx.zIndex,
  6755. onMouseenter: _ctx.onContentEnter,
  6756. onMouseleave: _ctx.onContentLeave
  6757. }), {
  6758. default: withCtx(() => [
  6759. createCommentVNode(" Workaround bug #6378 "),
  6760. !_ctx.destroyed ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  6761. renderSlot(_ctx.$slots, "default"),
  6762. createVNode(_component_el_visually_hidden, {
  6763. id: _ctx.id,
  6764. role: "tooltip"
  6765. }, {
  6766. default: withCtx(() => [
  6767. createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
  6768. ]),
  6769. _: 1
  6770. }, 8, ["id"])
  6771. ], 64)) : createCommentVNode("v-if", true)
  6772. ]),
  6773. _: 3
  6774. }, 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"])), [
  6775. [vShow, _ctx.shouldShow]
  6776. ]) : createCommentVNode("v-if", true)
  6777. ]),
  6778. _: 3
  6779. }, 8, ["name", "onAfterLeave", "onBeforeEnter", "onAfterEnter", "onBeforeLeave"])
  6780. ], 8, ["disabled", "to"]);
  6781. }
  6782. var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$X, [["render", _sfc_render$z], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
  6783. const isTriggerType = (trigger, type4) => {
  6784. if (isArray(trigger)) {
  6785. return trigger.includes(type4);
  6786. }
  6787. return trigger === type4;
  6788. };
  6789. const whenTrigger = (trigger, type4, handler3) => {
  6790. return (e) => {
  6791. isTriggerType(unref(trigger), type4) && handler3(e);
  6792. };
  6793. };
  6794. const _sfc_main$W = defineComponent({
  6795. name: "ElTooltipTrigger",
  6796. components: {
  6797. ElPopperTrigger
  6798. },
  6799. props: useTooltipTriggerProps,
  6800. setup(props) {
  6801. const ns = useNamespace("tooltip");
  6802. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6803. const triggerRef2 = ref(null);
  6804. const stopWhenControlledOrDisabled = () => {
  6805. if (unref(controlled) || props.disabled) {
  6806. return true;
  6807. }
  6808. };
  6809. const trigger = toRef(props, "trigger");
  6810. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  6811. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  6812. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  6813. if (e.button === 0) {
  6814. onToggle(e);
  6815. }
  6816. }));
  6817. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  6818. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  6819. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  6820. e.preventDefault();
  6821. onToggle(e);
  6822. }));
  6823. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  6824. const { code } = e;
  6825. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  6826. onToggle(e);
  6827. }
  6828. });
  6829. return {
  6830. onBlur,
  6831. onContextMenu,
  6832. onFocus,
  6833. onMouseenter,
  6834. onMouseleave,
  6835. onClick,
  6836. onKeydown,
  6837. open,
  6838. id,
  6839. triggerRef: triggerRef2,
  6840. ns
  6841. };
  6842. }
  6843. });
  6844. function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
  6845. const _component_el_popper_trigger = resolveComponent("el-popper-trigger");
  6846. return openBlock(), createBlock(_component_el_popper_trigger, {
  6847. id: _ctx.id,
  6848. "virtual-ref": _ctx.virtualRef,
  6849. open: _ctx.open,
  6850. "virtual-triggering": _ctx.virtualTriggering,
  6851. class: normalizeClass(_ctx.ns.e("trigger")),
  6852. onBlur: _ctx.onBlur,
  6853. onClick: _ctx.onClick,
  6854. onContextmenu: _ctx.onContextMenu,
  6855. onFocus: _ctx.onFocus,
  6856. onMouseenter: _ctx.onMouseenter,
  6857. onMouseleave: _ctx.onMouseleave,
  6858. onKeydown: _ctx.onKeydown
  6859. }, {
  6860. default: withCtx(() => [
  6861. renderSlot(_ctx.$slots, "default")
  6862. ]),
  6863. _: 3
  6864. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  6865. }
  6866. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$W, [["render", _sfc_render$y], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
  6867. const { useModelToggleProps, useModelToggle, useModelToggleEmits } = createModelToggleComposable("visible");
  6868. const _sfc_main$V = defineComponent({
  6869. name: "ElTooltip",
  6870. components: {
  6871. ElPopper,
  6872. ElPopperArrow,
  6873. ElTooltipContent,
  6874. ElTooltipTrigger
  6875. },
  6876. props: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, useModelToggleProps), useTooltipContentProps), useTooltipTriggerProps), usePopperArrowProps), useTooltipProps),
  6877. emits: [...useModelToggleEmits, "before-show", "before-hide", "show", "hide"],
  6878. setup(props, { emit }) {
  6879. usePopperContainer();
  6880. const compatShowAfter = computed(() => {
  6881. if (!isUndefined(props.openDelay))
  6882. ;
  6883. return props.openDelay || props.showAfter;
  6884. });
  6885. const compatShowArrow = computed(() => {
  6886. if (!isUndefined(props.visibleArrow))
  6887. ;
  6888. return isBoolean(props.visibleArrow) ? props.visibleArrow : props.showArrow;
  6889. });
  6890. const id = useId();
  6891. const popperRef = ref(null);
  6892. const updatePopper = () => {
  6893. var _a2;
  6894. const popperComponent = unref(popperRef);
  6895. if (popperComponent) {
  6896. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  6897. }
  6898. };
  6899. const open = ref(false);
  6900. const { show, hide: hide2 } = useModelToggle({
  6901. indicator: open
  6902. });
  6903. const { onOpen, onClose } = useDelayedToggle({
  6904. showAfter: compatShowAfter,
  6905. hideAfter: toRef(props, "hideAfter"),
  6906. open: show,
  6907. close: hide2
  6908. });
  6909. const controlled = computed(() => isBoolean(props.visible));
  6910. provide(TOOLTIP_INJECTION_KEY, {
  6911. controlled,
  6912. id,
  6913. open: readonly(open),
  6914. trigger: toRef(props, "trigger"),
  6915. onOpen,
  6916. onClose,
  6917. onToggle: () => {
  6918. if (unref(open)) {
  6919. onClose();
  6920. } else {
  6921. onOpen();
  6922. }
  6923. },
  6924. onShow: () => {
  6925. emit("show");
  6926. },
  6927. onHide: () => {
  6928. emit("hide");
  6929. },
  6930. onBeforeShow: () => {
  6931. emit("before-show");
  6932. },
  6933. onBeforeHide: () => {
  6934. emit("before-hide");
  6935. },
  6936. updatePopper
  6937. });
  6938. watch(() => props.disabled, (disabled) => {
  6939. if (disabled && open.value) {
  6940. open.value = false;
  6941. }
  6942. });
  6943. return {
  6944. compatShowAfter,
  6945. compatShowArrow,
  6946. popperRef,
  6947. open,
  6948. hide: hide2,
  6949. updatePopper,
  6950. onOpen,
  6951. onClose
  6952. };
  6953. }
  6954. });
  6955. const _hoisted_1$B = ["innerHTML"];
  6956. const _hoisted_2$s = { key: 1 };
  6957. function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
  6958. const _component_el_tooltip_trigger = resolveComponent("el-tooltip-trigger");
  6959. const _component_el_popper_arrow = resolveComponent("el-popper-arrow");
  6960. const _component_el_tooltip_content = resolveComponent("el-tooltip-content");
  6961. const _component_el_popper = resolveComponent("el-popper");
  6962. return openBlock(), createBlock(_component_el_popper, { ref: "popperRef" }, {
  6963. default: withCtx(() => [
  6964. createVNode(_component_el_tooltip_trigger, {
  6965. disabled: _ctx.disabled,
  6966. trigger: _ctx.trigger,
  6967. "virtual-ref": _ctx.virtualRef,
  6968. "virtual-triggering": _ctx.virtualTriggering
  6969. }, {
  6970. default: withCtx(() => [
  6971. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  6972. ]),
  6973. _: 3
  6974. }, 8, ["disabled", "trigger", "virtual-ref", "virtual-triggering"]),
  6975. createVNode(_component_el_tooltip_content, {
  6976. "aria-label": _ctx.ariaLabel,
  6977. "boundaries-padding": _ctx.boundariesPadding,
  6978. content: _ctx.content,
  6979. disabled: _ctx.disabled,
  6980. effect: _ctx.effect,
  6981. enterable: _ctx.enterable,
  6982. "fallback-placements": _ctx.fallbackPlacements,
  6983. "hide-after": _ctx.hideAfter,
  6984. "gpu-acceleration": _ctx.gpuAcceleration,
  6985. offset: _ctx.offset,
  6986. persistent: _ctx.persistent,
  6987. "popper-class": _ctx.popperClass,
  6988. "popper-style": _ctx.popperStyle,
  6989. placement: _ctx.placement,
  6990. "popper-options": _ctx.popperOptions,
  6991. pure: _ctx.pure,
  6992. "raw-content": _ctx.rawContent,
  6993. "reference-el": _ctx.referenceEl,
  6994. "show-after": _ctx.compatShowAfter,
  6995. strategy: _ctx.strategy,
  6996. teleported: _ctx.teleported,
  6997. transition: _ctx.transition,
  6998. "z-index": _ctx.zIndex,
  6999. "append-to": _ctx.appendTo
  7000. }, {
  7001. default: withCtx(() => [
  7002. renderSlot(_ctx.$slots, "content", {}, () => [
  7003. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  7004. key: 0,
  7005. innerHTML: _ctx.content
  7006. }, null, 8, _hoisted_1$B)) : (openBlock(), createElementBlock("span", _hoisted_2$s, toDisplayString(_ctx.content), 1))
  7007. ]),
  7008. _ctx.compatShowArrow ? (openBlock(), createBlock(_component_el_popper_arrow, {
  7009. key: 0,
  7010. "arrow-offset": _ctx.arrowOffset
  7011. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  7012. ]),
  7013. _: 3
  7014. }, 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"])
  7015. ]),
  7016. _: 3
  7017. }, 512);
  7018. }
  7019. var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$V, [["render", _sfc_render$x], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
  7020. const ElTooltip = withInstall(Tooltip);
  7021. const buttonTypes = [
  7022. "default",
  7023. "primary",
  7024. "success",
  7025. "warning",
  7026. "info",
  7027. "danger",
  7028. "text",
  7029. ""
  7030. ];
  7031. const buttonNativeTypes = ["button", "submit", "reset"];
  7032. const buttonProps = buildProps({
  7033. size: useSizeProp,
  7034. disabled: Boolean,
  7035. type: {
  7036. type: String,
  7037. values: buttonTypes,
  7038. default: ""
  7039. },
  7040. icon: {
  7041. type: iconPropType,
  7042. default: ""
  7043. },
  7044. nativeType: {
  7045. type: String,
  7046. values: buttonNativeTypes,
  7047. default: "button"
  7048. },
  7049. loading: Boolean,
  7050. loadingIcon: {
  7051. type: iconPropType,
  7052. default: () => loading
  7053. },
  7054. plain: Boolean,
  7055. autofocus: Boolean,
  7056. round: Boolean,
  7057. circle: Boolean,
  7058. color: String,
  7059. dark: Boolean,
  7060. autoInsertSpace: {
  7061. type: Boolean,
  7062. default: void 0
  7063. }
  7064. });
  7065. const buttonEmits = {
  7066. click: (evt) => evt instanceof MouseEvent
  7067. };
  7068. function bound01(n, max2) {
  7069. if (isOnePointZero(n)) {
  7070. n = "100%";
  7071. }
  7072. var isPercent = isPercentage(n);
  7073. n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
  7074. if (isPercent) {
  7075. n = parseInt(String(n * max2), 10) / 100;
  7076. }
  7077. if (Math.abs(n - max2) < 1e-6) {
  7078. return 1;
  7079. }
  7080. if (max2 === 360) {
  7081. n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
  7082. } else {
  7083. n = n % max2 / parseFloat(String(max2));
  7084. }
  7085. return n;
  7086. }
  7087. function clamp01(val) {
  7088. return Math.min(1, Math.max(0, val));
  7089. }
  7090. function isOnePointZero(n) {
  7091. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  7092. }
  7093. function isPercentage(n) {
  7094. return typeof n === "string" && n.indexOf("%") !== -1;
  7095. }
  7096. function boundAlpha(a2) {
  7097. a2 = parseFloat(a2);
  7098. if (isNaN(a2) || a2 < 0 || a2 > 1) {
  7099. a2 = 1;
  7100. }
  7101. return a2;
  7102. }
  7103. function convertToPercentage(n) {
  7104. if (n <= 1) {
  7105. return "".concat(Number(n) * 100, "%");
  7106. }
  7107. return n;
  7108. }
  7109. function pad2(c) {
  7110. return c.length === 1 ? "0" + c : String(c);
  7111. }
  7112. function rgbToRgb(r, g, b2) {
  7113. return {
  7114. r: bound01(r, 255) * 255,
  7115. g: bound01(g, 255) * 255,
  7116. b: bound01(b2, 255) * 255
  7117. };
  7118. }
  7119. function rgbToHsl(r, g, b2) {
  7120. r = bound01(r, 255);
  7121. g = bound01(g, 255);
  7122. b2 = bound01(b2, 255);
  7123. var max2 = Math.max(r, g, b2);
  7124. var min2 = Math.min(r, g, b2);
  7125. var h2 = 0;
  7126. var s2 = 0;
  7127. var l2 = (max2 + min2) / 2;
  7128. if (max2 === min2) {
  7129. s2 = 0;
  7130. h2 = 0;
  7131. } else {
  7132. var d2 = max2 - min2;
  7133. s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
  7134. switch (max2) {
  7135. case r:
  7136. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7137. break;
  7138. case g:
  7139. h2 = (b2 - r) / d2 + 2;
  7140. break;
  7141. case b2:
  7142. h2 = (r - g) / d2 + 4;
  7143. break;
  7144. }
  7145. h2 /= 6;
  7146. }
  7147. return { h: h2, s: s2, l: l2 };
  7148. }
  7149. function hue2rgb(p2, q, t) {
  7150. if (t < 0) {
  7151. t += 1;
  7152. }
  7153. if (t > 1) {
  7154. t -= 1;
  7155. }
  7156. if (t < 1 / 6) {
  7157. return p2 + (q - p2) * (6 * t);
  7158. }
  7159. if (t < 1 / 2) {
  7160. return q;
  7161. }
  7162. if (t < 2 / 3) {
  7163. return p2 + (q - p2) * (2 / 3 - t) * 6;
  7164. }
  7165. return p2;
  7166. }
  7167. function hslToRgb(h2, s2, l2) {
  7168. var r;
  7169. var g;
  7170. var b2;
  7171. h2 = bound01(h2, 360);
  7172. s2 = bound01(s2, 100);
  7173. l2 = bound01(l2, 100);
  7174. if (s2 === 0) {
  7175. g = l2;
  7176. b2 = l2;
  7177. r = l2;
  7178. } else {
  7179. var q = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
  7180. var p2 = 2 * l2 - q;
  7181. r = hue2rgb(p2, q, h2 + 1 / 3);
  7182. g = hue2rgb(p2, q, h2);
  7183. b2 = hue2rgb(p2, q, h2 - 1 / 3);
  7184. }
  7185. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7186. }
  7187. function rgbToHsv(r, g, b2) {
  7188. r = bound01(r, 255);
  7189. g = bound01(g, 255);
  7190. b2 = bound01(b2, 255);
  7191. var max2 = Math.max(r, g, b2);
  7192. var min2 = Math.min(r, g, b2);
  7193. var h2 = 0;
  7194. var v2 = max2;
  7195. var d2 = max2 - min2;
  7196. var s2 = max2 === 0 ? 0 : d2 / max2;
  7197. if (max2 === min2) {
  7198. h2 = 0;
  7199. } else {
  7200. switch (max2) {
  7201. case r:
  7202. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7203. break;
  7204. case g:
  7205. h2 = (b2 - r) / d2 + 2;
  7206. break;
  7207. case b2:
  7208. h2 = (r - g) / d2 + 4;
  7209. break;
  7210. }
  7211. h2 /= 6;
  7212. }
  7213. return { h: h2, s: s2, v: v2 };
  7214. }
  7215. function hsvToRgb(h2, s2, v2) {
  7216. h2 = bound01(h2, 360) * 6;
  7217. s2 = bound01(s2, 100);
  7218. v2 = bound01(v2, 100);
  7219. var i = Math.floor(h2);
  7220. var f = h2 - i;
  7221. var p2 = v2 * (1 - s2);
  7222. var q = v2 * (1 - f * s2);
  7223. var t = v2 * (1 - (1 - f) * s2);
  7224. var mod = i % 6;
  7225. var r = [v2, q, p2, p2, t, v2][mod];
  7226. var g = [t, v2, v2, q, p2, p2][mod];
  7227. var b2 = [p2, p2, t, v2, v2, q][mod];
  7228. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7229. }
  7230. function rgbToHex(r, g, b2, allow3Char) {
  7231. var hex2 = [
  7232. pad2(Math.round(r).toString(16)),
  7233. pad2(Math.round(g).toString(16)),
  7234. pad2(Math.round(b2).toString(16))
  7235. ];
  7236. if (allow3Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1))) {
  7237. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0);
  7238. }
  7239. return hex2.join("");
  7240. }
  7241. function rgbaToHex(r, g, b2, a2, allow4Char) {
  7242. var hex2 = [
  7243. pad2(Math.round(r).toString(16)),
  7244. pad2(Math.round(g).toString(16)),
  7245. pad2(Math.round(b2).toString(16)),
  7246. pad2(convertDecimalToHex(a2))
  7247. ];
  7248. 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))) {
  7249. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0);
  7250. }
  7251. return hex2.join("");
  7252. }
  7253. function convertDecimalToHex(d2) {
  7254. return Math.round(parseFloat(d2) * 255).toString(16);
  7255. }
  7256. function convertHexToDecimal(h2) {
  7257. return parseIntFromHex(h2) / 255;
  7258. }
  7259. function parseIntFromHex(val) {
  7260. return parseInt(val, 16);
  7261. }
  7262. function numberInputToObject(color) {
  7263. return {
  7264. r: color >> 16,
  7265. g: (color & 65280) >> 8,
  7266. b: color & 255
  7267. };
  7268. }
  7269. var names = {
  7270. aliceblue: "#f0f8ff",
  7271. antiquewhite: "#faebd7",
  7272. aqua: "#00ffff",
  7273. aquamarine: "#7fffd4",
  7274. azure: "#f0ffff",
  7275. beige: "#f5f5dc",
  7276. bisque: "#ffe4c4",
  7277. black: "#000000",
  7278. blanchedalmond: "#ffebcd",
  7279. blue: "#0000ff",
  7280. blueviolet: "#8a2be2",
  7281. brown: "#a52a2a",
  7282. burlywood: "#deb887",
  7283. cadetblue: "#5f9ea0",
  7284. chartreuse: "#7fff00",
  7285. chocolate: "#d2691e",
  7286. coral: "#ff7f50",
  7287. cornflowerblue: "#6495ed",
  7288. cornsilk: "#fff8dc",
  7289. crimson: "#dc143c",
  7290. cyan: "#00ffff",
  7291. darkblue: "#00008b",
  7292. darkcyan: "#008b8b",
  7293. darkgoldenrod: "#b8860b",
  7294. darkgray: "#a9a9a9",
  7295. darkgreen: "#006400",
  7296. darkgrey: "#a9a9a9",
  7297. darkkhaki: "#bdb76b",
  7298. darkmagenta: "#8b008b",
  7299. darkolivegreen: "#556b2f",
  7300. darkorange: "#ff8c00",
  7301. darkorchid: "#9932cc",
  7302. darkred: "#8b0000",
  7303. darksalmon: "#e9967a",
  7304. darkseagreen: "#8fbc8f",
  7305. darkslateblue: "#483d8b",
  7306. darkslategray: "#2f4f4f",
  7307. darkslategrey: "#2f4f4f",
  7308. darkturquoise: "#00ced1",
  7309. darkviolet: "#9400d3",
  7310. deeppink: "#ff1493",
  7311. deepskyblue: "#00bfff",
  7312. dimgray: "#696969",
  7313. dimgrey: "#696969",
  7314. dodgerblue: "#1e90ff",
  7315. firebrick: "#b22222",
  7316. floralwhite: "#fffaf0",
  7317. forestgreen: "#228b22",
  7318. fuchsia: "#ff00ff",
  7319. gainsboro: "#dcdcdc",
  7320. ghostwhite: "#f8f8ff",
  7321. goldenrod: "#daa520",
  7322. gold: "#ffd700",
  7323. gray: "#808080",
  7324. green: "#008000",
  7325. greenyellow: "#adff2f",
  7326. grey: "#808080",
  7327. honeydew: "#f0fff0",
  7328. hotpink: "#ff69b4",
  7329. indianred: "#cd5c5c",
  7330. indigo: "#4b0082",
  7331. ivory: "#fffff0",
  7332. khaki: "#f0e68c",
  7333. lavenderblush: "#fff0f5",
  7334. lavender: "#e6e6fa",
  7335. lawngreen: "#7cfc00",
  7336. lemonchiffon: "#fffacd",
  7337. lightblue: "#add8e6",
  7338. lightcoral: "#f08080",
  7339. lightcyan: "#e0ffff",
  7340. lightgoldenrodyellow: "#fafad2",
  7341. lightgray: "#d3d3d3",
  7342. lightgreen: "#90ee90",
  7343. lightgrey: "#d3d3d3",
  7344. lightpink: "#ffb6c1",
  7345. lightsalmon: "#ffa07a",
  7346. lightseagreen: "#20b2aa",
  7347. lightskyblue: "#87cefa",
  7348. lightslategray: "#778899",
  7349. lightslategrey: "#778899",
  7350. lightsteelblue: "#b0c4de",
  7351. lightyellow: "#ffffe0",
  7352. lime: "#00ff00",
  7353. limegreen: "#32cd32",
  7354. linen: "#faf0e6",
  7355. magenta: "#ff00ff",
  7356. maroon: "#800000",
  7357. mediumaquamarine: "#66cdaa",
  7358. mediumblue: "#0000cd",
  7359. mediumorchid: "#ba55d3",
  7360. mediumpurple: "#9370db",
  7361. mediumseagreen: "#3cb371",
  7362. mediumslateblue: "#7b68ee",
  7363. mediumspringgreen: "#00fa9a",
  7364. mediumturquoise: "#48d1cc",
  7365. mediumvioletred: "#c71585",
  7366. midnightblue: "#191970",
  7367. mintcream: "#f5fffa",
  7368. mistyrose: "#ffe4e1",
  7369. moccasin: "#ffe4b5",
  7370. navajowhite: "#ffdead",
  7371. navy: "#000080",
  7372. oldlace: "#fdf5e6",
  7373. olive: "#808000",
  7374. olivedrab: "#6b8e23",
  7375. orange: "#ffa500",
  7376. orangered: "#ff4500",
  7377. orchid: "#da70d6",
  7378. palegoldenrod: "#eee8aa",
  7379. palegreen: "#98fb98",
  7380. paleturquoise: "#afeeee",
  7381. palevioletred: "#db7093",
  7382. papayawhip: "#ffefd5",
  7383. peachpuff: "#ffdab9",
  7384. peru: "#cd853f",
  7385. pink: "#ffc0cb",
  7386. plum: "#dda0dd",
  7387. powderblue: "#b0e0e6",
  7388. purple: "#800080",
  7389. rebeccapurple: "#663399",
  7390. red: "#ff0000",
  7391. rosybrown: "#bc8f8f",
  7392. royalblue: "#4169e1",
  7393. saddlebrown: "#8b4513",
  7394. salmon: "#fa8072",
  7395. sandybrown: "#f4a460",
  7396. seagreen: "#2e8b57",
  7397. seashell: "#fff5ee",
  7398. sienna: "#a0522d",
  7399. silver: "#c0c0c0",
  7400. skyblue: "#87ceeb",
  7401. slateblue: "#6a5acd",
  7402. slategray: "#708090",
  7403. slategrey: "#708090",
  7404. snow: "#fffafa",
  7405. springgreen: "#00ff7f",
  7406. steelblue: "#4682b4",
  7407. tan: "#d2b48c",
  7408. teal: "#008080",
  7409. thistle: "#d8bfd8",
  7410. tomato: "#ff6347",
  7411. turquoise: "#40e0d0",
  7412. violet: "#ee82ee",
  7413. wheat: "#f5deb3",
  7414. white: "#ffffff",
  7415. whitesmoke: "#f5f5f5",
  7416. yellow: "#ffff00",
  7417. yellowgreen: "#9acd32"
  7418. };
  7419. function inputToRGB(color) {
  7420. var rgb = { r: 0, g: 0, b: 0 };
  7421. var a2 = 1;
  7422. var s2 = null;
  7423. var v2 = null;
  7424. var l2 = null;
  7425. var ok = false;
  7426. var format2 = false;
  7427. if (typeof color === "string") {
  7428. color = stringInputToObject(color);
  7429. }
  7430. if (typeof color === "object") {
  7431. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  7432. rgb = rgbToRgb(color.r, color.g, color.b);
  7433. ok = true;
  7434. format2 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  7435. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  7436. s2 = convertToPercentage(color.s);
  7437. v2 = convertToPercentage(color.v);
  7438. rgb = hsvToRgb(color.h, s2, v2);
  7439. ok = true;
  7440. format2 = "hsv";
  7441. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  7442. s2 = convertToPercentage(color.s);
  7443. l2 = convertToPercentage(color.l);
  7444. rgb = hslToRgb(color.h, s2, l2);
  7445. ok = true;
  7446. format2 = "hsl";
  7447. }
  7448. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  7449. a2 = color.a;
  7450. }
  7451. }
  7452. a2 = boundAlpha(a2);
  7453. return {
  7454. ok,
  7455. format: color.format || format2,
  7456. r: Math.min(255, Math.max(rgb.r, 0)),
  7457. g: Math.min(255, Math.max(rgb.g, 0)),
  7458. b: Math.min(255, Math.max(rgb.b, 0)),
  7459. a: a2
  7460. };
  7461. }
  7462. var CSS_INTEGER = "[-\\+]?\\d+%?";
  7463. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  7464. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  7465. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7466. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7467. var matchers = {
  7468. CSS_UNIT: new RegExp(CSS_UNIT),
  7469. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  7470. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  7471. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  7472. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  7473. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  7474. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  7475. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7476. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  7477. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7478. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  7479. };
  7480. function stringInputToObject(color) {
  7481. color = color.trim().toLowerCase();
  7482. if (color.length === 0) {
  7483. return false;
  7484. }
  7485. var named = false;
  7486. if (names[color]) {
  7487. color = names[color];
  7488. named = true;
  7489. } else if (color === "transparent") {
  7490. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  7491. }
  7492. var match = matchers.rgb.exec(color);
  7493. if (match) {
  7494. return { r: match[1], g: match[2], b: match[3] };
  7495. }
  7496. match = matchers.rgba.exec(color);
  7497. if (match) {
  7498. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  7499. }
  7500. match = matchers.hsl.exec(color);
  7501. if (match) {
  7502. return { h: match[1], s: match[2], l: match[3] };
  7503. }
  7504. match = matchers.hsla.exec(color);
  7505. if (match) {
  7506. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  7507. }
  7508. match = matchers.hsv.exec(color);
  7509. if (match) {
  7510. return { h: match[1], s: match[2], v: match[3] };
  7511. }
  7512. match = matchers.hsva.exec(color);
  7513. if (match) {
  7514. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  7515. }
  7516. match = matchers.hex8.exec(color);
  7517. if (match) {
  7518. return {
  7519. r: parseIntFromHex(match[1]),
  7520. g: parseIntFromHex(match[2]),
  7521. b: parseIntFromHex(match[3]),
  7522. a: convertHexToDecimal(match[4]),
  7523. format: named ? "name" : "hex8"
  7524. };
  7525. }
  7526. match = matchers.hex6.exec(color);
  7527. if (match) {
  7528. return {
  7529. r: parseIntFromHex(match[1]),
  7530. g: parseIntFromHex(match[2]),
  7531. b: parseIntFromHex(match[3]),
  7532. format: named ? "name" : "hex"
  7533. };
  7534. }
  7535. match = matchers.hex4.exec(color);
  7536. if (match) {
  7537. return {
  7538. r: parseIntFromHex(match[1] + match[1]),
  7539. g: parseIntFromHex(match[2] + match[2]),
  7540. b: parseIntFromHex(match[3] + match[3]),
  7541. a: convertHexToDecimal(match[4] + match[4]),
  7542. format: named ? "name" : "hex8"
  7543. };
  7544. }
  7545. match = matchers.hex3.exec(color);
  7546. if (match) {
  7547. return {
  7548. r: parseIntFromHex(match[1] + match[1]),
  7549. g: parseIntFromHex(match[2] + match[2]),
  7550. b: parseIntFromHex(match[3] + match[3]),
  7551. format: named ? "name" : "hex"
  7552. };
  7553. }
  7554. return false;
  7555. }
  7556. function isValidCSSUnit(color) {
  7557. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  7558. }
  7559. var TinyColor = function() {
  7560. function TinyColor2(color, opts) {
  7561. if (color === void 0) {
  7562. color = "";
  7563. }
  7564. if (opts === void 0) {
  7565. opts = {};
  7566. }
  7567. var _a2;
  7568. if (color instanceof TinyColor2) {
  7569. return color;
  7570. }
  7571. if (typeof color === "number") {
  7572. color = numberInputToObject(color);
  7573. }
  7574. this.originalInput = color;
  7575. var rgb = inputToRGB(color);
  7576. this.originalInput = color;
  7577. this.r = rgb.r;
  7578. this.g = rgb.g;
  7579. this.b = rgb.b;
  7580. this.a = rgb.a;
  7581. this.roundA = Math.round(100 * this.a) / 100;
  7582. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  7583. this.gradientType = opts.gradientType;
  7584. if (this.r < 1) {
  7585. this.r = Math.round(this.r);
  7586. }
  7587. if (this.g < 1) {
  7588. this.g = Math.round(this.g);
  7589. }
  7590. if (this.b < 1) {
  7591. this.b = Math.round(this.b);
  7592. }
  7593. this.isValid = rgb.ok;
  7594. }
  7595. TinyColor2.prototype.isDark = function() {
  7596. return this.getBrightness() < 128;
  7597. };
  7598. TinyColor2.prototype.isLight = function() {
  7599. return !this.isDark();
  7600. };
  7601. TinyColor2.prototype.getBrightness = function() {
  7602. var rgb = this.toRgb();
  7603. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  7604. };
  7605. TinyColor2.prototype.getLuminance = function() {
  7606. var rgb = this.toRgb();
  7607. var R;
  7608. var G;
  7609. var B;
  7610. var RsRGB = rgb.r / 255;
  7611. var GsRGB = rgb.g / 255;
  7612. var BsRGB = rgb.b / 255;
  7613. if (RsRGB <= 0.03928) {
  7614. R = RsRGB / 12.92;
  7615. } else {
  7616. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  7617. }
  7618. if (GsRGB <= 0.03928) {
  7619. G = GsRGB / 12.92;
  7620. } else {
  7621. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  7622. }
  7623. if (BsRGB <= 0.03928) {
  7624. B = BsRGB / 12.92;
  7625. } else {
  7626. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  7627. }
  7628. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  7629. };
  7630. TinyColor2.prototype.getAlpha = function() {
  7631. return this.a;
  7632. };
  7633. TinyColor2.prototype.setAlpha = function(alpha) {
  7634. this.a = boundAlpha(alpha);
  7635. this.roundA = Math.round(100 * this.a) / 100;
  7636. return this;
  7637. };
  7638. TinyColor2.prototype.toHsv = function() {
  7639. var hsv = rgbToHsv(this.r, this.g, this.b);
  7640. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  7641. };
  7642. TinyColor2.prototype.toHsvString = function() {
  7643. var hsv = rgbToHsv(this.r, this.g, this.b);
  7644. var h2 = Math.round(hsv.h * 360);
  7645. var s2 = Math.round(hsv.s * 100);
  7646. var v2 = Math.round(hsv.v * 100);
  7647. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%)") : "hsva(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%, ").concat(this.roundA, ")");
  7648. };
  7649. TinyColor2.prototype.toHsl = function() {
  7650. var hsl = rgbToHsl(this.r, this.g, this.b);
  7651. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  7652. };
  7653. TinyColor2.prototype.toHslString = function() {
  7654. var hsl = rgbToHsl(this.r, this.g, this.b);
  7655. var h2 = Math.round(hsl.h * 360);
  7656. var s2 = Math.round(hsl.s * 100);
  7657. var l2 = Math.round(hsl.l * 100);
  7658. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%)") : "hsla(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%, ").concat(this.roundA, ")");
  7659. };
  7660. TinyColor2.prototype.toHex = function(allow3Char) {
  7661. if (allow3Char === void 0) {
  7662. allow3Char = false;
  7663. }
  7664. return rgbToHex(this.r, this.g, this.b, allow3Char);
  7665. };
  7666. TinyColor2.prototype.toHexString = function(allow3Char) {
  7667. if (allow3Char === void 0) {
  7668. allow3Char = false;
  7669. }
  7670. return "#" + this.toHex(allow3Char);
  7671. };
  7672. TinyColor2.prototype.toHex8 = function(allow4Char) {
  7673. if (allow4Char === void 0) {
  7674. allow4Char = false;
  7675. }
  7676. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  7677. };
  7678. TinyColor2.prototype.toHex8String = function(allow4Char) {
  7679. if (allow4Char === void 0) {
  7680. allow4Char = false;
  7681. }
  7682. return "#" + this.toHex8(allow4Char);
  7683. };
  7684. TinyColor2.prototype.toRgb = function() {
  7685. return {
  7686. r: Math.round(this.r),
  7687. g: Math.round(this.g),
  7688. b: Math.round(this.b),
  7689. a: this.a
  7690. };
  7691. };
  7692. TinyColor2.prototype.toRgbString = function() {
  7693. var r = Math.round(this.r);
  7694. var g = Math.round(this.g);
  7695. var b2 = Math.round(this.b);
  7696. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b2, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b2, ", ").concat(this.roundA, ")");
  7697. };
  7698. TinyColor2.prototype.toPercentageRgb = function() {
  7699. var fmt = function(x2) {
  7700. return "".concat(Math.round(bound01(x2, 255) * 100), "%");
  7701. };
  7702. return {
  7703. r: fmt(this.r),
  7704. g: fmt(this.g),
  7705. b: fmt(this.b),
  7706. a: this.a
  7707. };
  7708. };
  7709. TinyColor2.prototype.toPercentageRgbString = function() {
  7710. var rnd = function(x2) {
  7711. return Math.round(bound01(x2, 255) * 100);
  7712. };
  7713. 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, ")");
  7714. };
  7715. TinyColor2.prototype.toName = function() {
  7716. if (this.a === 0) {
  7717. return "transparent";
  7718. }
  7719. if (this.a < 1) {
  7720. return false;
  7721. }
  7722. var hex2 = "#" + rgbToHex(this.r, this.g, this.b, false);
  7723. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  7724. var _b2 = _a2[_i], key = _b2[0], value = _b2[1];
  7725. if (hex2 === value) {
  7726. return key;
  7727. }
  7728. }
  7729. return false;
  7730. };
  7731. TinyColor2.prototype.toString = function(format2) {
  7732. var formatSet = Boolean(format2);
  7733. format2 = format2 !== null && format2 !== void 0 ? format2 : this.format;
  7734. var formattedString = false;
  7735. var hasAlpha = this.a < 1 && this.a >= 0;
  7736. var needsAlphaFormat = !formatSet && hasAlpha && (format2.startsWith("hex") || format2 === "name");
  7737. if (needsAlphaFormat) {
  7738. if (format2 === "name" && this.a === 0) {
  7739. return this.toName();
  7740. }
  7741. return this.toRgbString();
  7742. }
  7743. if (format2 === "rgb") {
  7744. formattedString = this.toRgbString();
  7745. }
  7746. if (format2 === "prgb") {
  7747. formattedString = this.toPercentageRgbString();
  7748. }
  7749. if (format2 === "hex" || format2 === "hex6") {
  7750. formattedString = this.toHexString();
  7751. }
  7752. if (format2 === "hex3") {
  7753. formattedString = this.toHexString(true);
  7754. }
  7755. if (format2 === "hex4") {
  7756. formattedString = this.toHex8String(true);
  7757. }
  7758. if (format2 === "hex8") {
  7759. formattedString = this.toHex8String();
  7760. }
  7761. if (format2 === "name") {
  7762. formattedString = this.toName();
  7763. }
  7764. if (format2 === "hsl") {
  7765. formattedString = this.toHslString();
  7766. }
  7767. if (format2 === "hsv") {
  7768. formattedString = this.toHsvString();
  7769. }
  7770. return formattedString || this.toHexString();
  7771. };
  7772. TinyColor2.prototype.toNumber = function() {
  7773. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  7774. };
  7775. TinyColor2.prototype.clone = function() {
  7776. return new TinyColor2(this.toString());
  7777. };
  7778. TinyColor2.prototype.lighten = function(amount) {
  7779. if (amount === void 0) {
  7780. amount = 10;
  7781. }
  7782. var hsl = this.toHsl();
  7783. hsl.l += amount / 100;
  7784. hsl.l = clamp01(hsl.l);
  7785. return new TinyColor2(hsl);
  7786. };
  7787. TinyColor2.prototype.brighten = function(amount) {
  7788. if (amount === void 0) {
  7789. amount = 10;
  7790. }
  7791. var rgb = this.toRgb();
  7792. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  7793. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  7794. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  7795. return new TinyColor2(rgb);
  7796. };
  7797. TinyColor2.prototype.darken = function(amount) {
  7798. if (amount === void 0) {
  7799. amount = 10;
  7800. }
  7801. var hsl = this.toHsl();
  7802. hsl.l -= amount / 100;
  7803. hsl.l = clamp01(hsl.l);
  7804. return new TinyColor2(hsl);
  7805. };
  7806. TinyColor2.prototype.tint = function(amount) {
  7807. if (amount === void 0) {
  7808. amount = 10;
  7809. }
  7810. return this.mix("white", amount);
  7811. };
  7812. TinyColor2.prototype.shade = function(amount) {
  7813. if (amount === void 0) {
  7814. amount = 10;
  7815. }
  7816. return this.mix("black", amount);
  7817. };
  7818. TinyColor2.prototype.desaturate = function(amount) {
  7819. if (amount === void 0) {
  7820. amount = 10;
  7821. }
  7822. var hsl = this.toHsl();
  7823. hsl.s -= amount / 100;
  7824. hsl.s = clamp01(hsl.s);
  7825. return new TinyColor2(hsl);
  7826. };
  7827. TinyColor2.prototype.saturate = function(amount) {
  7828. if (amount === void 0) {
  7829. amount = 10;
  7830. }
  7831. var hsl = this.toHsl();
  7832. hsl.s += amount / 100;
  7833. hsl.s = clamp01(hsl.s);
  7834. return new TinyColor2(hsl);
  7835. };
  7836. TinyColor2.prototype.greyscale = function() {
  7837. return this.desaturate(100);
  7838. };
  7839. TinyColor2.prototype.spin = function(amount) {
  7840. var hsl = this.toHsl();
  7841. var hue = (hsl.h + amount) % 360;
  7842. hsl.h = hue < 0 ? 360 + hue : hue;
  7843. return new TinyColor2(hsl);
  7844. };
  7845. TinyColor2.prototype.mix = function(color, amount) {
  7846. if (amount === void 0) {
  7847. amount = 50;
  7848. }
  7849. var rgb1 = this.toRgb();
  7850. var rgb2 = new TinyColor2(color).toRgb();
  7851. var p2 = amount / 100;
  7852. var rgba = {
  7853. r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
  7854. g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
  7855. b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
  7856. a: (rgb2.a - rgb1.a) * p2 + rgb1.a
  7857. };
  7858. return new TinyColor2(rgba);
  7859. };
  7860. TinyColor2.prototype.analogous = function(results, slices) {
  7861. if (results === void 0) {
  7862. results = 6;
  7863. }
  7864. if (slices === void 0) {
  7865. slices = 30;
  7866. }
  7867. var hsl = this.toHsl();
  7868. var part = 360 / slices;
  7869. var ret = [this];
  7870. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  7871. hsl.h = (hsl.h + part) % 360;
  7872. ret.push(new TinyColor2(hsl));
  7873. }
  7874. return ret;
  7875. };
  7876. TinyColor2.prototype.complement = function() {
  7877. var hsl = this.toHsl();
  7878. hsl.h = (hsl.h + 180) % 360;
  7879. return new TinyColor2(hsl);
  7880. };
  7881. TinyColor2.prototype.monochromatic = function(results) {
  7882. if (results === void 0) {
  7883. results = 6;
  7884. }
  7885. var hsv = this.toHsv();
  7886. var h2 = hsv.h;
  7887. var s2 = hsv.s;
  7888. var v2 = hsv.v;
  7889. var res = [];
  7890. var modification = 1 / results;
  7891. while (results--) {
  7892. res.push(new TinyColor2({ h: h2, s: s2, v: v2 }));
  7893. v2 = (v2 + modification) % 1;
  7894. }
  7895. return res;
  7896. };
  7897. TinyColor2.prototype.splitcomplement = function() {
  7898. var hsl = this.toHsl();
  7899. var h2 = hsl.h;
  7900. return [
  7901. this,
  7902. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  7903. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  7904. ];
  7905. };
  7906. TinyColor2.prototype.onBackground = function(background) {
  7907. var fg = this.toRgb();
  7908. var bg = new TinyColor2(background).toRgb();
  7909. return new TinyColor2({
  7910. r: bg.r + (fg.r - bg.r) * fg.a,
  7911. g: bg.g + (fg.g - bg.g) * fg.a,
  7912. b: bg.b + (fg.b - bg.b) * fg.a
  7913. });
  7914. };
  7915. TinyColor2.prototype.triad = function() {
  7916. return this.polyad(3);
  7917. };
  7918. TinyColor2.prototype.tetrad = function() {
  7919. return this.polyad(4);
  7920. };
  7921. TinyColor2.prototype.polyad = function(n) {
  7922. var hsl = this.toHsl();
  7923. var h2 = hsl.h;
  7924. var result = [this];
  7925. var increment = 360 / n;
  7926. for (var i = 1; i < n; i++) {
  7927. result.push(new TinyColor2({ h: (h2 + i * increment) % 360, s: hsl.s, l: hsl.l }));
  7928. }
  7929. return result;
  7930. };
  7931. TinyColor2.prototype.equals = function(color) {
  7932. return this.toRgbString() === new TinyColor2(color).toRgbString();
  7933. };
  7934. return TinyColor2;
  7935. }();
  7936. function darken(color, amount = 20) {
  7937. return color.mix("#141414", amount).toString();
  7938. }
  7939. function useButtonCustomStyle(props) {
  7940. const _disabled = useDisabled$1();
  7941. return computed(() => {
  7942. let styles = {};
  7943. const buttonColor = props.color;
  7944. if (buttonColor) {
  7945. const color = new TinyColor(buttonColor);
  7946. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  7947. if (props.plain) {
  7948. styles = {
  7949. "--el-button-bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  7950. "--el-button-text-color": buttonColor,
  7951. "--el-button-border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  7952. "--el-button-hover-text-color": "var(--el-color-white)",
  7953. "--el-button-hover-bg-color": buttonColor,
  7954. "--el-button-hover-border-color": buttonColor,
  7955. "--el-button-active-bg-color": activeBgColor,
  7956. "--el-button-active-text-color": "var(--el-color-white)",
  7957. "--el-button-active-border-color": activeBgColor
  7958. };
  7959. if (_disabled.value) {
  7960. styles["--el-button-disabled-bg-color"] = props.dark ? darken(color, 90) : color.tint(90).toString();
  7961. styles["--el-button-disabled-text-color"] = props.dark ? darken(color, 50) : color.tint(50).toString();
  7962. styles["--el-button-disabled-border-color"] = props.dark ? darken(color, 80) : color.tint(80).toString();
  7963. }
  7964. } else {
  7965. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  7966. const textColor = color.isDark() ? "var(--el-color-white)" : "var(--el-color-black)";
  7967. styles = {
  7968. "--el-button-bg-color": buttonColor,
  7969. "--el-button-text-color": textColor,
  7970. "--el-button-border-color": buttonColor,
  7971. "--el-button-hover-bg-color": hoverBgColor,
  7972. "--el-button-hover-text-color": textColor,
  7973. "--el-button-hover-border-color": hoverBgColor,
  7974. "--el-button-active-bg-color": activeBgColor,
  7975. "--el-button-active-border-color": activeBgColor
  7976. };
  7977. if (_disabled.value) {
  7978. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  7979. styles["--el-button-disabled-bg-color"] = disabledButtonColor;
  7980. styles["--el-button-disabled-text-color"] = props.dark ? "rgba(255, 255, 255, 0.5)" : "var(--el-color-white)";
  7981. styles["--el-button-disabled-border-color"] = disabledButtonColor;
  7982. }
  7983. }
  7984. }
  7985. return styles;
  7986. });
  7987. }
  7988. const _hoisted_1$A = ["disabled", "autofocus", "type"];
  7989. const __default__$f = {
  7990. name: "ElButton"
  7991. };
  7992. const _sfc_main$U = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$f), {
  7993. props: buttonProps,
  7994. emits: buttonEmits,
  7995. setup(__props, { expose, emit }) {
  7996. const props = __props;
  7997. const slots = useSlots();
  7998. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  7999. const globalConfig2 = useGlobalConfig("button");
  8000. const ns = useNamespace("button");
  8001. const { form } = useFormItem();
  8002. const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  8003. const _disabled = useDisabled$1();
  8004. const _ref = ref();
  8005. const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  8006. const autoInsertSpace = computed(() => {
  8007. var _a2, _b2, _c;
  8008. return (_c = (_b2 = props.autoInsertSpace) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  8009. });
  8010. const shouldAddSpace = computed(() => {
  8011. var _a2;
  8012. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  8013. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  8014. const slot = defaultSlot[0];
  8015. if ((slot == null ? void 0 : slot.type) === Text) {
  8016. const text = slot.children;
  8017. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  8018. }
  8019. }
  8020. return false;
  8021. });
  8022. const buttonStyle = useButtonCustomStyle(props);
  8023. const handleClick = (evt) => {
  8024. if (props.nativeType === "reset") {
  8025. form == null ? void 0 : form.resetFields();
  8026. }
  8027. emit("click", evt);
  8028. };
  8029. expose({
  8030. ref: _ref,
  8031. size: _size,
  8032. type: _type,
  8033. disabled: _disabled,
  8034. shouldAddSpace
  8035. });
  8036. return (_ctx, _cache) => {
  8037. return openBlock(), createElementBlock("button", {
  8038. ref_key: "_ref",
  8039. ref: _ref,
  8040. class: normalizeClass([
  8041. unref(ns).b(),
  8042. unref(ns).m(unref(_type)),
  8043. unref(ns).m(unref(_size)),
  8044. unref(ns).is("disabled", unref(_disabled)),
  8045. unref(ns).is("loading", _ctx.loading),
  8046. unref(ns).is("plain", _ctx.plain),
  8047. unref(ns).is("round", _ctx.round),
  8048. unref(ns).is("circle", _ctx.circle)
  8049. ]),
  8050. disabled: unref(_disabled) || _ctx.loading,
  8051. autofocus: _ctx.autofocus,
  8052. type: _ctx.nativeType,
  8053. style: normalizeStyle(unref(buttonStyle)),
  8054. onClick: handleClick
  8055. }, [
  8056. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  8057. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  8058. key: 1,
  8059. class: normalizeClass(unref(ns).is("loading"))
  8060. }, {
  8061. default: withCtx(() => [
  8062. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  8063. ]),
  8064. _: 1
  8065. }, 8, ["class"]))
  8066. ], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  8067. default: withCtx(() => [
  8068. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  8069. ]),
  8070. _: 3
  8071. })) : createCommentVNode("v-if", true),
  8072. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  8073. key: 2,
  8074. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  8075. }, [
  8076. renderSlot(_ctx.$slots, "default")
  8077. ], 2)) : createCommentVNode("v-if", true)
  8078. ], 14, _hoisted_1$A);
  8079. };
  8080. }
  8081. }));
  8082. var Button = /* @__PURE__ */ _export_sfc$1(_sfc_main$U, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
  8083. const buttonGroupProps = {
  8084. size: buttonProps.size,
  8085. type: buttonProps.type
  8086. };
  8087. const __default__$e = {
  8088. name: "ElButtonGroup"
  8089. };
  8090. const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$e), {
  8091. props: buttonGroupProps,
  8092. setup(__props) {
  8093. const props = __props;
  8094. provide(buttonGroupContextKey, reactive({
  8095. size: toRef(props, "size"),
  8096. type: toRef(props, "type")
  8097. }));
  8098. const ns = useNamespace("button");
  8099. return (_ctx, _cache) => {
  8100. return openBlock(), createElementBlock("div", {
  8101. class: normalizeClass(`${unref(ns).b("group")}`)
  8102. }, [
  8103. renderSlot(_ctx.$slots, "default")
  8104. ], 2);
  8105. };
  8106. }
  8107. }));
  8108. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$T, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
  8109. const ElButton = withInstall(Button, {
  8110. ButtonGroup
  8111. });
  8112. withNoopInstall(ButtonGroup);
  8113. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  8114. var dayjs_min = { exports: {} };
  8115. (function(module2, exports2) {
  8116. !function(t, e) {
  8117. module2.exports = e();
  8118. }(commonjsGlobal, function() {
  8119. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", f = "month", h2 = "quarter", c = "year", d2 = "date", $ = "Invalid Date", l2 = /^(\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("_") }, m2 = function(t2, e2, n2) {
  8120. var r2 = String(t2);
  8121. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  8122. }, g = { s: m2, z: function(t2) {
  8123. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  8124. return (e2 <= 0 ? "+" : "-") + m2(r2, 2, "0") + ":" + m2(i2, 2, "0");
  8125. }, m: function t2(e2, n2) {
  8126. if (e2.date() < n2.date())
  8127. return -t2(n2, e2);
  8128. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s3 = n2 - i2 < 0, u3 = e2.clone().add(r2 + (s3 ? -1 : 1), f);
  8129. return +(-(r2 + (n2 - i2) / (s3 ? i2 - u3 : u3 - i2)) || 0);
  8130. }, a: function(t2) {
  8131. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  8132. }, p: function(t2) {
  8133. return { M: f, y: c, w: o2, d: a2, D: d2, h: u2, m: s2, s: i, ms: r, Q: h2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  8134. }, u: function(t2) {
  8135. return t2 === void 0;
  8136. } }, v2 = "en", D2 = {};
  8137. D2[v2] = M2;
  8138. var p2 = function(t2) {
  8139. return t2 instanceof _2;
  8140. }, S2 = function t2(e2, n2, r2) {
  8141. var i2;
  8142. if (!e2)
  8143. return v2;
  8144. if (typeof e2 == "string") {
  8145. var s3 = e2.toLowerCase();
  8146. D2[s3] && (i2 = s3), n2 && (D2[s3] = n2, i2 = s3);
  8147. var u3 = e2.split("-");
  8148. if (!i2 && u3.length > 1)
  8149. return t2(u3[0]);
  8150. } else {
  8151. var a3 = e2.name;
  8152. D2[a3] = e2, i2 = a3;
  8153. }
  8154. return !r2 && i2 && (v2 = i2), i2 || !r2 && v2;
  8155. }, w2 = function(t2, e2) {
  8156. if (p2(t2))
  8157. return t2.clone();
  8158. var n2 = typeof e2 == "object" ? e2 : {};
  8159. return n2.date = t2, n2.args = arguments, new _2(n2);
  8160. }, O2 = g;
  8161. O2.l = S2, O2.i = p2, O2.w = function(t2, e2) {
  8162. return w2(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  8163. };
  8164. var _2 = function() {
  8165. function M3(t2) {
  8166. this.$L = S2(t2.locale, null, true), this.parse(t2);
  8167. }
  8168. var m3 = M3.prototype;
  8169. return m3.parse = function(t2) {
  8170. this.$d = function(t3) {
  8171. var e2 = t3.date, n2 = t3.utc;
  8172. if (e2 === null)
  8173. return new Date(NaN);
  8174. if (O2.u(e2))
  8175. return new Date();
  8176. if (e2 instanceof Date)
  8177. return new Date(e2);
  8178. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  8179. var r2 = e2.match(l2);
  8180. if (r2) {
  8181. var i2 = r2[2] - 1 || 0, s3 = (r2[7] || "0").substring(0, 3);
  8182. 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);
  8183. }
  8184. }
  8185. return new Date(e2);
  8186. }(t2), this.$x = t2.x || {}, this.init();
  8187. }, m3.init = function() {
  8188. var t2 = this.$d;
  8189. 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();
  8190. }, m3.$utils = function() {
  8191. return O2;
  8192. }, m3.isValid = function() {
  8193. return !(this.$d.toString() === $);
  8194. }, m3.isSame = function(t2, e2) {
  8195. var n2 = w2(t2);
  8196. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  8197. }, m3.isAfter = function(t2, e2) {
  8198. return w2(t2) < this.startOf(e2);
  8199. }, m3.isBefore = function(t2, e2) {
  8200. return this.endOf(e2) < w2(t2);
  8201. }, m3.$g = function(t2, e2, n2) {
  8202. return O2.u(t2) ? this[e2] : this.set(n2, t2);
  8203. }, m3.unix = function() {
  8204. return Math.floor(this.valueOf() / 1e3);
  8205. }, m3.valueOf = function() {
  8206. return this.$d.getTime();
  8207. }, m3.startOf = function(t2, e2) {
  8208. var n2 = this, r2 = !!O2.u(e2) || e2, h3 = O2.p(t2), $2 = function(t3, e3) {
  8209. var i2 = O2.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  8210. return r2 ? i2 : i2.endOf(a2);
  8211. }, l3 = function(t3, e3) {
  8212. return O2.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  8213. }, y2 = this.$W, M4 = this.$M, m4 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
  8214. switch (h3) {
  8215. case c:
  8216. return r2 ? $2(1, 0) : $2(31, 11);
  8217. case f:
  8218. return r2 ? $2(1, M4) : $2(0, M4 + 1);
  8219. case o2:
  8220. var v3 = this.$locale().weekStart || 0, D3 = (y2 < v3 ? y2 + 7 : y2) - v3;
  8221. return $2(r2 ? m4 - D3 : m4 + (6 - D3), M4);
  8222. case a2:
  8223. case d2:
  8224. return l3(g2 + "Hours", 0);
  8225. case u2:
  8226. return l3(g2 + "Minutes", 1);
  8227. case s2:
  8228. return l3(g2 + "Seconds", 2);
  8229. case i:
  8230. return l3(g2 + "Milliseconds", 3);
  8231. default:
  8232. return this.clone();
  8233. }
  8234. }, m3.endOf = function(t2) {
  8235. return this.startOf(t2, false);
  8236. }, m3.$set = function(t2, e2) {
  8237. var n2, o3 = O2.p(t2), h3 = "set" + (this.$u ? "UTC" : ""), $2 = (n2 = {}, n2[a2] = h3 + "Date", n2[d2] = h3 + "Date", n2[f] = h3 + "Month", n2[c] = h3 + "FullYear", n2[u2] = h3 + "Hours", n2[s2] = h3 + "Minutes", n2[i] = h3 + "Seconds", n2[r] = h3 + "Milliseconds", n2)[o3], l3 = o3 === a2 ? this.$D + (e2 - this.$W) : e2;
  8238. if (o3 === f || o3 === c) {
  8239. var y2 = this.clone().set(d2, 1);
  8240. y2.$d[$2](l3), y2.init(), this.$d = y2.set(d2, Math.min(this.$D, y2.daysInMonth())).$d;
  8241. } else
  8242. $2 && this.$d[$2](l3);
  8243. return this.init(), this;
  8244. }, m3.set = function(t2, e2) {
  8245. return this.clone().$set(t2, e2);
  8246. }, m3.get = function(t2) {
  8247. return this[O2.p(t2)]();
  8248. }, m3.add = function(r2, h3) {
  8249. var d3, $2 = this;
  8250. r2 = Number(r2);
  8251. var l3 = O2.p(h3), y2 = function(t2) {
  8252. var e2 = w2($2);
  8253. return O2.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
  8254. };
  8255. if (l3 === f)
  8256. return this.set(f, this.$M + r2);
  8257. if (l3 === c)
  8258. return this.set(c, this.$y + r2);
  8259. if (l3 === a2)
  8260. return y2(1);
  8261. if (l3 === o2)
  8262. return y2(7);
  8263. var M4 = (d3 = {}, d3[s2] = e, d3[u2] = n, d3[i] = t, d3)[l3] || 1, m4 = this.$d.getTime() + r2 * M4;
  8264. return O2.w(m4, this);
  8265. }, m3.subtract = function(t2, e2) {
  8266. return this.add(-1 * t2, e2);
  8267. }, m3.format = function(t2) {
  8268. var e2 = this, n2 = this.$locale();
  8269. if (!this.isValid())
  8270. return n2.invalidDate || $;
  8271. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n2.weekdays, f2 = n2.months, h3 = function(t3, n3, i3, s4) {
  8272. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s4);
  8273. }, c2 = function(t3) {
  8274. return O2.s(s3 % 12 || 12, t3, "0");
  8275. }, d3 = n2.meridiem || function(t3, e3, n3) {
  8276. var r3 = t3 < 12 ? "AM" : "PM";
  8277. return n3 ? r3.toLowerCase() : r3;
  8278. }, l3 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a3 + 1, MM: O2.s(a3 + 1, 2, "0"), MMM: h3(n2.monthsShort, a3, f2, 3), MMMM: h3(f2, a3), D: this.$D, DD: O2.s(this.$D, 2, "0"), d: String(this.$W), dd: h3(n2.weekdaysMin, this.$W, o3, 2), ddd: h3(n2.weekdaysShort, this.$W, o3, 3), dddd: o3[this.$W], H: String(s3), HH: O2.s(s3, 2, "0"), h: c2(1), hh: c2(2), a: d3(s3, u3, true), A: d3(s3, u3, false), m: String(u3), mm: O2.s(u3, 2, "0"), s: String(this.$s), ss: O2.s(this.$s, 2, "0"), SSS: O2.s(this.$ms, 3, "0"), Z: i2 };
  8279. return r2.replace(y, function(t3, e3) {
  8280. return e3 || l3[t3] || i2.replace(":", "");
  8281. });
  8282. }, m3.utcOffset = function() {
  8283. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  8284. }, m3.diff = function(r2, d3, $2) {
  8285. var l3, y2 = O2.p(d3), M4 = w2(r2), m4 = (M4.utcOffset() - this.utcOffset()) * e, g2 = this - M4, v3 = O2.m(this, M4);
  8286. return v3 = (l3 = {}, l3[c] = v3 / 12, l3[f] = v3, l3[h2] = v3 / 3, l3[o2] = (g2 - m4) / 6048e5, l3[a2] = (g2 - m4) / 864e5, l3[u2] = g2 / n, l3[s2] = g2 / e, l3[i] = g2 / t, l3)[y2] || g2, $2 ? v3 : O2.a(v3);
  8287. }, m3.daysInMonth = function() {
  8288. return this.endOf(f).$D;
  8289. }, m3.$locale = function() {
  8290. return D2[this.$L];
  8291. }, m3.locale = function(t2, e2) {
  8292. if (!t2)
  8293. return this.$L;
  8294. var n2 = this.clone(), r2 = S2(t2, e2, true);
  8295. return r2 && (n2.$L = r2), n2;
  8296. }, m3.clone = function() {
  8297. return O2.w(this.$d, this);
  8298. }, m3.toDate = function() {
  8299. return new Date(this.valueOf());
  8300. }, m3.toJSON = function() {
  8301. return this.isValid() ? this.toISOString() : null;
  8302. }, m3.toISOString = function() {
  8303. return this.$d.toISOString();
  8304. }, m3.toString = function() {
  8305. return this.$d.toUTCString();
  8306. }, M3;
  8307. }(), T2 = _2.prototype;
  8308. return w2.prototype = T2, [["$ms", r], ["$s", i], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", f], ["$y", c], ["$D", d2]].forEach(function(t2) {
  8309. T2[t2[1]] = function(e2) {
  8310. return this.$g(e2, t2[0], t2[1]);
  8311. };
  8312. }), w2.extend = function(t2, e2) {
  8313. return t2.$i || (t2(e2, _2, w2), t2.$i = true), w2;
  8314. }, w2.locale = S2, w2.isDayjs = p2, w2.unix = function(t2) {
  8315. return w2(1e3 * t2);
  8316. }, w2.en = D2[v2], w2.Ls = D2, w2.p = {}, w2;
  8317. });
  8318. })(dayjs_min);
  8319. var dayjs = dayjs_min.exports;
  8320. var localeData$1 = { exports: {} };
  8321. (function(module2, exports2) {
  8322. !function(n, e) {
  8323. module2.exports = e();
  8324. }(commonjsGlobal, function() {
  8325. return function(n, e, t) {
  8326. var r = e.prototype, o2 = function(n2) {
  8327. return n2 && (n2.indexOf ? n2 : n2.s);
  8328. }, u2 = function(n2, e2, t2, r2, u3) {
  8329. var i2 = n2.name ? n2 : n2.$locale(), a3 = o2(i2[e2]), s3 = o2(i2[t2]), f = a3 || s3.map(function(n3) {
  8330. return n3.slice(0, r2);
  8331. });
  8332. if (!u3)
  8333. return f;
  8334. var d2 = i2.weekStart;
  8335. return f.map(function(n3, e3) {
  8336. return f[(e3 + (d2 || 0)) % 7];
  8337. });
  8338. }, i = function() {
  8339. return t.Ls[t.locale()];
  8340. }, a2 = function(n2, e2) {
  8341. return n2.formats[e2] || function(n3) {
  8342. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  8343. return e3 || t2.slice(1);
  8344. });
  8345. }(n2.formats[e2.toUpperCase()]);
  8346. }, s2 = function() {
  8347. var n2 = this;
  8348. return { months: function(e2) {
  8349. return e2 ? e2.format("MMMM") : u2(n2, "months");
  8350. }, monthsShort: function(e2) {
  8351. return e2 ? e2.format("MMM") : u2(n2, "monthsShort", "months", 3);
  8352. }, firstDayOfWeek: function() {
  8353. return n2.$locale().weekStart || 0;
  8354. }, weekdays: function(e2) {
  8355. return e2 ? e2.format("dddd") : u2(n2, "weekdays");
  8356. }, weekdaysMin: function(e2) {
  8357. return e2 ? e2.format("dd") : u2(n2, "weekdaysMin", "weekdays", 2);
  8358. }, weekdaysShort: function(e2) {
  8359. return e2 ? e2.format("ddd") : u2(n2, "weekdaysShort", "weekdays", 3);
  8360. }, longDateFormat: function(e2) {
  8361. return a2(n2.$locale(), e2);
  8362. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  8363. };
  8364. r.localeData = function() {
  8365. return s2.bind(this)();
  8366. }, t.localeData = function() {
  8367. var n2 = i();
  8368. return { firstDayOfWeek: function() {
  8369. return n2.weekStart || 0;
  8370. }, weekdays: function() {
  8371. return t.weekdays();
  8372. }, weekdaysShort: function() {
  8373. return t.weekdaysShort();
  8374. }, weekdaysMin: function() {
  8375. return t.weekdaysMin();
  8376. }, months: function() {
  8377. return t.months();
  8378. }, monthsShort: function() {
  8379. return t.monthsShort();
  8380. }, longDateFormat: function(e2) {
  8381. return a2(n2, e2);
  8382. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  8383. }, t.months = function() {
  8384. return u2(i(), "months");
  8385. }, t.monthsShort = function() {
  8386. return u2(i(), "monthsShort", "months", 3);
  8387. }, t.weekdays = function(n2) {
  8388. return u2(i(), "weekdays", null, null, n2);
  8389. }, t.weekdaysShort = function(n2) {
  8390. return u2(i(), "weekdaysShort", "weekdays", 3, n2);
  8391. }, t.weekdaysMin = function(n2) {
  8392. return u2(i(), "weekdaysMin", "weekdays", 2, n2);
  8393. };
  8394. };
  8395. });
  8396. })(localeData$1);
  8397. var localeData = localeData$1.exports;
  8398. var customParseFormat$1 = { exports: {} };
  8399. (function(module2, exports2) {
  8400. !function(e, t) {
  8401. module2.exports = t();
  8402. }(commonjsGlobal, function() {
  8403. 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|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d\d/, r = /\d\d?/, i = /\d*[^\s\d-_:/()]+/, o2 = {}, s2 = function(e2) {
  8404. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  8405. };
  8406. var a2 = function(e2) {
  8407. return function(t2) {
  8408. this[e2] = +t2;
  8409. };
  8410. }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  8411. (this.zone || (this.zone = {})).offset = function(e3) {
  8412. if (!e3)
  8413. return 0;
  8414. if (e3 === "Z")
  8415. return 0;
  8416. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  8417. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  8418. }(e2);
  8419. }], h2 = function(e2) {
  8420. var t2 = o2[e2];
  8421. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  8422. }, u2 = function(e2, t2) {
  8423. var n2, r2 = o2.meridiem;
  8424. if (r2) {
  8425. for (var i2 = 1; i2 <= 24; i2 += 1)
  8426. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  8427. n2 = i2 > 12;
  8428. break;
  8429. }
  8430. } else
  8431. n2 = e2 === (t2 ? "pm" : "PM");
  8432. return n2;
  8433. }, d2 = { A: [i, function(e2) {
  8434. this.afternoon = u2(e2, false);
  8435. }], a: [i, function(e2) {
  8436. this.afternoon = u2(e2, true);
  8437. }], S: [/\d/, function(e2) {
  8438. this.milliseconds = 100 * +e2;
  8439. }], SS: [n, function(e2) {
  8440. this.milliseconds = 10 * +e2;
  8441. }], SSS: [/\d{3}/, function(e2) {
  8442. this.milliseconds = +e2;
  8443. }], s: [r, a2("seconds")], ss: [r, a2("seconds")], m: [r, a2("minutes")], mm: [r, a2("minutes")], H: [r, a2("hours")], h: [r, a2("hours")], HH: [r, a2("hours")], hh: [r, a2("hours")], D: [r, a2("day")], DD: [n, a2("day")], Do: [i, function(e2) {
  8444. var t2 = o2.ordinal, n2 = e2.match(/\d+/);
  8445. if (this.day = n2[0], t2)
  8446. for (var r2 = 1; r2 <= 31; r2 += 1)
  8447. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  8448. }], M: [r, a2("month")], MM: [n, a2("month")], MMM: [i, function(e2) {
  8449. var t2 = h2("months"), n2 = (h2("monthsShort") || t2.map(function(e3) {
  8450. return e3.slice(0, 3);
  8451. })).indexOf(e2) + 1;
  8452. if (n2 < 1)
  8453. throw new Error();
  8454. this.month = n2 % 12 || n2;
  8455. }], MMMM: [i, function(e2) {
  8456. var t2 = h2("months").indexOf(e2) + 1;
  8457. if (t2 < 1)
  8458. throw new Error();
  8459. this.month = t2 % 12 || t2;
  8460. }], Y: [/[+-]?\d+/, a2("year")], YY: [n, function(e2) {
  8461. this.year = s2(e2);
  8462. }], YYYY: [/\d{4}/, a2("year")], Z: f, ZZ: f };
  8463. function c(n2) {
  8464. var r2, i2;
  8465. r2 = n2, i2 = o2 && o2.formats;
  8466. for (var s3 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  8467. var o3 = r3 && r3.toUpperCase();
  8468. return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  8469. return t3 || n4.slice(1);
  8470. });
  8471. })).match(t), a3 = s3.length, f2 = 0; f2 < a3; f2 += 1) {
  8472. var h3 = s3[f2], u3 = d2[h3], c2 = u3 && u3[0], l2 = u3 && u3[1];
  8473. s3[f2] = l2 ? { regex: c2, parser: l2 } : h3.replace(/^\[|\]$/g, "");
  8474. }
  8475. return function(e2) {
  8476. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a3; n3 += 1) {
  8477. var i3 = s3[n3];
  8478. if (typeof i3 == "string")
  8479. r3 += i3.length;
  8480. else {
  8481. var o3 = i3.regex, f3 = i3.parser, h4 = e2.slice(r3), u4 = o3.exec(h4)[0];
  8482. f3.call(t2, u4), e2 = e2.replace(u4, "");
  8483. }
  8484. }
  8485. return function(e3) {
  8486. var t3 = e3.afternoon;
  8487. if (t3 !== void 0) {
  8488. var n4 = e3.hours;
  8489. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  8490. }
  8491. }(t2), t2;
  8492. };
  8493. }
  8494. return function(e2, t2, n2) {
  8495. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s2 = e2.parseTwoDigitYear);
  8496. var r2 = t2.prototype, i2 = r2.parse;
  8497. r2.parse = function(e3) {
  8498. var t3 = e3.date, r3 = e3.utc, s3 = e3.args;
  8499. this.$u = r3;
  8500. var a3 = s3[1];
  8501. if (typeof a3 == "string") {
  8502. var f2 = s3[2] === true, h3 = s3[3] === true, u3 = f2 || h3, d3 = s3[2];
  8503. h3 && (d3 = s3[2]), o2 = this.$locale(), !f2 && d3 && (o2 = n2.Ls[d3]), this.$d = function(e4, t4, n3) {
  8504. try {
  8505. if (["x", "X"].indexOf(t4) > -1)
  8506. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  8507. var r4 = c(t4)(e4), i3 = r4.year, o3 = r4.month, s4 = r4.day, a4 = r4.hours, f3 = r4.minutes, h4 = r4.seconds, u4 = r4.milliseconds, d4 = r4.zone, l3 = new Date(), m3 = s4 || (i3 || o3 ? 1 : l3.getDate()), M3 = i3 || l3.getFullYear(), Y2 = 0;
  8508. i3 && !o3 || (Y2 = o3 > 0 ? o3 - 1 : l3.getMonth());
  8509. var p2 = a4 || 0, v2 = f3 || 0, D2 = h4 || 0, g = u4 || 0;
  8510. return d4 ? new Date(Date.UTC(M3, Y2, m3, p2, v2, D2, g + 60 * d4.offset * 1e3)) : n3 ? new Date(Date.UTC(M3, Y2, m3, p2, v2, D2, g)) : new Date(M3, Y2, m3, p2, v2, D2, g);
  8511. } catch (e5) {
  8512. return new Date("");
  8513. }
  8514. }(t3, a3, r3), this.init(), d3 && d3 !== true && (this.$L = this.locale(d3).$L), u3 && t3 != this.format(a3) && (this.$d = new Date("")), o2 = {};
  8515. } else if (a3 instanceof Array)
  8516. for (var l2 = a3.length, m2 = 1; m2 <= l2; m2 += 1) {
  8517. s3[1] = a3[m2 - 1];
  8518. var M2 = n2.apply(this, s3);
  8519. if (M2.isValid()) {
  8520. this.$d = M2.$d, this.$L = M2.$L, this.init();
  8521. break;
  8522. }
  8523. m2 === l2 && (this.$d = new Date(""));
  8524. }
  8525. else
  8526. i2.call(this, e3);
  8527. };
  8528. };
  8529. });
  8530. })(customParseFormat$1);
  8531. var customParseFormat = customParseFormat$1.exports;
  8532. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  8533. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  8534. const DEFAULT_FORMATS_DATEPICKER = {
  8535. date: DEFAULT_FORMATS_DATE,
  8536. week: "gggg[w]ww",
  8537. year: "YYYY",
  8538. month: "YYYY-MM",
  8539. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  8540. monthrange: "YYYY-MM",
  8541. daterange: DEFAULT_FORMATS_DATE,
  8542. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  8543. };
  8544. const timePickerDefaultProps = {
  8545. id: {
  8546. type: [Array, String]
  8547. },
  8548. name: {
  8549. type: [Array, String],
  8550. default: ""
  8551. },
  8552. popperClass: {
  8553. type: String,
  8554. default: ""
  8555. },
  8556. format: {
  8557. type: String
  8558. },
  8559. valueFormat: {
  8560. type: String
  8561. },
  8562. type: {
  8563. type: String,
  8564. default: ""
  8565. },
  8566. clearable: {
  8567. type: Boolean,
  8568. default: true
  8569. },
  8570. clearIcon: {
  8571. type: [String, Object],
  8572. default: circleClose
  8573. },
  8574. editable: {
  8575. type: Boolean,
  8576. default: true
  8577. },
  8578. prefixIcon: {
  8579. type: [String, Object],
  8580. default: ""
  8581. },
  8582. size: {
  8583. type: String,
  8584. validator: isValidComponentSize
  8585. },
  8586. readonly: {
  8587. type: Boolean,
  8588. default: false
  8589. },
  8590. disabled: {
  8591. type: Boolean,
  8592. default: false
  8593. },
  8594. placeholder: {
  8595. type: String,
  8596. default: ""
  8597. },
  8598. popperOptions: {
  8599. type: Object,
  8600. default: () => ({})
  8601. },
  8602. modelValue: {
  8603. type: [Date, Array, String, Number],
  8604. default: ""
  8605. },
  8606. rangeSeparator: {
  8607. type: String,
  8608. default: "-"
  8609. },
  8610. startPlaceholder: String,
  8611. endPlaceholder: String,
  8612. defaultValue: {
  8613. type: [Date, Array]
  8614. },
  8615. defaultTime: {
  8616. type: [Date, Array]
  8617. },
  8618. isRange: {
  8619. type: Boolean,
  8620. default: false
  8621. },
  8622. disabledHours: {
  8623. type: Function
  8624. },
  8625. disabledMinutes: {
  8626. type: Function
  8627. },
  8628. disabledSeconds: {
  8629. type: Function
  8630. },
  8631. disabledDate: {
  8632. type: Function
  8633. },
  8634. cellClassName: {
  8635. type: Function
  8636. },
  8637. shortcuts: {
  8638. type: Array,
  8639. default: () => []
  8640. },
  8641. arrowControl: {
  8642. type: Boolean,
  8643. default: false
  8644. },
  8645. validateEvent: {
  8646. type: Boolean,
  8647. default: true
  8648. },
  8649. unlinkPanels: Boolean
  8650. };
  8651. const dateEquals = function(a2, b2) {
  8652. const aIsDate = a2 instanceof Date;
  8653. const bIsDate = b2 instanceof Date;
  8654. if (aIsDate && bIsDate) {
  8655. return a2.getTime() === b2.getTime();
  8656. }
  8657. if (!aIsDate && !bIsDate) {
  8658. return a2 === b2;
  8659. }
  8660. return false;
  8661. };
  8662. const valueEquals = function(a2, b2) {
  8663. const aIsArray = Array.isArray(a2);
  8664. const bIsArray = Array.isArray(b2);
  8665. if (aIsArray && bIsArray) {
  8666. if (a2.length !== b2.length) {
  8667. return false;
  8668. }
  8669. return a2.every((item, index) => dateEquals(item, b2[index]));
  8670. }
  8671. if (!aIsArray && !bIsArray) {
  8672. return dateEquals(a2, b2);
  8673. }
  8674. return false;
  8675. };
  8676. const parser = function(date4, format2, lang) {
  8677. const day = isEmpty(format2) || format2 === "x" ? dayjs(date4).locale(lang) : dayjs(date4, format2).locale(lang);
  8678. return day.isValid() ? day : void 0;
  8679. };
  8680. const formatter = function(date4, format2, lang) {
  8681. if (isEmpty(format2))
  8682. return date4;
  8683. if (format2 === "x")
  8684. return +date4;
  8685. return dayjs(date4).locale(lang).format(format2);
  8686. };
  8687. const _sfc_main$S = defineComponent({
  8688. name: "Picker",
  8689. components: {
  8690. ElInput,
  8691. ElTooltip,
  8692. ElIcon
  8693. },
  8694. props: timePickerDefaultProps,
  8695. emits: [
  8696. "update:modelValue",
  8697. "change",
  8698. "focus",
  8699. "blur",
  8700. "calendar-change",
  8701. "panel-change",
  8702. "visible-change"
  8703. ],
  8704. setup(props, ctx) {
  8705. const { lang } = useLocale();
  8706. const nsDate = useNamespace("date");
  8707. const nsInput = useNamespace("input");
  8708. const nsRange = useNamespace("range");
  8709. const elForm2 = inject(formContextKey, {});
  8710. const elFormItem2 = inject(formItemContextKey, {});
  8711. const elPopperOptions = inject("ElPopperOptions", {});
  8712. const refPopper = ref();
  8713. const inputRef = ref();
  8714. const pickerVisible = ref(false);
  8715. const pickerActualVisible = ref(false);
  8716. const valueOnOpen = ref(null);
  8717. watch(pickerVisible, (val) => {
  8718. var _a2;
  8719. if (!val) {
  8720. userInput.value = null;
  8721. nextTick(() => {
  8722. emitChange(props.modelValue);
  8723. });
  8724. ctx.emit("blur");
  8725. blurInput();
  8726. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "blur").catch((err) => debugWarn()));
  8727. } else {
  8728. valueOnOpen.value = props.modelValue;
  8729. }
  8730. });
  8731. const emitChange = (val, isClear) => {
  8732. var _a2;
  8733. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  8734. ctx.emit("change", val);
  8735. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn()));
  8736. }
  8737. };
  8738. const emitInput = (val) => {
  8739. if (!valueEquals(props.modelValue, val)) {
  8740. let formatValue;
  8741. if (Array.isArray(val)) {
  8742. formatValue = val.map((_2) => formatter(_2, props.valueFormat, lang.value));
  8743. } else if (val) {
  8744. formatValue = formatter(val, props.valueFormat, lang.value);
  8745. }
  8746. ctx.emit("update:modelValue", val ? formatValue : val, lang.value);
  8747. }
  8748. };
  8749. const refInput = computed(() => {
  8750. if (inputRef.value) {
  8751. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  8752. return Array.from(_r.querySelectorAll("input"));
  8753. }
  8754. return [];
  8755. });
  8756. const refStartInput = computed(() => {
  8757. return refInput == null ? void 0 : refInput.value[0];
  8758. });
  8759. const refEndInput = computed(() => {
  8760. return refInput == null ? void 0 : refInput.value[1];
  8761. });
  8762. const setSelectionRange = (start2, end2, pos) => {
  8763. const _inputs = refInput.value;
  8764. if (!_inputs.length)
  8765. return;
  8766. if (!pos || pos === "min") {
  8767. _inputs[0].setSelectionRange(start2, end2);
  8768. _inputs[0].focus();
  8769. } else if (pos === "max") {
  8770. _inputs[1].setSelectionRange(start2, end2);
  8771. _inputs[1].focus();
  8772. }
  8773. };
  8774. const onPick = (date4 = "", visible = false) => {
  8775. pickerVisible.value = visible;
  8776. let result;
  8777. if (Array.isArray(date4)) {
  8778. result = date4.map((_2) => _2.toDate());
  8779. } else {
  8780. result = date4 ? date4.toDate() : date4;
  8781. }
  8782. userInput.value = null;
  8783. emitInput(result);
  8784. };
  8785. const onBeforeShow = () => {
  8786. pickerActualVisible.value = true;
  8787. };
  8788. const onShow = () => {
  8789. ctx.emit("visible-change", true);
  8790. };
  8791. const onHide = () => {
  8792. pickerActualVisible.value = false;
  8793. ctx.emit("visible-change", false);
  8794. };
  8795. const focus = (focusStartInput = true) => {
  8796. let input = refStartInput.value;
  8797. if (!focusStartInput && isRangeInput.value) {
  8798. input = refEndInput.value;
  8799. }
  8800. if (input) {
  8801. input.focus();
  8802. }
  8803. };
  8804. const handleFocus = (e) => {
  8805. if (props.readonly || pickerDisabled.value || pickerVisible.value)
  8806. return;
  8807. pickerVisible.value = true;
  8808. ctx.emit("focus", e);
  8809. };
  8810. const handleBlur = () => {
  8811. var _a2;
  8812. (_a2 = refPopper.value) == null ? void 0 : _a2.onClose();
  8813. blurInput();
  8814. };
  8815. const pickerDisabled = computed(() => {
  8816. return props.disabled || elForm2.disabled;
  8817. });
  8818. const parsedValue = computed(() => {
  8819. let result;
  8820. if (valueIsEmpty.value) {
  8821. if (pickerOptions.value.getDefaultValue) {
  8822. result = pickerOptions.value.getDefaultValue();
  8823. }
  8824. } else {
  8825. if (Array.isArray(props.modelValue)) {
  8826. result = props.modelValue.map((_2) => parser(_2, props.valueFormat, lang.value));
  8827. } else {
  8828. result = parser(props.modelValue, props.valueFormat, lang.value);
  8829. }
  8830. }
  8831. if (pickerOptions.value.getRangeAvailableTime) {
  8832. const availableResult = pickerOptions.value.getRangeAvailableTime(result);
  8833. if (!isEqual(availableResult, result)) {
  8834. result = availableResult;
  8835. emitInput(Array.isArray(result) ? result.map((_2) => _2.toDate()) : result.toDate());
  8836. }
  8837. }
  8838. if (Array.isArray(result) && result.some((_2) => !_2)) {
  8839. result = [];
  8840. }
  8841. return result;
  8842. });
  8843. const displayValue = computed(() => {
  8844. if (!pickerOptions.value.panelReady)
  8845. return;
  8846. const formattedValue = formatDayjsToString(parsedValue.value);
  8847. if (Array.isArray(userInput.value)) {
  8848. return [
  8849. userInput.value[0] || formattedValue && formattedValue[0] || "",
  8850. userInput.value[1] || formattedValue && formattedValue[1] || ""
  8851. ];
  8852. } else if (userInput.value !== null) {
  8853. return userInput.value;
  8854. }
  8855. if (!isTimePicker.value && valueIsEmpty.value)
  8856. return;
  8857. if (!pickerVisible.value && valueIsEmpty.value)
  8858. return;
  8859. if (formattedValue) {
  8860. return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
  8861. }
  8862. return "";
  8863. });
  8864. const isTimeLikePicker = computed(() => props.type.includes("time"));
  8865. const isTimePicker = computed(() => props.type.startsWith("time"));
  8866. const isDatesPicker = computed(() => props.type === "dates");
  8867. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock : calendar));
  8868. const showClose = ref(false);
  8869. const onClearIconClick = (event) => {
  8870. if (props.readonly || pickerDisabled.value)
  8871. return;
  8872. if (showClose.value) {
  8873. event.stopPropagation();
  8874. emitInput(null);
  8875. emitChange(null, true);
  8876. showClose.value = false;
  8877. pickerVisible.value = false;
  8878. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  8879. }
  8880. };
  8881. const valueIsEmpty = computed(() => {
  8882. return !props.modelValue || Array.isArray(props.modelValue) && !props.modelValue.length;
  8883. });
  8884. const onMouseEnter = () => {
  8885. if (props.readonly || pickerDisabled.value)
  8886. return;
  8887. if (!valueIsEmpty.value && props.clearable) {
  8888. showClose.value = true;
  8889. }
  8890. };
  8891. const onMouseLeave = () => {
  8892. showClose.value = false;
  8893. };
  8894. const isRangeInput = computed(() => {
  8895. return props.type.includes("range");
  8896. });
  8897. const pickerSize = useSize();
  8898. const popperPaneRef = computed(() => {
  8899. var _a2, _b2;
  8900. return (_b2 = (_a2 = refPopper.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  8901. });
  8902. const popperEl = computed(() => {
  8903. var _a2, _b2;
  8904. return (_b2 = (_a2 = unref(refPopper)) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  8905. });
  8906. const actualInputRef = computed(() => {
  8907. var _a2;
  8908. if (unref(isRangeInput)) {
  8909. return unref(inputRef);
  8910. }
  8911. return (_a2 = unref(inputRef)) == null ? void 0 : _a2.$el;
  8912. });
  8913. onClickOutside(actualInputRef, (e) => {
  8914. const unrefedPopperEl = unref(popperEl);
  8915. const inputEl = unref(actualInputRef);
  8916. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  8917. return;
  8918. pickerVisible.value = false;
  8919. });
  8920. const userInput = ref(null);
  8921. const handleChange2 = () => {
  8922. if (userInput.value) {
  8923. const value = parseUserInputToDayjs(displayValue.value);
  8924. if (value) {
  8925. if (isValidValue(value)) {
  8926. emitInput(Array.isArray(value) ? value.map((_2) => _2.toDate()) : value.toDate());
  8927. userInput.value = null;
  8928. }
  8929. }
  8930. }
  8931. if (userInput.value === "") {
  8932. emitInput(null);
  8933. emitChange(null);
  8934. userInput.value = null;
  8935. }
  8936. };
  8937. const blurInput = () => {
  8938. refInput.value.forEach((input) => input.blur());
  8939. };
  8940. const parseUserInputToDayjs = (value) => {
  8941. if (!value)
  8942. return null;
  8943. return pickerOptions.value.parseUserInput(value);
  8944. };
  8945. const formatDayjsToString = (value) => {
  8946. if (!value)
  8947. return null;
  8948. return pickerOptions.value.formatToString(value);
  8949. };
  8950. const isValidValue = (value) => {
  8951. return pickerOptions.value.isValidValue(value);
  8952. };
  8953. const handleKeydown = (event) => {
  8954. const code = event.code;
  8955. if (code === EVENT_CODE.esc) {
  8956. pickerVisible.value = false;
  8957. event.stopPropagation();
  8958. return;
  8959. }
  8960. if (code === EVENT_CODE.tab) {
  8961. if (!isRangeInput.value) {
  8962. handleChange2();
  8963. pickerVisible.value = false;
  8964. event.stopPropagation();
  8965. } else {
  8966. setTimeout(() => {
  8967. if (!refInput.value.includes(document.activeElement)) {
  8968. pickerVisible.value = false;
  8969. blurInput();
  8970. }
  8971. }, 0);
  8972. }
  8973. return;
  8974. }
  8975. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  8976. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  8977. handleChange2();
  8978. pickerVisible.value = false;
  8979. }
  8980. event.stopPropagation();
  8981. return;
  8982. }
  8983. if (userInput.value) {
  8984. event.stopPropagation();
  8985. return;
  8986. }
  8987. if (pickerOptions.value.handleKeydown) {
  8988. pickerOptions.value.handleKeydown(event);
  8989. }
  8990. };
  8991. const onUserInput = (e) => {
  8992. userInput.value = e;
  8993. };
  8994. const handleStartInput = (event) => {
  8995. if (userInput.value) {
  8996. userInput.value = [event.target.value, userInput.value[1]];
  8997. } else {
  8998. userInput.value = [event.target.value, null];
  8999. }
  9000. };
  9001. const handleEndInput = (event) => {
  9002. if (userInput.value) {
  9003. userInput.value = [userInput.value[0], event.target.value];
  9004. } else {
  9005. userInput.value = [null, event.target.value];
  9006. }
  9007. };
  9008. const handleStartChange = () => {
  9009. const value = parseUserInputToDayjs(userInput.value && userInput.value[0]);
  9010. if (value && value.isValid()) {
  9011. userInput.value = [formatDayjsToString(value), displayValue.value[1]];
  9012. const newValue = [value, parsedValue.value && parsedValue.value[1]];
  9013. if (isValidValue(newValue)) {
  9014. emitInput(newValue);
  9015. userInput.value = null;
  9016. }
  9017. }
  9018. };
  9019. const handleEndChange = () => {
  9020. const value = parseUserInputToDayjs(userInput.value && userInput.value[1]);
  9021. if (value && value.isValid()) {
  9022. userInput.value = [displayValue.value[0], formatDayjsToString(value)];
  9023. const newValue = [parsedValue.value && parsedValue.value[0], value];
  9024. if (isValidValue(newValue)) {
  9025. emitInput(newValue);
  9026. userInput.value = null;
  9027. }
  9028. }
  9029. };
  9030. const pickerOptions = ref({});
  9031. const onSetPickerOption = (e) => {
  9032. pickerOptions.value[e[0]] = e[1];
  9033. pickerOptions.value.panelReady = true;
  9034. };
  9035. const onCalendarChange = (e) => {
  9036. ctx.emit("calendar-change", e);
  9037. };
  9038. const onPanelChange = (value, mode, view2) => {
  9039. ctx.emit("panel-change", value, mode, view2);
  9040. };
  9041. provide("EP_PICKER_BASE", {
  9042. props
  9043. });
  9044. return {
  9045. nsDate,
  9046. nsInput,
  9047. nsRange,
  9048. elPopperOptions,
  9049. isDatesPicker,
  9050. handleEndChange,
  9051. handleStartChange,
  9052. handleStartInput,
  9053. handleEndInput,
  9054. onUserInput,
  9055. handleChange: handleChange2,
  9056. handleKeydown,
  9057. popperPaneRef,
  9058. onClickOutside,
  9059. pickerSize,
  9060. isRangeInput,
  9061. onMouseLeave,
  9062. onMouseEnter,
  9063. onClearIconClick,
  9064. showClose,
  9065. triggerIcon,
  9066. onPick,
  9067. handleFocus,
  9068. handleBlur,
  9069. pickerVisible,
  9070. pickerActualVisible,
  9071. displayValue,
  9072. parsedValue,
  9073. setSelectionRange,
  9074. refPopper,
  9075. inputRef,
  9076. pickerDisabled,
  9077. onSetPickerOption,
  9078. onCalendarChange,
  9079. onPanelChange,
  9080. focus,
  9081. onShow,
  9082. onBeforeShow,
  9083. onHide
  9084. };
  9085. }
  9086. });
  9087. const _hoisted_1$z = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9088. const _hoisted_2$r = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9089. function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
  9090. const _component_el_icon = resolveComponent("el-icon");
  9091. const _component_el_input = resolveComponent("el-input");
  9092. const _component_el_tooltip = resolveComponent("el-tooltip");
  9093. return openBlock(), createBlock(_component_el_tooltip, mergeProps({
  9094. ref: "refPopper",
  9095. visible: _ctx.pickerVisible,
  9096. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.pickerVisible = $event),
  9097. effect: "light",
  9098. pure: "",
  9099. trigger: "click"
  9100. }, _ctx.$attrs, {
  9101. "append-to-body": "",
  9102. transition: `${_ctx.nsDate.namespace.value}-zoom-in-top`,
  9103. "popper-class": [`${_ctx.nsDate.namespace.value}-picker__popper`, _ctx.popperClass],
  9104. "popper-options": _ctx.elPopperOptions,
  9105. "fallback-placements": ["bottom", "top", "right", "left"],
  9106. "gpu-acceleration": false,
  9107. "stop-popper-mouse-event": false,
  9108. "hide-after": 0,
  9109. persistent: "",
  9110. onBeforeShow: _ctx.onBeforeShow,
  9111. onShow: _ctx.onShow,
  9112. onHide: _ctx.onHide
  9113. }), {
  9114. default: withCtx(() => [
  9115. !_ctx.isRangeInput ? (openBlock(), createBlock(_component_el_input, {
  9116. key: 0,
  9117. id: _ctx.id,
  9118. ref: "inputRef",
  9119. "model-value": _ctx.displayValue,
  9120. name: _ctx.name,
  9121. size: _ctx.pickerSize,
  9122. disabled: _ctx.pickerDisabled,
  9123. placeholder: _ctx.placeholder,
  9124. class: normalizeClass([_ctx.nsDate.b("editor"), _ctx.nsDate.bm("editor", _ctx.type), _ctx.$attrs.class]),
  9125. style: normalizeStyle(_ctx.$attrs.style),
  9126. readonly: !_ctx.editable || _ctx.readonly || _ctx.isDatesPicker || _ctx.type === "week",
  9127. onInput: _ctx.onUserInput,
  9128. onFocus: _ctx.handleFocus,
  9129. onKeydown: _ctx.handleKeydown,
  9130. onChange: _ctx.handleChange,
  9131. onMouseenter: _ctx.onMouseEnter,
  9132. onMouseleave: _ctx.onMouseLeave,
  9133. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  9134. }, ["stop"]))
  9135. }, {
  9136. prefix: withCtx(() => [
  9137. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9138. key: 0,
  9139. class: normalizeClass(_ctx.nsInput.e("icon")),
  9140. onClick: _ctx.handleFocus
  9141. }, {
  9142. default: withCtx(() => [
  9143. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9144. ]),
  9145. _: 1
  9146. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9147. ]),
  9148. suffix: withCtx(() => [
  9149. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9150. key: 0,
  9151. class: normalizeClass(`${_ctx.nsInput.e("icon")} clear-icon`),
  9152. onClick: _ctx.onClearIconClick
  9153. }, {
  9154. default: withCtx(() => [
  9155. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9156. ]),
  9157. _: 1
  9158. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9159. ]),
  9160. _: 1
  9161. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "onInput", "onFocus", "onKeydown", "onChange", "onMouseenter", "onMouseleave"])) : (openBlock(), createElementBlock("div", {
  9162. key: 1,
  9163. ref: "inputRef",
  9164. class: normalizeClass([
  9165. _ctx.nsDate.b("editor"),
  9166. _ctx.nsDate.bm("editor", _ctx.type),
  9167. _ctx.nsInput.e("inner"),
  9168. _ctx.nsDate.is("disabled", _ctx.pickerDisabled),
  9169. _ctx.nsDate.is("active", _ctx.pickerVisible),
  9170. _ctx.nsRange.b("editor"),
  9171. _ctx.pickerSize ? _ctx.nsRange.bm("editor", _ctx.pickerSize) : "",
  9172. _ctx.$attrs.class
  9173. ]),
  9174. style: normalizeStyle(_ctx.$attrs.style),
  9175. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9176. onMouseenter: _cache[8] || (_cache[8] = (...args) => _ctx.onMouseEnter && _ctx.onMouseEnter(...args)),
  9177. onMouseleave: _cache[9] || (_cache[9] = (...args) => _ctx.onMouseLeave && _ctx.onMouseLeave(...args)),
  9178. onKeydown: _cache[10] || (_cache[10] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  9179. }, [
  9180. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9181. key: 0,
  9182. class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsRange.e("icon")]),
  9183. onClick: _ctx.handleFocus
  9184. }, {
  9185. default: withCtx(() => [
  9186. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9187. ]),
  9188. _: 1
  9189. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  9190. createElementVNode("input", {
  9191. id: _ctx.id && _ctx.id[0],
  9192. autocomplete: "off",
  9193. name: _ctx.name && _ctx.name[0],
  9194. placeholder: _ctx.startPlaceholder,
  9195. value: _ctx.displayValue && _ctx.displayValue[0],
  9196. disabled: _ctx.pickerDisabled,
  9197. readonly: !_ctx.editable || _ctx.readonly,
  9198. class: normalizeClass(_ctx.nsRange.b("input")),
  9199. onInput: _cache[1] || (_cache[1] = (...args) => _ctx.handleStartInput && _ctx.handleStartInput(...args)),
  9200. onChange: _cache[2] || (_cache[2] = (...args) => _ctx.handleStartChange && _ctx.handleStartChange(...args)),
  9201. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args))
  9202. }, null, 42, _hoisted_1$z),
  9203. renderSlot(_ctx.$slots, "range-separator", {}, () => [
  9204. createElementVNode("span", {
  9205. class: normalizeClass(_ctx.nsRange.b("separator"))
  9206. }, toDisplayString(_ctx.rangeSeparator), 3)
  9207. ]),
  9208. createElementVNode("input", {
  9209. id: _ctx.id && _ctx.id[1],
  9210. autocomplete: "off",
  9211. name: _ctx.name && _ctx.name[1],
  9212. placeholder: _ctx.endPlaceholder,
  9213. value: _ctx.displayValue && _ctx.displayValue[1],
  9214. disabled: _ctx.pickerDisabled,
  9215. readonly: !_ctx.editable || _ctx.readonly,
  9216. class: normalizeClass(_ctx.nsRange.b("input")),
  9217. onFocus: _cache[4] || (_cache[4] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9218. onInput: _cache[5] || (_cache[5] = (...args) => _ctx.handleEndInput && _ctx.handleEndInput(...args)),
  9219. onChange: _cache[6] || (_cache[6] = (...args) => _ctx.handleEndChange && _ctx.handleEndChange(...args))
  9220. }, null, 42, _hoisted_2$r),
  9221. _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9222. key: 1,
  9223. class: normalizeClass([
  9224. _ctx.nsInput.e("icon"),
  9225. _ctx.nsRange.e("close-icon"),
  9226. {
  9227. [_ctx.nsRange.e("close-icon--hidden")]: !_ctx.showClose
  9228. }
  9229. ]),
  9230. onClick: _ctx.onClearIconClick
  9231. }, {
  9232. default: withCtx(() => [
  9233. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9234. ]),
  9235. _: 1
  9236. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9237. ], 38))
  9238. ]),
  9239. content: withCtx(() => [
  9240. renderSlot(_ctx.$slots, "default", {
  9241. visible: _ctx.pickerVisible,
  9242. actualVisible: _ctx.pickerActualVisible,
  9243. parsedValue: _ctx.parsedValue,
  9244. format: _ctx.format,
  9245. unlinkPanels: _ctx.unlinkPanels,
  9246. type: _ctx.type,
  9247. defaultValue: _ctx.defaultValue,
  9248. onPick: _cache[11] || (_cache[11] = (...args) => _ctx.onPick && _ctx.onPick(...args)),
  9249. onSelectRange: _cache[12] || (_cache[12] = (...args) => _ctx.setSelectionRange && _ctx.setSelectionRange(...args)),
  9250. onSetPickerOption: _cache[13] || (_cache[13] = (...args) => _ctx.onSetPickerOption && _ctx.onSetPickerOption(...args)),
  9251. onCalendarChange: _cache[14] || (_cache[14] = (...args) => _ctx.onCalendarChange && _ctx.onCalendarChange(...args)),
  9252. onPanelChange: _cache[15] || (_cache[15] = (...args) => _ctx.onPanelChange && _ctx.onPanelChange(...args)),
  9253. onMousedown: _cache[16] || (_cache[16] = withModifiers(() => {
  9254. }, ["stop"]))
  9255. })
  9256. ]),
  9257. _: 3
  9258. }, 16, ["visible", "transition", "popper-class", "popper-options", "onBeforeShow", "onShow", "onHide"]);
  9259. }
  9260. var CommonPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$S, [["render", _sfc_render$w], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/common/picker.vue"]]);
  9261. const nodeList = /* @__PURE__ */ new Map();
  9262. let startClick;
  9263. if (isClient$1) {
  9264. document.addEventListener("mousedown", (e) => startClick = e);
  9265. document.addEventListener("mouseup", (e) => {
  9266. for (const handlers of nodeList.values()) {
  9267. for (const { documentHandler } of handlers) {
  9268. documentHandler(e, startClick);
  9269. }
  9270. }
  9271. });
  9272. }
  9273. function createDocumentHandler(el, binding) {
  9274. let excludes = [];
  9275. if (Array.isArray(binding.arg)) {
  9276. excludes = binding.arg;
  9277. } else if (isElement$1(binding.arg)) {
  9278. excludes.push(binding.arg);
  9279. }
  9280. return function(mouseup, mousedown) {
  9281. const popperRef = binding.instance.popperRef;
  9282. const mouseUpTarget = mouseup.target;
  9283. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  9284. const isBound = !binding || !binding.instance;
  9285. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  9286. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  9287. const isSelf = el === mouseUpTarget;
  9288. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  9289. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  9290. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  9291. return;
  9292. }
  9293. binding.value(mouseup, mousedown);
  9294. };
  9295. }
  9296. const ClickOutside = {
  9297. beforeMount(el, binding) {
  9298. if (!nodeList.has(el)) {
  9299. nodeList.set(el, []);
  9300. }
  9301. nodeList.get(el).push({
  9302. documentHandler: createDocumentHandler(el, binding),
  9303. bindingFn: binding.value
  9304. });
  9305. },
  9306. updated(el, binding) {
  9307. if (!nodeList.has(el)) {
  9308. nodeList.set(el, []);
  9309. }
  9310. const handlers = nodeList.get(el);
  9311. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  9312. const newHandler = {
  9313. documentHandler: createDocumentHandler(el, binding),
  9314. bindingFn: binding.value
  9315. };
  9316. if (oldHandlerIndex >= 0) {
  9317. handlers.splice(oldHandlerIndex, 1, newHandler);
  9318. } else {
  9319. handlers.push(newHandler);
  9320. }
  9321. },
  9322. unmounted(el) {
  9323. nodeList.delete(el);
  9324. }
  9325. };
  9326. var RepeatClick = {
  9327. beforeMount(el, binding) {
  9328. let interval = null;
  9329. let startTime;
  9330. const handler3 = () => binding.value && binding.value();
  9331. const clear = () => {
  9332. if (Date.now() - startTime < 100) {
  9333. handler3();
  9334. }
  9335. clearInterval(interval);
  9336. interval = null;
  9337. };
  9338. on(el, "mousedown", (e) => {
  9339. if (e.button !== 0)
  9340. return;
  9341. startTime = Date.now();
  9342. once(document, "mouseup", clear);
  9343. clearInterval(interval);
  9344. interval = setInterval(handler3, 100);
  9345. });
  9346. }
  9347. };
  9348. var D = false, o, p, m, u, d, M, l, w, x, E, F, _, h, A, X;
  9349. function a() {
  9350. if (!D) {
  9351. D = true;
  9352. 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);
  9353. if (_ = /\b(iPhone|iP[ao]d)/.exec(e), h = /\b(iP[ao]d)/.exec(e), E = /Android/i.exec(e), A = /FBAN\/\w+;/i.exec(e), X = /Mobile/i.exec(e), F = !!/Win64/.exec(e), n) {
  9354. o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
  9355. var r = /(?:Trident\/(\d+.\d+))/.exec(e);
  9356. M = r ? parseFloat(r[1]) + 4 : o, p = n[2] ? parseFloat(n[2]) : NaN, m = 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;
  9357. } else
  9358. o = p = m = d = u = NaN;
  9359. if (i) {
  9360. if (i[1]) {
  9361. var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
  9362. l = t ? parseFloat(t[1].replace("_", ".")) : true;
  9363. } else
  9364. l = false;
  9365. w = !!i[2], x = !!i[3];
  9366. } else
  9367. l = w = x = false;
  9368. }
  9369. }
  9370. var v = { ie: function() {
  9371. return a() || o;
  9372. }, ieCompatibilityMode: function() {
  9373. return a() || M > o;
  9374. }, ie64: function() {
  9375. return v.ie() && F;
  9376. }, firefox: function() {
  9377. return a() || p;
  9378. }, opera: function() {
  9379. return a() || m;
  9380. }, webkit: function() {
  9381. return a() || u;
  9382. }, safari: function() {
  9383. return v.webkit();
  9384. }, chrome: function() {
  9385. return a() || d;
  9386. }, windows: function() {
  9387. return a() || w;
  9388. }, osx: function() {
  9389. return a() || l;
  9390. }, linux: function() {
  9391. return a() || x;
  9392. }, iphone: function() {
  9393. return a() || _;
  9394. }, mobile: function() {
  9395. return a() || _ || h || E || X;
  9396. }, nativeApp: function() {
  9397. return a() || A;
  9398. }, android: function() {
  9399. return a() || E;
  9400. }, ipad: function() {
  9401. return a() || h;
  9402. } }, b = v;
  9403. var s = !!(typeof window < "u" && window.document && window.document.createElement), Y = { canUseDOM: s, canUseWorkers: typeof Worker < "u", canUseEventListeners: s && !!(window.addEventListener || window.attachEvent), canUseViewport: s && !!window.screen, isInWorker: !s }, N = Y;
  9404. var O;
  9405. N.canUseDOM && (O = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true);
  9406. function L(e, n) {
  9407. if (!N.canUseDOM || n && !("addEventListener" in document))
  9408. return false;
  9409. var i = "on" + e, r = i in document;
  9410. if (!r) {
  9411. var t = document.createElement("div");
  9412. t.setAttribute(i, "return;"), r = typeof t[i] == "function";
  9413. }
  9414. return !r && O && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
  9415. }
  9416. var I = L;
  9417. var P = 10, T = 40, U = 800;
  9418. function S(e) {
  9419. var n = 0, i = 0, r = 0, t = 0;
  9420. 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 * P, t = i * P, "deltaY" in e && (t = e.deltaY), "deltaX" in e && (r = e.deltaX), (r || t) && e.deltaMode && (e.deltaMode == 1 ? (r *= T, t *= T) : (r *= U, t *= U)), r && !n && (n = r < 1 ? -1 : 1), t && !i && (i = t < 1 ? -1 : 1), { spinX: n, spinY: i, pixelX: r, pixelY: t };
  9421. }
  9422. S.getEventType = function() {
  9423. return b.firefox() ? "DOMMouseScroll" : I("wheel") ? "wheel" : "mousewheel";
  9424. };
  9425. var W = S;
  9426. /**
  9427. * Checks if an event is supported in the current execution environment.
  9428. *
  9429. * NOTE: This will not work correctly for non-generic events such as `change`,
  9430. * `reset`, `load`, `error`, and `select`.
  9431. *
  9432. * Borrows from Modernizr.
  9433. *
  9434. * @param {string} eventNameSuffix Event name, e.g. "click".
  9435. * @param {?boolean} capture Check if the capture phase is supported.
  9436. * @return {boolean} True if the event is supported.
  9437. * @internal
  9438. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  9439. */
  9440. const mousewheel = function(element, callback) {
  9441. if (element && element.addEventListener) {
  9442. const fn2 = function(event) {
  9443. const normalized = W(event);
  9444. callback && Reflect.apply(callback, this, [event, normalized]);
  9445. };
  9446. if (isFirefox()) {
  9447. element.addEventListener("DOMMouseScroll", fn2);
  9448. } else {
  9449. element.onmousewheel = fn2;
  9450. }
  9451. }
  9452. };
  9453. const Mousewheel = {
  9454. beforeMount(el, binding) {
  9455. mousewheel(el, binding.value);
  9456. }
  9457. };
  9458. const makeList = (total, method4, methodFunc) => {
  9459. const arr = [];
  9460. const disabledArr = method4 && methodFunc();
  9461. for (let i = 0; i < total; i++) {
  9462. arr[i] = disabledArr ? disabledArr.includes(i) : false;
  9463. }
  9464. return arr;
  9465. };
  9466. const makeAvailableArr = (list) => {
  9467. return list.map((_2, index) => !_2 ? index : _2).filter((_2) => _2 !== true);
  9468. };
  9469. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  9470. const getHoursList = (role, compare) => {
  9471. return makeList(24, disabledHours, () => disabledHours(role, compare));
  9472. };
  9473. const getMinutesList = (hour, role, compare) => {
  9474. return makeList(60, disabledMinutes, () => disabledMinutes(hour, role, compare));
  9475. };
  9476. const getSecondsList = (hour, minute, role, compare) => {
  9477. return makeList(60, disabledSeconds, () => disabledSeconds(hour, minute, role, compare));
  9478. };
  9479. return {
  9480. getHoursList,
  9481. getMinutesList,
  9482. getSecondsList
  9483. };
  9484. };
  9485. const getAvailableArrs = (disabledHours, disabledMinutes, disabledSeconds) => {
  9486. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  9487. const getAvailableHours = (role, compare) => {
  9488. return makeAvailableArr(getHoursList(role, compare));
  9489. };
  9490. const getAvailableMinutes = (hour, role, compare) => {
  9491. return makeAvailableArr(getMinutesList(hour, role, compare));
  9492. };
  9493. const getAvailableSeconds = (hour, minute, role, compare) => {
  9494. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  9495. };
  9496. return {
  9497. getAvailableHours,
  9498. getAvailableMinutes,
  9499. getAvailableSeconds
  9500. };
  9501. };
  9502. const useOldValue = (props) => {
  9503. const oldValue = ref(props.parsedValue);
  9504. watch(() => props.visible, (val) => {
  9505. if (!val) {
  9506. oldValue.value = props.parsedValue;
  9507. }
  9508. });
  9509. return oldValue;
  9510. };
  9511. const _sfc_main$R = defineComponent({
  9512. directives: {
  9513. repeatClick: RepeatClick
  9514. },
  9515. components: {
  9516. ElScrollbar,
  9517. ElIcon,
  9518. ArrowUp: arrowUp,
  9519. ArrowDown: arrowDown
  9520. },
  9521. props: {
  9522. role: {
  9523. type: String,
  9524. required: true
  9525. },
  9526. spinnerDate: {
  9527. type: Object,
  9528. required: true
  9529. },
  9530. showSeconds: {
  9531. type: Boolean,
  9532. default: true
  9533. },
  9534. arrowControl: Boolean,
  9535. amPmMode: {
  9536. type: String,
  9537. default: ""
  9538. },
  9539. disabledHours: {
  9540. type: Function
  9541. },
  9542. disabledMinutes: {
  9543. type: Function
  9544. },
  9545. disabledSeconds: {
  9546. type: Function
  9547. }
  9548. },
  9549. emits: ["change", "select-range", "set-option"],
  9550. setup(props, ctx) {
  9551. const ns = useNamespace("time");
  9552. let isScrolling = false;
  9553. const debouncedResetScroll = debounce$1((type4) => {
  9554. isScrolling = false;
  9555. adjustCurrentSpinner(type4);
  9556. }, 200);
  9557. const currentScrollbar = ref(null);
  9558. const listHoursRef = ref(null);
  9559. const listMinutesRef = ref(null);
  9560. const listSecondsRef = ref(null);
  9561. const listRefsMap = {
  9562. hours: listHoursRef,
  9563. minutes: listMinutesRef,
  9564. seconds: listSecondsRef
  9565. };
  9566. const spinnerItems = computed(() => {
  9567. const arr = ["hours", "minutes", "seconds"];
  9568. return props.showSeconds ? arr : arr.slice(0, 2);
  9569. });
  9570. const hours = computed(() => {
  9571. return props.spinnerDate.hour();
  9572. });
  9573. const minutes = computed(() => {
  9574. return props.spinnerDate.minute();
  9575. });
  9576. const seconds = computed(() => {
  9577. return props.spinnerDate.second();
  9578. });
  9579. const timePartsMap = computed(() => ({
  9580. hours,
  9581. minutes,
  9582. seconds
  9583. }));
  9584. const hoursList = computed(() => {
  9585. return getHoursList(props.role);
  9586. });
  9587. const minutesList = computed(() => {
  9588. return getMinutesList(hours.value, props.role);
  9589. });
  9590. const secondsList = computed(() => {
  9591. return getSecondsList(hours.value, minutes.value, props.role);
  9592. });
  9593. const listMap = computed(() => ({
  9594. hours: hoursList,
  9595. minutes: minutesList,
  9596. seconds: secondsList
  9597. }));
  9598. const arrowHourList = computed(() => {
  9599. const hour = hours.value;
  9600. return [
  9601. hour > 0 ? hour - 1 : void 0,
  9602. hour,
  9603. hour < 23 ? hour + 1 : void 0
  9604. ];
  9605. });
  9606. const arrowMinuteList = computed(() => {
  9607. const minute = minutes.value;
  9608. return [
  9609. minute > 0 ? minute - 1 : void 0,
  9610. minute,
  9611. minute < 59 ? minute + 1 : void 0
  9612. ];
  9613. });
  9614. const arrowSecondList = computed(() => {
  9615. const second = seconds.value;
  9616. return [
  9617. second > 0 ? second - 1 : void 0,
  9618. second,
  9619. second < 59 ? second + 1 : void 0
  9620. ];
  9621. });
  9622. const arrowListMap = computed(() => ({
  9623. hours: arrowHourList,
  9624. minutes: arrowMinuteList,
  9625. seconds: arrowSecondList
  9626. }));
  9627. const getAmPmFlag = (hour) => {
  9628. const shouldShowAmPm = !!props.amPmMode;
  9629. if (!shouldShowAmPm)
  9630. return "";
  9631. const isCapital = props.amPmMode === "A";
  9632. let content2 = hour < 12 ? " am" : " pm";
  9633. if (isCapital)
  9634. content2 = content2.toUpperCase();
  9635. return content2;
  9636. };
  9637. const emitSelectRange = (type4) => {
  9638. if (type4 === "hours") {
  9639. ctx.emit("select-range", 0, 2);
  9640. } else if (type4 === "minutes") {
  9641. ctx.emit("select-range", 3, 5);
  9642. } else if (type4 === "seconds") {
  9643. ctx.emit("select-range", 6, 8);
  9644. }
  9645. currentScrollbar.value = type4;
  9646. };
  9647. const adjustCurrentSpinner = (type4) => {
  9648. adjustSpinner(type4, timePartsMap.value[type4].value);
  9649. };
  9650. const adjustSpinners = () => {
  9651. adjustCurrentSpinner("hours");
  9652. adjustCurrentSpinner("minutes");
  9653. adjustCurrentSpinner("seconds");
  9654. };
  9655. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  9656. const adjustSpinner = (type4, value) => {
  9657. if (props.arrowControl)
  9658. return;
  9659. const el = listRefsMap[type4];
  9660. if (el && el.$el) {
  9661. getScrollbarElement(el.$el).scrollTop = Math.max(0, value * typeItemHeight(type4));
  9662. }
  9663. };
  9664. const typeItemHeight = (type4) => {
  9665. const el = listRefsMap[type4];
  9666. return el.$el.querySelector("li").offsetHeight;
  9667. };
  9668. const onIncreaseClick = () => {
  9669. scrollDown(1);
  9670. };
  9671. const onDecreaseClick = () => {
  9672. scrollDown(-1);
  9673. };
  9674. const scrollDown = (step) => {
  9675. if (!currentScrollbar.value) {
  9676. emitSelectRange("hours");
  9677. }
  9678. const label = currentScrollbar.value;
  9679. let now2 = timePartsMap.value[label].value;
  9680. const total = currentScrollbar.value === "hours" ? 24 : 60;
  9681. now2 = (now2 + step + total) % total;
  9682. modifyDateField(label, now2);
  9683. adjustSpinner(label, now2);
  9684. nextTick(() => emitSelectRange(currentScrollbar.value));
  9685. };
  9686. const modifyDateField = (type4, value) => {
  9687. const list = listMap.value[type4].value;
  9688. const isDisabled = list[value];
  9689. if (isDisabled)
  9690. return;
  9691. switch (type4) {
  9692. case "hours":
  9693. ctx.emit("change", props.spinnerDate.hour(value).minute(minutes.value).second(seconds.value));
  9694. break;
  9695. case "minutes":
  9696. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(value).second(seconds.value));
  9697. break;
  9698. case "seconds":
  9699. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(minutes.value).second(value));
  9700. break;
  9701. }
  9702. };
  9703. const handleClick = (type4, { value, disabled }) => {
  9704. if (!disabled) {
  9705. modifyDateField(type4, value);
  9706. emitSelectRange(type4);
  9707. adjustSpinner(type4, value);
  9708. }
  9709. };
  9710. const handleScroll = (type4) => {
  9711. isScrolling = true;
  9712. debouncedResetScroll(type4);
  9713. 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);
  9714. modifyDateField(type4, value);
  9715. };
  9716. const scrollBarHeight = (type4) => {
  9717. return listRefsMap[type4].$el.offsetHeight;
  9718. };
  9719. const bindScrollEvent = () => {
  9720. const bindFunction = (type4) => {
  9721. if (listRefsMap[type4] && listRefsMap[type4].$el) {
  9722. getScrollbarElement(listRefsMap[type4].$el).onscroll = () => {
  9723. handleScroll(type4);
  9724. };
  9725. }
  9726. };
  9727. bindFunction("hours");
  9728. bindFunction("minutes");
  9729. bindFunction("seconds");
  9730. };
  9731. onMounted(() => {
  9732. nextTick(() => {
  9733. !props.arrowControl && bindScrollEvent();
  9734. adjustSpinners();
  9735. if (props.role === "start")
  9736. emitSelectRange("hours");
  9737. });
  9738. });
  9739. const setRef = (scrollbar, type4) => {
  9740. listRefsMap[type4] = scrollbar;
  9741. };
  9742. ctx.emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  9743. ctx.emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  9744. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  9745. watch(() => props.spinnerDate, () => {
  9746. if (isScrolling)
  9747. return;
  9748. adjustSpinners();
  9749. });
  9750. return {
  9751. ns,
  9752. setRef,
  9753. spinnerItems,
  9754. currentScrollbar,
  9755. hours,
  9756. minutes,
  9757. seconds,
  9758. hoursList,
  9759. minutesList,
  9760. arrowHourList,
  9761. arrowMinuteList,
  9762. arrowSecondList,
  9763. getAmPmFlag,
  9764. emitSelectRange,
  9765. adjustCurrentSpinner,
  9766. typeItemHeight,
  9767. listHoursRef,
  9768. listMinutesRef,
  9769. listSecondsRef,
  9770. onIncreaseClick,
  9771. onDecreaseClick,
  9772. handleClick,
  9773. secondsList,
  9774. timePartsMap,
  9775. arrowListMap,
  9776. listMap
  9777. };
  9778. }
  9779. });
  9780. const _hoisted_1$y = ["onClick"];
  9781. const _hoisted_2$q = ["onMouseenter"];
  9782. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  9783. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  9784. const _component_arrow_up = resolveComponent("arrow-up");
  9785. const _component_el_icon = resolveComponent("el-icon");
  9786. const _component_arrow_down = resolveComponent("arrow-down");
  9787. const _directive_repeat_click = resolveDirective("repeat-click");
  9788. return openBlock(), createElementBlock("div", {
  9789. class: normalizeClass([_ctx.ns.b("spinner"), { "has-seconds": _ctx.showSeconds }])
  9790. }, [
  9791. !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.spinnerItems, (item) => {
  9792. return openBlock(), createBlock(_component_el_scrollbar, {
  9793. key: item,
  9794. ref_for: true,
  9795. ref: (scollbar) => _ctx.setRef(scollbar, item),
  9796. class: normalizeClass(_ctx.ns.be("spinner", "wrapper")),
  9797. "wrap-style": "max-height: inherit;",
  9798. "view-class": _ctx.ns.be("spinner", "list"),
  9799. noresize: "",
  9800. tag: "ul",
  9801. onMouseenter: ($event) => _ctx.emitSelectRange(item),
  9802. onMousemove: ($event) => _ctx.adjustCurrentSpinner(item)
  9803. }, {
  9804. default: withCtx(() => [
  9805. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listMap[item].value, (disabled, key) => {
  9806. return openBlock(), createElementBlock("li", {
  9807. key,
  9808. class: normalizeClass([
  9809. _ctx.ns.be("spinner", "item"),
  9810. _ctx.ns.is("active", key === _ctx.timePartsMap[item].value),
  9811. _ctx.ns.is("disabled", disabled)
  9812. ]),
  9813. onClick: ($event) => _ctx.handleClick(item, { value: key, disabled })
  9814. }, [
  9815. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9816. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(key)), 1)
  9817. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  9818. createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
  9819. ], 2112))
  9820. ], 10, _hoisted_1$y);
  9821. }), 128))
  9822. ]),
  9823. _: 2
  9824. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  9825. }), 128)) : createCommentVNode("v-if", true),
  9826. _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.spinnerItems, (item) => {
  9827. return openBlock(), createElementBlock("div", {
  9828. key: item,
  9829. class: normalizeClass([_ctx.ns.be("spinner", "wrapper"), _ctx.ns.is("arrow")]),
  9830. onMouseenter: ($event) => _ctx.emitSelectRange(item)
  9831. }, [
  9832. withDirectives((openBlock(), createBlock(_component_el_icon, {
  9833. class: normalizeClass(["arrow-up", _ctx.ns.be("spinner", "arrow")])
  9834. }, {
  9835. default: withCtx(() => [
  9836. createVNode(_component_arrow_up)
  9837. ]),
  9838. _: 1
  9839. }, 8, ["class"])), [
  9840. [_directive_repeat_click, _ctx.onDecreaseClick]
  9841. ]),
  9842. withDirectives((openBlock(), createBlock(_component_el_icon, {
  9843. class: normalizeClass(["arrow-down", _ctx.ns.be("spinner", "arrow")])
  9844. }, {
  9845. default: withCtx(() => [
  9846. createVNode(_component_arrow_down)
  9847. ]),
  9848. _: 1
  9849. }, 8, ["class"])), [
  9850. [_directive_repeat_click, _ctx.onIncreaseClick]
  9851. ]),
  9852. createElementVNode("ul", {
  9853. class: normalizeClass(_ctx.ns.be("spinner", "list"))
  9854. }, [
  9855. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.arrowListMap[item].value, (time, key) => {
  9856. return openBlock(), createElementBlock("li", {
  9857. key,
  9858. class: normalizeClass([
  9859. _ctx.ns.be("spinner", "item"),
  9860. _ctx.ns.is("active", time === _ctx.timePartsMap[item].value),
  9861. _ctx.ns.is("disabled", _ctx.listMap[item].value[time])
  9862. ])
  9863. }, [
  9864. typeof time === "number" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9865. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9866. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(time)), 1)
  9867. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  9868. createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
  9869. ], 2112))
  9870. ], 2112)) : createCommentVNode("v-if", true)
  9871. ], 2);
  9872. }), 128))
  9873. ], 2)
  9874. ], 42, _hoisted_2$q);
  9875. }), 128)) : createCommentVNode("v-if", true)
  9876. ], 2);
  9877. }
  9878. var TimeSpinner = /* @__PURE__ */ _export_sfc$1(_sfc_main$R, [["render", _sfc_render$v], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue"]]);
  9879. const _sfc_main$Q = defineComponent({
  9880. components: {
  9881. TimeSpinner
  9882. },
  9883. props: {
  9884. visible: Boolean,
  9885. actualVisible: {
  9886. type: Boolean,
  9887. default: void 0
  9888. },
  9889. datetimeRole: {
  9890. type: String
  9891. },
  9892. parsedValue: {
  9893. type: [Object, String]
  9894. },
  9895. format: {
  9896. type: String,
  9897. default: ""
  9898. }
  9899. },
  9900. emits: ["pick", "select-range", "set-picker-option"],
  9901. setup(props, ctx) {
  9902. const ns = useNamespace("time");
  9903. const { t, lang } = useLocale();
  9904. const selectionRange = ref([0, 2]);
  9905. const oldValue = useOldValue(props);
  9906. const transitionName = computed(() => {
  9907. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  9908. });
  9909. const showSeconds = computed(() => {
  9910. return props.format.includes("ss");
  9911. });
  9912. const amPmMode = computed(() => {
  9913. if (props.format.includes("A"))
  9914. return "A";
  9915. if (props.format.includes("a"))
  9916. return "a";
  9917. return "";
  9918. });
  9919. const isValidValue = (_date) => {
  9920. const parsedDate = dayjs(_date).locale(lang.value);
  9921. const result = getRangeAvailableTime(parsedDate);
  9922. return parsedDate.isSame(result);
  9923. };
  9924. const handleCancel = () => {
  9925. ctx.emit("pick", oldValue.value, false);
  9926. };
  9927. const handleConfirm = (visible = false, first = false) => {
  9928. if (first)
  9929. return;
  9930. ctx.emit("pick", props.parsedValue, visible);
  9931. };
  9932. const handleChange2 = (_date) => {
  9933. if (!props.visible) {
  9934. return;
  9935. }
  9936. const result = getRangeAvailableTime(_date).millisecond(0);
  9937. ctx.emit("pick", result, true);
  9938. };
  9939. const setSelectionRange = (start2, end2) => {
  9940. ctx.emit("select-range", start2, end2);
  9941. selectionRange.value = [start2, end2];
  9942. };
  9943. const changeSelectionRange = (step) => {
  9944. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  9945. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  9946. const index = list.indexOf(selectionRange.value[0]);
  9947. const next = (index + step + list.length) % list.length;
  9948. timePickerOptions["start_emitSelectRange"](mapping[next]);
  9949. };
  9950. const handleKeydown = (event) => {
  9951. const code = event.code;
  9952. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  9953. const step = code === EVENT_CODE.left ? -1 : 1;
  9954. changeSelectionRange(step);
  9955. event.preventDefault();
  9956. return;
  9957. }
  9958. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  9959. const step = code === EVENT_CODE.up ? -1 : 1;
  9960. timePickerOptions["start_scrollDown"](step);
  9961. event.preventDefault();
  9962. return;
  9963. }
  9964. };
  9965. const getRangeAvailableTime = (date4) => {
  9966. const availableMap = {
  9967. hour: getAvailableHours,
  9968. minute: getAvailableMinutes,
  9969. second: getAvailableSeconds
  9970. };
  9971. let result = date4;
  9972. ["hour", "minute", "second"].forEach((_2) => {
  9973. if (availableMap[_2]) {
  9974. let availableArr;
  9975. const method4 = availableMap[_2];
  9976. if (_2 === "minute") {
  9977. availableArr = method4(result.hour(), props.datetimeRole);
  9978. } else if (_2 === "second") {
  9979. availableArr = method4(result.hour(), result.minute(), props.datetimeRole);
  9980. } else {
  9981. availableArr = method4(props.datetimeRole);
  9982. }
  9983. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  9984. result = result[_2](availableArr[0]);
  9985. }
  9986. }
  9987. });
  9988. return result;
  9989. };
  9990. const parseUserInput = (value) => {
  9991. if (!value)
  9992. return null;
  9993. return dayjs(value, props.format).locale(lang.value);
  9994. };
  9995. const formatToString = (value) => {
  9996. if (!value)
  9997. return null;
  9998. return value.format(props.format);
  9999. };
  10000. const getDefaultValue = () => {
  10001. return dayjs(defaultValue).locale(lang.value);
  10002. };
  10003. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10004. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10005. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10006. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10007. ctx.emit("set-picker-option", [
  10008. "getRangeAvailableTime",
  10009. getRangeAvailableTime
  10010. ]);
  10011. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10012. const timePickerOptions = {};
  10013. const onSetOption = (e) => {
  10014. timePickerOptions[e[0]] = e[1];
  10015. };
  10016. const pickerBase = inject("EP_PICKER_BASE");
  10017. const {
  10018. arrowControl,
  10019. disabledHours,
  10020. disabledMinutes,
  10021. disabledSeconds,
  10022. defaultValue
  10023. } = pickerBase.props;
  10024. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours, disabledMinutes, disabledSeconds);
  10025. return {
  10026. ns,
  10027. transitionName,
  10028. arrowControl,
  10029. onSetOption,
  10030. t,
  10031. handleConfirm,
  10032. handleChange: handleChange2,
  10033. setSelectionRange,
  10034. amPmMode,
  10035. showSeconds,
  10036. handleCancel,
  10037. disabledHours,
  10038. disabledMinutes,
  10039. disabledSeconds
  10040. };
  10041. }
  10042. });
  10043. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  10044. const _component_time_spinner = resolveComponent("time-spinner");
  10045. return openBlock(), createBlock(Transition, { name: _ctx.transitionName }, {
  10046. default: withCtx(() => [
  10047. _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  10048. key: 0,
  10049. class: normalizeClass(_ctx.ns.b("panel"))
  10050. }, [
  10051. createElementVNode("div", {
  10052. class: normalizeClass([_ctx.ns.be("panel", "content"), { "has-seconds": _ctx.showSeconds }])
  10053. }, [
  10054. createVNode(_component_time_spinner, {
  10055. ref: "spinner",
  10056. role: _ctx.datetimeRole || "start",
  10057. "arrow-control": _ctx.arrowControl,
  10058. "show-seconds": _ctx.showSeconds,
  10059. "am-pm-mode": _ctx.amPmMode,
  10060. "spinner-date": _ctx.parsedValue,
  10061. "disabled-hours": _ctx.disabledHours,
  10062. "disabled-minutes": _ctx.disabledMinutes,
  10063. "disabled-seconds": _ctx.disabledSeconds,
  10064. onChange: _ctx.handleChange,
  10065. onSetOption: _ctx.onSetOption,
  10066. onSelectRange: _ctx.setSelectionRange
  10067. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10068. ], 2),
  10069. createElementVNode("div", {
  10070. class: normalizeClass(_ctx.ns.be("panel", "footer"))
  10071. }, [
  10072. createElementVNode("button", {
  10073. type: "button",
  10074. class: normalizeClass([_ctx.ns.be("panel", "btn"), "cancel"]),
  10075. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleCancel && _ctx.handleCancel(...args))
  10076. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10077. createElementVNode("button", {
  10078. type: "button",
  10079. class: normalizeClass([_ctx.ns.be("panel", "btn"), "confirm"]),
  10080. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10081. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 3)
  10082. ], 2)
  10083. ], 2)) : createCommentVNode("v-if", true)
  10084. ]),
  10085. _: 1
  10086. }, 8, ["name"]);
  10087. }
  10088. var TimePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$Q, [["render", _sfc_render$u], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-pick.vue"]]);
  10089. const makeSelectRange = (start2, end2) => {
  10090. const result = [];
  10091. for (let i = start2; i <= end2; i++) {
  10092. result.push(i);
  10093. }
  10094. return result;
  10095. };
  10096. const _sfc_main$P = defineComponent({
  10097. components: { TimeSpinner },
  10098. props: {
  10099. visible: Boolean,
  10100. actualVisible: Boolean,
  10101. parsedValue: {
  10102. type: [Array]
  10103. },
  10104. format: {
  10105. type: String,
  10106. default: ""
  10107. }
  10108. },
  10109. emits: ["pick", "select-range", "set-picker-option"],
  10110. setup(props, ctx) {
  10111. const { t, lang } = useLocale();
  10112. const nsTime = useNamespace("time");
  10113. const nsPicker = useNamespace("picker");
  10114. const minDate = computed(() => props.parsedValue[0]);
  10115. const maxDate = computed(() => props.parsedValue[1]);
  10116. const oldValue = useOldValue(props);
  10117. const handleCancel = () => {
  10118. ctx.emit("pick", oldValue.value, false);
  10119. };
  10120. const showSeconds = computed(() => {
  10121. return props.format.includes("ss");
  10122. });
  10123. const amPmMode = computed(() => {
  10124. if (props.format.includes("A"))
  10125. return "A";
  10126. if (props.format.includes("a"))
  10127. return "a";
  10128. return "";
  10129. });
  10130. const minSelectableRange = ref([]);
  10131. const maxSelectableRange = ref([]);
  10132. const handleConfirm = (visible = false) => {
  10133. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  10134. };
  10135. const handleMinChange = (date4) => {
  10136. handleChange2(date4.millisecond(0), maxDate.value);
  10137. };
  10138. const handleMaxChange = (date4) => {
  10139. handleChange2(minDate.value, date4.millisecond(0));
  10140. };
  10141. const isValidValue = (_date) => {
  10142. const parsedDate = _date.map((_2) => dayjs(_2).locale(lang.value));
  10143. const result = getRangeAvailableTime(parsedDate);
  10144. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  10145. };
  10146. const handleChange2 = (_minDate, _maxDate) => {
  10147. ctx.emit("pick", [_minDate, _maxDate], true);
  10148. };
  10149. const btnConfirmDisabled = computed(() => {
  10150. return minDate.value > maxDate.value;
  10151. });
  10152. const selectionRange = ref([0, 2]);
  10153. const setMinSelectionRange = (start2, end2) => {
  10154. ctx.emit("select-range", start2, end2, "min");
  10155. selectionRange.value = [start2, end2];
  10156. };
  10157. const offset2 = computed(() => showSeconds.value ? 11 : 8);
  10158. const setMaxSelectionRange = (start2, end2) => {
  10159. ctx.emit("select-range", start2, end2, "max");
  10160. selectionRange.value = [start2 + offset2.value, end2 + offset2.value];
  10161. };
  10162. const changeSelectionRange = (step) => {
  10163. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  10164. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  10165. const index = list.indexOf(selectionRange.value[0]);
  10166. const next = (index + step + list.length) % list.length;
  10167. const half = list.length / 2;
  10168. if (next < half) {
  10169. timePickerOptions["start_emitSelectRange"](mapping[next]);
  10170. } else {
  10171. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  10172. }
  10173. };
  10174. const handleKeydown = (event) => {
  10175. const code = event.code;
  10176. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  10177. const step = code === EVENT_CODE.left ? -1 : 1;
  10178. changeSelectionRange(step);
  10179. event.preventDefault();
  10180. return;
  10181. }
  10182. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  10183. const step = code === EVENT_CODE.up ? -1 : 1;
  10184. const role = selectionRange.value[0] < offset2.value ? "start" : "end";
  10185. timePickerOptions[`${role}_scrollDown`](step);
  10186. event.preventDefault();
  10187. return;
  10188. }
  10189. };
  10190. const disabledHours_ = (role, compare) => {
  10191. const defaultDisable = disabledHours ? disabledHours(role) : [];
  10192. const isStart = role === "start";
  10193. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10194. const compareHour = compareDate.hour();
  10195. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  10196. return union$1(defaultDisable, nextDisable);
  10197. };
  10198. const disabledMinutes_ = (hour, role, compare) => {
  10199. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  10200. const isStart = role === "start";
  10201. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10202. const compareHour = compareDate.hour();
  10203. if (hour !== compareHour) {
  10204. return defaultDisable;
  10205. }
  10206. const compareMinute = compareDate.minute();
  10207. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  10208. return union$1(defaultDisable, nextDisable);
  10209. };
  10210. const disabledSeconds_ = (hour, minute, role, compare) => {
  10211. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  10212. const isStart = role === "start";
  10213. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10214. const compareHour = compareDate.hour();
  10215. const compareMinute = compareDate.minute();
  10216. if (hour !== compareHour || minute !== compareMinute) {
  10217. return defaultDisable;
  10218. }
  10219. const compareSecond = compareDate.second();
  10220. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  10221. return union$1(defaultDisable, nextDisable);
  10222. };
  10223. const getRangeAvailableTime = (dates) => {
  10224. return dates.map((_2, index) => getRangeAvailableTimeEach(dates[0], dates[1], index === 0 ? "start" : "end"));
  10225. };
  10226. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours_, disabledMinutes_, disabledSeconds_);
  10227. const getRangeAvailableTimeEach = (startDate, endDate, role) => {
  10228. const availableMap = {
  10229. hour: getAvailableHours,
  10230. minute: getAvailableMinutes,
  10231. second: getAvailableSeconds
  10232. };
  10233. const isStart = role === "start";
  10234. let result = isStart ? startDate : endDate;
  10235. const compareDate = isStart ? endDate : startDate;
  10236. ["hour", "minute", "second"].forEach((_2) => {
  10237. if (availableMap[_2]) {
  10238. let availableArr;
  10239. const method4 = availableMap[_2];
  10240. if (_2 === "minute") {
  10241. availableArr = method4(result.hour(), role, compareDate);
  10242. } else if (_2 === "second") {
  10243. availableArr = method4(result.hour(), result.minute(), role, compareDate);
  10244. } else {
  10245. availableArr = method4(role, compareDate);
  10246. }
  10247. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10248. const pos = isStart ? 0 : availableArr.length - 1;
  10249. result = result[_2](availableArr[pos]);
  10250. }
  10251. }
  10252. });
  10253. return result;
  10254. };
  10255. const parseUserInput = (value) => {
  10256. if (!value)
  10257. return null;
  10258. if (Array.isArray(value)) {
  10259. return value.map((_2) => dayjs(_2, props.format).locale(lang.value));
  10260. }
  10261. return dayjs(value, props.format).locale(lang.value);
  10262. };
  10263. const formatToString = (value) => {
  10264. if (!value)
  10265. return null;
  10266. if (Array.isArray(value)) {
  10267. return value.map((_2) => _2.format(props.format));
  10268. }
  10269. return value.format(props.format);
  10270. };
  10271. const getDefaultValue = () => {
  10272. if (Array.isArray(defaultValue)) {
  10273. return defaultValue.map((_2) => dayjs(_2).locale(lang.value));
  10274. }
  10275. const defaultDay = dayjs(defaultValue).locale(lang.value);
  10276. return [defaultDay, defaultDay.add(60, "m")];
  10277. };
  10278. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10279. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10280. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10281. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10282. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10283. ctx.emit("set-picker-option", [
  10284. "getRangeAvailableTime",
  10285. getRangeAvailableTime
  10286. ]);
  10287. const timePickerOptions = {};
  10288. const onSetOption = (e) => {
  10289. timePickerOptions[e[0]] = e[1];
  10290. };
  10291. const pickerBase = inject("EP_PICKER_BASE");
  10292. const {
  10293. arrowControl,
  10294. disabledHours,
  10295. disabledMinutes,
  10296. disabledSeconds,
  10297. defaultValue
  10298. } = pickerBase.props;
  10299. return {
  10300. nsTime,
  10301. nsPicker,
  10302. arrowControl,
  10303. onSetOption,
  10304. setMaxSelectionRange,
  10305. setMinSelectionRange,
  10306. btnConfirmDisabled,
  10307. handleCancel,
  10308. handleConfirm,
  10309. t,
  10310. showSeconds,
  10311. minDate,
  10312. maxDate,
  10313. amPmMode,
  10314. handleMinChange,
  10315. handleMaxChange,
  10316. minSelectableRange,
  10317. maxSelectableRange,
  10318. disabledHours_,
  10319. disabledMinutes_,
  10320. disabledSeconds_
  10321. };
  10322. }
  10323. });
  10324. const _hoisted_1$x = ["disabled"];
  10325. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  10326. const _component_time_spinner = resolveComponent("time-spinner");
  10327. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  10328. key: 0,
  10329. class: normalizeClass([_ctx.nsTime.b("range-picker"), _ctx.nsPicker.b("panel")])
  10330. }, [
  10331. createElementVNode("div", {
  10332. class: normalizeClass(_ctx.nsTime.be("range-picker", "content"))
  10333. }, [
  10334. createElementVNode("div", {
  10335. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10336. }, [
  10337. createElementVNode("div", {
  10338. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10339. }, toDisplayString(_ctx.t("el.datepicker.startTime")), 3),
  10340. createElementVNode("div", {
  10341. class: normalizeClass([
  10342. _ctx.nsTime.be("range-picker", "body"),
  10343. _ctx.nsTime.be("panel", "content"),
  10344. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10345. { "has-seconds": _ctx.showSeconds }
  10346. ])
  10347. }, [
  10348. createVNode(_component_time_spinner, {
  10349. ref: "minSpinner",
  10350. role: "start",
  10351. "show-seconds": _ctx.showSeconds,
  10352. "am-pm-mode": _ctx.amPmMode,
  10353. "arrow-control": _ctx.arrowControl,
  10354. "spinner-date": _ctx.minDate,
  10355. "disabled-hours": _ctx.disabledHours_,
  10356. "disabled-minutes": _ctx.disabledMinutes_,
  10357. "disabled-seconds": _ctx.disabledSeconds_,
  10358. onChange: _ctx.handleMinChange,
  10359. onSetOption: _ctx.onSetOption,
  10360. onSelectRange: _ctx.setMinSelectionRange
  10361. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10362. ], 2)
  10363. ], 2),
  10364. createElementVNode("div", {
  10365. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10366. }, [
  10367. createElementVNode("div", {
  10368. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10369. }, toDisplayString(_ctx.t("el.datepicker.endTime")), 3),
  10370. createElementVNode("div", {
  10371. class: normalizeClass([
  10372. _ctx.nsTime.be("range-picker", "body"),
  10373. _ctx.nsTime.be("panel", "content"),
  10374. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10375. { "has-seconds": _ctx.showSeconds }
  10376. ])
  10377. }, [
  10378. createVNode(_component_time_spinner, {
  10379. ref: "maxSpinner",
  10380. role: "end",
  10381. "show-seconds": _ctx.showSeconds,
  10382. "am-pm-mode": _ctx.amPmMode,
  10383. "arrow-control": _ctx.arrowControl,
  10384. "spinner-date": _ctx.maxDate,
  10385. "disabled-hours": _ctx.disabledHours_,
  10386. "disabled-minutes": _ctx.disabledMinutes_,
  10387. "disabled-seconds": _ctx.disabledSeconds_,
  10388. onChange: _ctx.handleMaxChange,
  10389. onSetOption: _ctx.onSetOption,
  10390. onSelectRange: _ctx.setMaxSelectionRange
  10391. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10392. ], 2)
  10393. ], 2)
  10394. ], 2),
  10395. createElementVNode("div", {
  10396. class: normalizeClass(_ctx.nsTime.be("panel", "footer"))
  10397. }, [
  10398. createElementVNode("button", {
  10399. type: "button",
  10400. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "cancel"]),
  10401. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleCancel())
  10402. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10403. createElementVNode("button", {
  10404. type: "button",
  10405. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "confirm"]),
  10406. disabled: _ctx.btnConfirmDisabled,
  10407. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10408. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 11, _hoisted_1$x)
  10409. ], 2)
  10410. ], 2)) : createCommentVNode("v-if", true);
  10411. }
  10412. var TimeRangePanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$P, [["render", _sfc_render$t], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-range.vue"]]);
  10413. dayjs.extend(customParseFormat);
  10414. var TimePicker = defineComponent({
  10415. name: "ElTimePicker",
  10416. install: null,
  10417. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  10418. isRange: {
  10419. type: Boolean,
  10420. default: false
  10421. }
  10422. }),
  10423. emits: ["update:modelValue"],
  10424. setup(props, ctx) {
  10425. const commonPicker = ref(null);
  10426. const type4 = props.isRange ? "timerange" : "time";
  10427. const panel = props.isRange ? TimeRangePanel : TimePickPanel;
  10428. const refProps = __spreadProps(__spreadValues({}, props), {
  10429. focus: () => {
  10430. var _a2;
  10431. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleFocus();
  10432. },
  10433. blur: () => {
  10434. var _a2;
  10435. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleBlur();
  10436. }
  10437. });
  10438. provide("ElPopperOptions", props.popperOptions);
  10439. ctx.expose(refProps);
  10440. return () => {
  10441. var _a2;
  10442. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_TIME;
  10443. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  10444. format: format2,
  10445. type: type4,
  10446. ref: commonPicker,
  10447. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  10448. }), {
  10449. default: (scopedProps) => h$1(panel, scopedProps)
  10450. });
  10451. };
  10452. }
  10453. });
  10454. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  10455. const extractDateFormat = (format2) => {
  10456. return format2.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  10457. };
  10458. const extractTimeFormat = (format2) => {
  10459. return format2.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  10460. };
  10461. const _TimePicker = TimePicker;
  10462. _TimePicker.install = (app) => {
  10463. app.component(_TimePicker.name, _TimePicker);
  10464. };
  10465. const ElTimePicker = _TimePicker;
  10466. const useCheckboxProps = {
  10467. modelValue: {
  10468. type: [Boolean, Number, String],
  10469. default: () => void 0
  10470. },
  10471. label: {
  10472. type: [String, Boolean, Number, Object]
  10473. },
  10474. indeterminate: Boolean,
  10475. disabled: Boolean,
  10476. checked: Boolean,
  10477. name: {
  10478. type: String,
  10479. default: void 0
  10480. },
  10481. trueLabel: {
  10482. type: [String, Number],
  10483. default: void 0
  10484. },
  10485. falseLabel: {
  10486. type: [String, Number],
  10487. default: void 0
  10488. },
  10489. tabindex: [String, Number],
  10490. size: String
  10491. };
  10492. const useCheckboxGroup = () => {
  10493. const elForm2 = inject(formContextKey, {});
  10494. const elFormItem2 = inject(formItemContextKey, {});
  10495. const checkboxGroup = inject("CheckboxGroup", {});
  10496. const isGroup = computed(() => checkboxGroup && (checkboxGroup == null ? void 0 : checkboxGroup.name) === "ElCheckboxGroup");
  10497. const elFormItemSize = computed(() => {
  10498. return elFormItem2.size;
  10499. });
  10500. return {
  10501. isGroup,
  10502. checkboxGroup,
  10503. elForm: elForm2,
  10504. elFormItemSize,
  10505. elFormItem: elFormItem2
  10506. };
  10507. };
  10508. const useModel = (props) => {
  10509. const selfModel = ref(false);
  10510. const { emit } = getCurrentInstance();
  10511. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10512. const isLimitExceeded = ref(false);
  10513. const model = computed({
  10514. get() {
  10515. var _a2, _b2;
  10516. return isGroup.value ? (_a2 = checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b2 = props.modelValue) != null ? _b2 : selfModel.value;
  10517. },
  10518. set(val) {
  10519. var _a2;
  10520. if (isGroup.value && Array.isArray(val)) {
  10521. isLimitExceeded.value = checkboxGroup.max !== void 0 && val.length > checkboxGroup.max.value;
  10522. isLimitExceeded.value === false && ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _a2.call(checkboxGroup, val));
  10523. } else {
  10524. emit(UPDATE_MODEL_EVENT, val);
  10525. selfModel.value = val;
  10526. }
  10527. }
  10528. });
  10529. return {
  10530. model,
  10531. isLimitExceeded
  10532. };
  10533. };
  10534. const useCheckboxStatus = (props, { model }) => {
  10535. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10536. const focus = ref(false);
  10537. const size = useSize(checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize, { prop: true });
  10538. const isChecked = computed(() => {
  10539. const value = model.value;
  10540. if (toTypeString(value) === "[object Boolean]") {
  10541. return value;
  10542. } else if (Array.isArray(value)) {
  10543. return value.includes(props.label);
  10544. } else if (value !== null && value !== void 0) {
  10545. return value === props.trueLabel;
  10546. } else {
  10547. return !!value;
  10548. }
  10549. });
  10550. const checkboxSize = useSize(computed(() => {
  10551. var _a2;
  10552. return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize) == null ? void 0 : _a2.value : void 0;
  10553. }));
  10554. return {
  10555. isChecked,
  10556. focus,
  10557. size,
  10558. checkboxSize
  10559. };
  10560. };
  10561. const useDisabled = (props, {
  10562. model,
  10563. isChecked
  10564. }) => {
  10565. const { elForm: elForm2, isGroup, checkboxGroup } = useCheckboxGroup();
  10566. const isLimitDisabled = computed(() => {
  10567. var _a2, _b2;
  10568. const max2 = (_a2 = checkboxGroup.max) == null ? void 0 : _a2.value;
  10569. const min2 = (_b2 = checkboxGroup.min) == null ? void 0 : _b2.value;
  10570. return !!(max2 || min2) && model.value.length >= max2 && !isChecked.value || model.value.length <= min2 && isChecked.value;
  10571. });
  10572. const isDisabled = computed(() => {
  10573. var _a2, _b2;
  10574. const disabled = props.disabled || elForm2.disabled;
  10575. return (_b2 = isGroup.value ? ((_a2 = checkboxGroup.disabled) == null ? void 0 : _a2.value) || disabled || isLimitDisabled.value : props.disabled || elForm2.disabled) != null ? _b2 : false;
  10576. });
  10577. return {
  10578. isDisabled,
  10579. isLimitDisabled
  10580. };
  10581. };
  10582. const setStoreValue = (props, { model }) => {
  10583. function addToStore() {
  10584. if (Array.isArray(model.value) && !model.value.includes(props.label)) {
  10585. model.value.push(props.label);
  10586. } else {
  10587. model.value = props.trueLabel || true;
  10588. }
  10589. }
  10590. props.checked && addToStore();
  10591. };
  10592. const useEvent$1 = (props, { isLimitExceeded }) => {
  10593. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  10594. const { emit } = getCurrentInstance();
  10595. function handleChange2(e) {
  10596. var _a2, _b2;
  10597. if (isLimitExceeded.value)
  10598. return;
  10599. const target = e.target;
  10600. const value = target.checked ? (_a2 = props.trueLabel) != null ? _a2 : true : (_b2 = props.falseLabel) != null ? _b2 : false;
  10601. emit("change", value, e);
  10602. }
  10603. watch(() => props.modelValue, () => {
  10604. var _a2;
  10605. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  10606. });
  10607. return {
  10608. handleChange: handleChange2
  10609. };
  10610. };
  10611. const useCheckbox = (props) => {
  10612. const { model, isLimitExceeded } = useModel(props);
  10613. const { focus, size, isChecked, checkboxSize } = useCheckboxStatus(props, {
  10614. model
  10615. });
  10616. const { isDisabled } = useDisabled(props, { model, isChecked });
  10617. const { handleChange: handleChange2 } = useEvent$1(props, { isLimitExceeded });
  10618. setStoreValue(props, { model });
  10619. return {
  10620. isChecked,
  10621. isDisabled,
  10622. checkboxSize,
  10623. model,
  10624. handleChange: handleChange2,
  10625. focus,
  10626. size
  10627. };
  10628. };
  10629. const _sfc_main$O = defineComponent({
  10630. name: "ElCheckbox",
  10631. props: {
  10632. modelValue: {
  10633. type: [Number, String, Boolean],
  10634. default: () => void 0
  10635. },
  10636. label: {
  10637. type: [String, Boolean, Number, Object]
  10638. },
  10639. indeterminate: Boolean,
  10640. disabled: Boolean,
  10641. checked: Boolean,
  10642. name: {
  10643. type: String,
  10644. default: void 0
  10645. },
  10646. trueLabel: {
  10647. type: [String, Number],
  10648. default: void 0
  10649. },
  10650. falseLabel: {
  10651. type: [String, Number],
  10652. default: void 0
  10653. },
  10654. id: {
  10655. type: String,
  10656. default: void 0
  10657. },
  10658. controls: {
  10659. type: String,
  10660. default: void 0
  10661. },
  10662. border: Boolean,
  10663. size: {
  10664. type: String,
  10665. validator: isValidComponentSize
  10666. },
  10667. tabindex: [String, Number]
  10668. },
  10669. emits: [UPDATE_MODEL_EVENT, "change"],
  10670. setup(props) {
  10671. const ns = useNamespace("checkbox");
  10672. return __spreadValues({
  10673. ns
  10674. }, useCheckbox(props));
  10675. }
  10676. });
  10677. const _hoisted_1$w = ["id", "aria-controls"];
  10678. const _hoisted_2$p = ["tabindex", "role", "aria-checked"];
  10679. const _hoisted_3$g = ["aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
  10680. const _hoisted_4$d = ["aria-hidden", "disabled", "value", "name", "tabindex"];
  10681. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  10682. return openBlock(), createElementBlock("label", {
  10683. id: _ctx.id,
  10684. class: normalizeClass([
  10685. _ctx.ns.b(),
  10686. _ctx.ns.m(_ctx.checkboxSize),
  10687. _ctx.ns.is("disabled", _ctx.isDisabled),
  10688. _ctx.ns.is("bordered", _ctx.border),
  10689. _ctx.ns.is("checked", _ctx.isChecked)
  10690. ]),
  10691. "aria-controls": _ctx.indeterminate ? _ctx.controls : null
  10692. }, [
  10693. createElementVNode("span", {
  10694. class: normalizeClass([
  10695. _ctx.ns.e("input"),
  10696. _ctx.ns.is("disabled", _ctx.isDisabled),
  10697. _ctx.ns.is("checked", _ctx.isChecked),
  10698. _ctx.ns.is("indeterminate", _ctx.indeterminate),
  10699. _ctx.ns.is("focus", _ctx.focus)
  10700. ]),
  10701. tabindex: _ctx.indeterminate ? 0 : void 0,
  10702. role: _ctx.indeterminate ? "checkbox" : void 0,
  10703. "aria-checked": _ctx.indeterminate ? "mixed" : false
  10704. }, [
  10705. createElementVNode("span", {
  10706. class: normalizeClass(_ctx.ns.e("inner"))
  10707. }, null, 2),
  10708. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10709. key: 0,
  10710. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10711. class: normalizeClass(_ctx.ns.e("original")),
  10712. type: "checkbox",
  10713. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10714. name: _ctx.name,
  10715. tabindex: _ctx.tabindex,
  10716. disabled: _ctx.isDisabled,
  10717. "true-value": _ctx.trueLabel,
  10718. "false-value": _ctx.falseLabel,
  10719. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10720. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10721. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10722. }, null, 42, _hoisted_3$g)), [
  10723. [vModelCheckbox, _ctx.model]
  10724. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10725. key: 1,
  10726. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10727. class: normalizeClass(_ctx.ns.e("original")),
  10728. type: "checkbox",
  10729. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10730. disabled: _ctx.isDisabled,
  10731. value: _ctx.label,
  10732. name: _ctx.name,
  10733. tabindex: _ctx.tabindex,
  10734. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10735. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10736. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10737. }, null, 42, _hoisted_4$d)), [
  10738. [vModelCheckbox, _ctx.model]
  10739. ])
  10740. ], 10, _hoisted_2$p),
  10741. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  10742. key: 0,
  10743. class: normalizeClass(_ctx.ns.e("label"))
  10744. }, [
  10745. renderSlot(_ctx.$slots, "default"),
  10746. !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10747. createTextVNode(toDisplayString(_ctx.label), 1)
  10748. ], 2112)) : createCommentVNode("v-if", true)
  10749. ], 2)) : createCommentVNode("v-if", true)
  10750. ], 10, _hoisted_1$w);
  10751. }
  10752. var Checkbox = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["render", _sfc_render$s], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);
  10753. const _sfc_main$N = defineComponent({
  10754. name: "ElCheckboxButton",
  10755. props: useCheckboxProps,
  10756. emits: [UPDATE_MODEL_EVENT, "change"],
  10757. setup(props) {
  10758. const { focus, isChecked, isDisabled, size, model, handleChange: handleChange2 } = useCheckbox(props);
  10759. const { checkboxGroup } = useCheckboxGroup();
  10760. const ns = useNamespace("checkbox");
  10761. const activeStyle = computed(() => {
  10762. var _a2, _b2, _c, _d;
  10763. const fillValue = (_b2 = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b2 : "";
  10764. return {
  10765. backgroundColor: fillValue,
  10766. borderColor: fillValue,
  10767. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  10768. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : null
  10769. };
  10770. });
  10771. return {
  10772. focus,
  10773. isChecked,
  10774. isDisabled,
  10775. model,
  10776. handleChange: handleChange2,
  10777. activeStyle,
  10778. size,
  10779. ns
  10780. };
  10781. }
  10782. });
  10783. const _hoisted_1$v = ["aria-checked", "aria-disabled"];
  10784. const _hoisted_2$o = ["name", "tabindex", "disabled", "true-value", "false-value"];
  10785. const _hoisted_3$f = ["name", "tabindex", "disabled", "value"];
  10786. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  10787. return openBlock(), createElementBlock("label", {
  10788. class: normalizeClass([
  10789. _ctx.ns.b("button"),
  10790. _ctx.ns.bm("button", _ctx.size),
  10791. _ctx.ns.is("disabled", _ctx.isDisabled),
  10792. _ctx.ns.is("checked", _ctx.isChecked),
  10793. _ctx.ns.is("focus", _ctx.focus)
  10794. ]),
  10795. role: "checkbox",
  10796. "aria-checked": _ctx.isChecked,
  10797. "aria-disabled": _ctx.isDisabled
  10798. }, [
  10799. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10800. key: 0,
  10801. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10802. class: normalizeClass(_ctx.ns.be("button", "original")),
  10803. type: "checkbox",
  10804. name: _ctx.name,
  10805. tabindex: _ctx.tabindex,
  10806. disabled: _ctx.isDisabled,
  10807. "true-value": _ctx.trueLabel,
  10808. "false-value": _ctx.falseLabel,
  10809. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10810. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10811. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10812. }, null, 42, _hoisted_2$o)), [
  10813. [vModelCheckbox, _ctx.model]
  10814. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10815. key: 1,
  10816. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10817. class: normalizeClass(_ctx.ns.be("button", "original")),
  10818. type: "checkbox",
  10819. name: _ctx.name,
  10820. tabindex: _ctx.tabindex,
  10821. disabled: _ctx.isDisabled,
  10822. value: _ctx.label,
  10823. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10824. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10825. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10826. }, null, 42, _hoisted_3$f)), [
  10827. [vModelCheckbox, _ctx.model]
  10828. ]),
  10829. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  10830. key: 2,
  10831. class: normalizeClass(_ctx.ns.be("button", "inner")),
  10832. style: normalizeStyle(_ctx.isChecked ? _ctx.activeStyle : null)
  10833. }, [
  10834. renderSlot(_ctx.$slots, "default", {}, () => [
  10835. createTextVNode(toDisplayString(_ctx.label), 1)
  10836. ])
  10837. ], 6)) : createCommentVNode("v-if", true)
  10838. ], 10, _hoisted_1$v);
  10839. }
  10840. var CheckboxButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["render", _sfc_render$r], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);
  10841. const _sfc_main$M = defineComponent({
  10842. name: "ElCheckboxGroup",
  10843. props: {
  10844. modelValue: {
  10845. type: Array,
  10846. default: () => []
  10847. },
  10848. disabled: Boolean,
  10849. min: {
  10850. type: Number,
  10851. default: void 0
  10852. },
  10853. max: {
  10854. type: Number,
  10855. default: void 0
  10856. },
  10857. size: {
  10858. type: String,
  10859. validator: isValidComponentSize
  10860. },
  10861. fill: {
  10862. type: String,
  10863. default: void 0
  10864. },
  10865. textColor: {
  10866. type: String,
  10867. default: void 0
  10868. },
  10869. tag: {
  10870. type: String,
  10871. default: "div"
  10872. }
  10873. },
  10874. emits: [UPDATE_MODEL_EVENT, "change"],
  10875. setup(props, { emit, slots }) {
  10876. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  10877. const checkboxGroupSize = useSize();
  10878. const ns = useNamespace("checkbox");
  10879. const changeEvent = (value) => {
  10880. emit(UPDATE_MODEL_EVENT, value);
  10881. nextTick(() => {
  10882. emit("change", value);
  10883. });
  10884. };
  10885. const modelValue = computed({
  10886. get() {
  10887. return props.modelValue;
  10888. },
  10889. set(val) {
  10890. changeEvent(val);
  10891. }
  10892. });
  10893. provide("CheckboxGroup", __spreadProps(__spreadValues({
  10894. name: "ElCheckboxGroup",
  10895. modelValue
  10896. }, toRefs(props)), {
  10897. checkboxGroupSize,
  10898. changeEvent
  10899. }));
  10900. watch(() => props.modelValue, () => {
  10901. var _a2;
  10902. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  10903. });
  10904. return () => {
  10905. return h$1(props.tag, {
  10906. class: ns.b("group"),
  10907. role: "group",
  10908. "aria-label": "checkbox-group"
  10909. }, [renderSlot(slots, "default")]);
  10910. };
  10911. }
  10912. });
  10913. var CheckboxGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);
  10914. const ElCheckbox = withInstall(Checkbox, {
  10915. CheckboxButton,
  10916. CheckboxGroup
  10917. });
  10918. withNoopInstall(CheckboxButton);
  10919. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  10920. const radioPropsBase = buildProps({
  10921. size: useSizeProp,
  10922. disabled: Boolean,
  10923. label: {
  10924. type: [String, Number, Boolean],
  10925. default: ""
  10926. }
  10927. });
  10928. const radioProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  10929. modelValue: {
  10930. type: [String, Number, Boolean],
  10931. default: ""
  10932. },
  10933. name: {
  10934. type: String,
  10935. default: ""
  10936. },
  10937. border: Boolean
  10938. }));
  10939. const radioEmits = {
  10940. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  10941. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  10942. };
  10943. const useRadio = (props, emit) => {
  10944. const radioRef = ref();
  10945. const radioGroup = inject(radioGroupKey, void 0);
  10946. const isGroup = computed(() => !!radioGroup);
  10947. const modelValue = computed({
  10948. get() {
  10949. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  10950. },
  10951. set(val) {
  10952. if (isGroup.value) {
  10953. radioGroup.changeEvent(val);
  10954. } else {
  10955. emit(UPDATE_MODEL_EVENT, val);
  10956. }
  10957. radioRef.value.checked = props.modelValue === props.label;
  10958. }
  10959. });
  10960. const size = useSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
  10961. const disabled = useDisabled$1(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  10962. const focus = ref(false);
  10963. const tabIndex = computed(() => {
  10964. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  10965. });
  10966. return {
  10967. radioRef,
  10968. isGroup,
  10969. radioGroup,
  10970. focus,
  10971. size,
  10972. disabled,
  10973. tabIndex,
  10974. modelValue
  10975. };
  10976. };
  10977. const _sfc_main$L = defineComponent({
  10978. name: "ElRadio",
  10979. props: radioProps,
  10980. emits: radioEmits,
  10981. setup(props, { emit }) {
  10982. const ns = useNamespace("radio");
  10983. const { radioRef, isGroup, focus, size, disabled, tabIndex, modelValue } = useRadio(props, emit);
  10984. function handleChange2() {
  10985. nextTick(() => emit("change", modelValue.value));
  10986. }
  10987. return {
  10988. ns,
  10989. focus,
  10990. isGroup,
  10991. modelValue,
  10992. tabIndex,
  10993. size,
  10994. disabled,
  10995. radioRef,
  10996. handleChange: handleChange2
  10997. };
  10998. }
  10999. });
  11000. const _hoisted_1$u = ["aria-checked", "aria-disabled", "tabindex"];
  11001. const _hoisted_2$n = ["value", "name", "disabled"];
  11002. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  11003. return openBlock(), createElementBlock("label", {
  11004. class: normalizeClass([
  11005. _ctx.ns.b(),
  11006. _ctx.ns.is("disabled", _ctx.disabled),
  11007. _ctx.ns.is("focus", _ctx.focus),
  11008. _ctx.ns.is("bordered", _ctx.border),
  11009. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label),
  11010. _ctx.ns.m(_ctx.size)
  11011. ]),
  11012. role: "radio",
  11013. "aria-checked": _ctx.modelValue === _ctx.label,
  11014. "aria-disabled": _ctx.disabled,
  11015. tabindex: _ctx.tabIndex,
  11016. onKeydown: _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11017. }, [
  11018. createElementVNode("span", {
  11019. class: normalizeClass([
  11020. _ctx.ns.e("input"),
  11021. _ctx.ns.is("disabled", _ctx.disabled),
  11022. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label)
  11023. ])
  11024. }, [
  11025. createElementVNode("span", {
  11026. class: normalizeClass(_ctx.ns.e("inner"))
  11027. }, null, 2),
  11028. withDirectives(createElementVNode("input", {
  11029. ref: "radioRef",
  11030. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11031. class: normalizeClass(_ctx.ns.e("original")),
  11032. value: _ctx.label,
  11033. type: "radio",
  11034. "aria-hidden": "true",
  11035. name: _ctx.name,
  11036. disabled: _ctx.disabled,
  11037. tabindex: "-1",
  11038. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11039. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false),
  11040. onChange: _cache[3] || (_cache[3] = (...args) => _ctx.handleChange && _ctx.handleChange(...args))
  11041. }, null, 42, _hoisted_2$n), [
  11042. [vModelRadio, _ctx.modelValue]
  11043. ])
  11044. ], 2),
  11045. createElementVNode("span", {
  11046. class: normalizeClass(_ctx.ns.e("label")),
  11047. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {
  11048. }, ["stop"]))
  11049. }, [
  11050. renderSlot(_ctx.$slots, "default", {}, () => [
  11051. createTextVNode(toDisplayString(_ctx.label), 1)
  11052. ])
  11053. ], 34)
  11054. ], 42, _hoisted_1$u);
  11055. }
  11056. var Radio = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["render", _sfc_render$q], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
  11057. const radioButtonProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  11058. name: {
  11059. type: String,
  11060. default: ""
  11061. }
  11062. }));
  11063. const _sfc_main$K = defineComponent({
  11064. name: "ElRadioButton",
  11065. props: radioButtonProps,
  11066. setup(props, { emit }) {
  11067. const ns = useNamespace("radio");
  11068. const {
  11069. radioRef,
  11070. isGroup,
  11071. focus,
  11072. size,
  11073. disabled,
  11074. tabIndex,
  11075. modelValue,
  11076. radioGroup
  11077. } = useRadio(props, emit);
  11078. const activeStyle = computed(() => {
  11079. return {
  11080. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11081. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11082. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  11083. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  11084. };
  11085. });
  11086. return {
  11087. ns,
  11088. isGroup,
  11089. size,
  11090. disabled,
  11091. tabIndex,
  11092. modelValue,
  11093. focus,
  11094. activeStyle,
  11095. radioRef
  11096. };
  11097. }
  11098. });
  11099. const _hoisted_1$t = ["aria-checked", "aria-disabled", "tabindex"];
  11100. const _hoisted_2$m = ["value", "name", "disabled"];
  11101. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  11102. return openBlock(), createElementBlock("label", {
  11103. class: normalizeClass([
  11104. _ctx.ns.b("button"),
  11105. _ctx.ns.is("active", _ctx.modelValue === _ctx.label),
  11106. _ctx.ns.is("disabled", _ctx.disabled),
  11107. _ctx.ns.is("focus", _ctx.focus),
  11108. _ctx.ns.bm("button", _ctx.size)
  11109. ]),
  11110. role: "radio",
  11111. "aria-checked": _ctx.modelValue === _ctx.label,
  11112. "aria-disabled": _ctx.disabled,
  11113. tabindex: _ctx.tabIndex,
  11114. onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11115. }, [
  11116. withDirectives(createElementVNode("input", {
  11117. ref: "radioRef",
  11118. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11119. class: normalizeClass(_ctx.ns.be("button", "original-radio")),
  11120. value: _ctx.label,
  11121. type: "radio",
  11122. name: _ctx.name,
  11123. disabled: _ctx.disabled,
  11124. tabindex: "-1",
  11125. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11126. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false)
  11127. }, null, 42, _hoisted_2$m), [
  11128. [vModelRadio, _ctx.modelValue]
  11129. ]),
  11130. createElementVNode("span", {
  11131. class: normalizeClass(_ctx.ns.be("button", "inner")),
  11132. style: normalizeStyle(_ctx.modelValue === _ctx.label ? _ctx.activeStyle : {}),
  11133. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  11134. }, ["stop"]))
  11135. }, [
  11136. renderSlot(_ctx.$slots, "default", {}, () => [
  11137. createTextVNode(toDisplayString(_ctx.label), 1)
  11138. ])
  11139. ], 38)
  11140. ], 42, _hoisted_1$t);
  11141. }
  11142. var RadioButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["render", _sfc_render$p], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
  11143. const radioGroupProps = buildProps({
  11144. size: useSizeProp,
  11145. disabled: Boolean,
  11146. modelValue: {
  11147. type: [String, Number, Boolean],
  11148. default: ""
  11149. },
  11150. fill: {
  11151. type: String,
  11152. default: ""
  11153. },
  11154. textColor: {
  11155. type: String,
  11156. default: ""
  11157. }
  11158. });
  11159. const radioGroupEmits = radioEmits;
  11160. const _sfc_main$J = defineComponent({
  11161. name: "ElRadioGroup",
  11162. props: radioGroupProps,
  11163. emits: radioGroupEmits,
  11164. setup(props, ctx) {
  11165. const ns = useNamespace("radio");
  11166. const radioGroupRef = ref();
  11167. const { formItem } = useFormItem();
  11168. const changeEvent = (value) => {
  11169. ctx.emit(UPDATE_MODEL_EVENT, value);
  11170. nextTick(() => ctx.emit("change", value));
  11171. };
  11172. const handleKeydown = (e) => {
  11173. if (!radioGroupRef.value)
  11174. return;
  11175. const target = e.target;
  11176. const className = target.nodeName === "INPUT" ? "[type=radio]" : "[role=radio]";
  11177. const radios = radioGroupRef.value.querySelectorAll(className);
  11178. const length = radios.length;
  11179. const index = Array.from(radios).indexOf(target);
  11180. const roleRadios = radioGroupRef.value.querySelectorAll("[role=radio]");
  11181. let nextIndex = null;
  11182. switch (e.code) {
  11183. case EVENT_CODE.left:
  11184. case EVENT_CODE.up:
  11185. e.stopPropagation();
  11186. e.preventDefault();
  11187. nextIndex = index === 0 ? length - 1 : index - 1;
  11188. break;
  11189. case EVENT_CODE.right:
  11190. case EVENT_CODE.down:
  11191. e.stopPropagation();
  11192. e.preventDefault();
  11193. nextIndex = index === length - 1 ? 0 : index + 1;
  11194. break;
  11195. }
  11196. if (nextIndex === null)
  11197. return;
  11198. roleRadios[nextIndex].click();
  11199. roleRadios[nextIndex].focus();
  11200. };
  11201. onMounted(() => {
  11202. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  11203. const firstLabel = radios[0];
  11204. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  11205. firstLabel.tabIndex = 0;
  11206. }
  11207. });
  11208. provide(radioGroupKey, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  11209. changeEvent
  11210. })));
  11211. watch(() => props.modelValue, () => formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  11212. return {
  11213. ns,
  11214. radioGroupRef,
  11215. handleKeydown
  11216. };
  11217. }
  11218. });
  11219. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  11220. return openBlock(), createElementBlock("div", {
  11221. ref: "radioGroupRef",
  11222. class: normalizeClass(_ctx.ns.b("group")),
  11223. role: "radiogroup",
  11224. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  11225. }, [
  11226. renderSlot(_ctx.$slots, "default")
  11227. ], 34);
  11228. }
  11229. var RadioGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$o], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
  11230. const ElRadio = withInstall(Radio, {
  11231. RadioButton,
  11232. RadioGroup
  11233. });
  11234. const ElRadioGroup = withNoopInstall(RadioGroup);
  11235. const ElRadioButton = withNoopInstall(RadioButton);
  11236. var NodeContent = defineComponent({
  11237. name: "NodeContent",
  11238. setup() {
  11239. const ns = useNamespace("cascader-node");
  11240. return {
  11241. ns
  11242. };
  11243. },
  11244. render() {
  11245. const { ns } = this;
  11246. const { node, panel } = this.$parent;
  11247. const { data: data2, label } = node;
  11248. const { renderLabelFn } = panel;
  11249. return h$1("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data: data2 }) : label);
  11250. }
  11251. });
  11252. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  11253. const _sfc_main$I = defineComponent({
  11254. name: "ElCascaderNode",
  11255. components: {
  11256. ElCheckbox,
  11257. ElRadio,
  11258. NodeContent,
  11259. ElIcon,
  11260. Check: check,
  11261. Loading: loading,
  11262. ArrowRight: arrowRight
  11263. },
  11264. props: {
  11265. node: {
  11266. type: Object,
  11267. required: true
  11268. },
  11269. menuId: String
  11270. },
  11271. emits: ["expand"],
  11272. setup(props, { emit }) {
  11273. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11274. const ns = useNamespace("cascader-node");
  11275. const isHoverMenu = computed(() => panel.isHoverMenu);
  11276. const multiple = computed(() => panel.config.multiple);
  11277. const checkStrictly = computed(() => panel.config.checkStrictly);
  11278. const checkedNodeId = computed(() => {
  11279. var _a2;
  11280. return (_a2 = panel.checkedNodes[0]) == null ? void 0 : _a2.uid;
  11281. });
  11282. const isDisabled = computed(() => props.node.isDisabled);
  11283. const isLeaf2 = computed(() => props.node.isLeaf);
  11284. const expandable = computed(() => checkStrictly.value && !isLeaf2.value || !isDisabled.value);
  11285. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  11286. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  11287. const isInPath = (node) => {
  11288. var _a2;
  11289. const { level, uid: uid2 } = props.node;
  11290. return ((_a2 = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a2.uid) === uid2;
  11291. };
  11292. const doExpand = () => {
  11293. if (inExpandingPath.value)
  11294. return;
  11295. panel.expandNode(props.node);
  11296. };
  11297. const doCheck = (checked) => {
  11298. const { node } = props;
  11299. if (checked === node.checked)
  11300. return;
  11301. panel.handleCheckChange(node, checked);
  11302. };
  11303. const doLoad = () => {
  11304. panel.lazyLoad(props.node, () => {
  11305. if (!isLeaf2.value)
  11306. doExpand();
  11307. });
  11308. };
  11309. const handleHoverExpand = (e) => {
  11310. if (!isHoverMenu.value)
  11311. return;
  11312. handleExpand();
  11313. !isLeaf2.value && emit("expand", e);
  11314. };
  11315. const handleExpand = () => {
  11316. const { node } = props;
  11317. if (!expandable.value || node.loading)
  11318. return;
  11319. node.loaded ? doExpand() : doLoad();
  11320. };
  11321. const handleClick = () => {
  11322. if (isHoverMenu.value && !isLeaf2.value)
  11323. return;
  11324. if (isLeaf2.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  11325. handleCheck(true);
  11326. } else {
  11327. handleExpand();
  11328. }
  11329. };
  11330. const handleSelectCheck = (checked) => {
  11331. if (checkStrictly.value) {
  11332. doCheck(checked);
  11333. if (props.node.loaded) {
  11334. doExpand();
  11335. }
  11336. } else {
  11337. handleCheck(checked);
  11338. }
  11339. };
  11340. const handleCheck = (checked) => {
  11341. if (!props.node.loaded) {
  11342. doLoad();
  11343. } else {
  11344. doCheck(checked);
  11345. !checkStrictly.value && doExpand();
  11346. }
  11347. };
  11348. return {
  11349. panel,
  11350. isHoverMenu,
  11351. multiple,
  11352. checkStrictly,
  11353. checkedNodeId,
  11354. isDisabled,
  11355. isLeaf: isLeaf2,
  11356. expandable,
  11357. inExpandingPath,
  11358. inCheckedPath,
  11359. ns,
  11360. handleHoverExpand,
  11361. handleExpand,
  11362. handleClick,
  11363. handleCheck,
  11364. handleSelectCheck
  11365. };
  11366. }
  11367. });
  11368. const _hoisted_1$s = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  11369. const _hoisted_2$l = /* @__PURE__ */ createElementVNode("span", null, null, -1);
  11370. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  11371. const _component_el_checkbox = resolveComponent("el-checkbox");
  11372. const _component_el_radio = resolveComponent("el-radio");
  11373. const _component_check = resolveComponent("check");
  11374. const _component_el_icon = resolveComponent("el-icon");
  11375. const _component_node_content = resolveComponent("node-content");
  11376. const _component_loading = resolveComponent("loading");
  11377. const _component_arrow_right = resolveComponent("arrow-right");
  11378. return openBlock(), createElementBlock("li", {
  11379. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  11380. role: "menuitem",
  11381. "aria-haspopup": !_ctx.isLeaf,
  11382. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  11383. "aria-expanded": _ctx.inExpandingPath,
  11384. tabindex: _ctx.expandable ? -1 : void 0,
  11385. class: normalizeClass([
  11386. _ctx.ns.b(),
  11387. _ctx.ns.is("selectable", _ctx.checkStrictly),
  11388. _ctx.ns.is("active", _ctx.node.checked),
  11389. _ctx.ns.is("disabled", !_ctx.expandable),
  11390. _ctx.inExpandingPath && "in-active-path",
  11391. _ctx.inCheckedPath && "in-checked-path"
  11392. ]),
  11393. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11394. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11395. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  11396. }, [
  11397. createCommentVNode(" prefix "),
  11398. _ctx.multiple ? (openBlock(), createBlock(_component_el_checkbox, {
  11399. key: 0,
  11400. "model-value": _ctx.node.checked,
  11401. indeterminate: _ctx.node.indeterminate,
  11402. disabled: _ctx.isDisabled,
  11403. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  11404. }, ["stop"])),
  11405. "onUpdate:modelValue": _ctx.handleSelectCheck
  11406. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (openBlock(), createBlock(_component_el_radio, {
  11407. key: 1,
  11408. "model-value": _ctx.checkedNodeId,
  11409. label: _ctx.node.uid,
  11410. disabled: _ctx.isDisabled,
  11411. "onUpdate:modelValue": _ctx.handleSelectCheck,
  11412. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  11413. }, ["stop"]))
  11414. }, {
  11415. default: withCtx(() => [
  11416. 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 "),
  11417. _hoisted_2$l
  11418. ]),
  11419. _: 1
  11420. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (openBlock(), createBlock(_component_el_icon, {
  11421. key: 2,
  11422. class: normalizeClass(_ctx.ns.e("prefix"))
  11423. }, {
  11424. default: withCtx(() => [
  11425. createVNode(_component_check)
  11426. ]),
  11427. _: 1
  11428. }, 8, ["class"])) : createCommentVNode("v-if", true),
  11429. createCommentVNode(" content "),
  11430. createVNode(_component_node_content),
  11431. createCommentVNode(" postfix "),
  11432. !_ctx.isLeaf ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  11433. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  11434. key: 0,
  11435. class: normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  11436. }, {
  11437. default: withCtx(() => [
  11438. createVNode(_component_loading)
  11439. ]),
  11440. _: 1
  11441. }, 8, ["class"])) : (openBlock(), createBlock(_component_el_icon, {
  11442. key: 1,
  11443. class: normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  11444. }, {
  11445. default: withCtx(() => [
  11446. createVNode(_component_arrow_right)
  11447. ]),
  11448. _: 1
  11449. }, 8, ["class"]))
  11450. ], 2112)) : createCommentVNode("v-if", true)
  11451. ], 42, _hoisted_1$s);
  11452. }
  11453. var ElCascaderNode = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["render", _sfc_render$n], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/node.vue"]]);
  11454. const _sfc_main$H = defineComponent({
  11455. name: "ElCascaderMenu",
  11456. components: {
  11457. Loading: loading,
  11458. ElIcon,
  11459. ElScrollbar,
  11460. ElCascaderNode
  11461. },
  11462. props: {
  11463. nodes: {
  11464. type: Array,
  11465. required: true
  11466. },
  11467. index: {
  11468. type: Number,
  11469. required: true
  11470. }
  11471. },
  11472. setup(props) {
  11473. const instance = getCurrentInstance();
  11474. const ns = useNamespace("cascader-menu");
  11475. const { t } = useLocale();
  11476. const id = generateId();
  11477. let activeNode = null;
  11478. let hoverTimer = null;
  11479. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11480. const hoverZone = ref(null);
  11481. const isEmpty3 = computed(() => !props.nodes.length);
  11482. const isLoading = computed(() => !panel.initialLoaded);
  11483. const menuId = computed(() => `cascader-menu-${id}-${props.index}`);
  11484. const handleExpand = (e) => {
  11485. activeNode = e.target;
  11486. };
  11487. const handleMouseMove = (e) => {
  11488. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  11489. return;
  11490. if (activeNode.contains(e.target)) {
  11491. clearHoverTimer();
  11492. const el = instance.vnode.el;
  11493. const { left: left2 } = el.getBoundingClientRect();
  11494. const { offsetWidth, offsetHeight } = el;
  11495. const startX = e.clientX - left2;
  11496. const top2 = activeNode.offsetTop;
  11497. const bottom2 = top2 + activeNode.offsetHeight;
  11498. hoverZone.value.innerHTML = `
  11499. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top2} L${offsetWidth} 0 V${top2} Z" />
  11500. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom2} L${offsetWidth} ${offsetHeight} V${bottom2} Z" />
  11501. `;
  11502. } else if (!hoverTimer) {
  11503. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  11504. }
  11505. };
  11506. const clearHoverTimer = () => {
  11507. if (!hoverTimer)
  11508. return;
  11509. clearTimeout(hoverTimer);
  11510. hoverTimer = null;
  11511. };
  11512. const clearHoverZone = () => {
  11513. if (!hoverZone.value)
  11514. return;
  11515. hoverZone.value.innerHTML = "";
  11516. clearHoverTimer();
  11517. };
  11518. return {
  11519. ns,
  11520. panel,
  11521. hoverZone,
  11522. isEmpty: isEmpty3,
  11523. isLoading,
  11524. menuId,
  11525. t,
  11526. handleExpand,
  11527. handleMouseMove,
  11528. clearHoverZone
  11529. };
  11530. }
  11531. });
  11532. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  11533. const _component_el_cascader_node = resolveComponent("el-cascader-node");
  11534. const _component_loading = resolveComponent("loading");
  11535. const _component_el_icon = resolveComponent("el-icon");
  11536. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  11537. return openBlock(), createBlock(_component_el_scrollbar, {
  11538. key: _ctx.menuId,
  11539. tag: "ul",
  11540. role: "menu",
  11541. class: normalizeClass(_ctx.ns.b()),
  11542. "wrap-class": _ctx.ns.e("wrap"),
  11543. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  11544. onMousemove: _ctx.handleMouseMove,
  11545. onMouseleave: _ctx.clearHoverZone
  11546. }, {
  11547. default: withCtx(() => {
  11548. var _a2;
  11549. return [
  11550. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodes, (node) => {
  11551. return openBlock(), createBlock(_component_el_cascader_node, {
  11552. key: node.uid,
  11553. node,
  11554. "menu-id": _ctx.menuId,
  11555. onExpand: _ctx.handleExpand
  11556. }, null, 8, ["node", "menu-id", "onExpand"]);
  11557. }), 128)),
  11558. _ctx.isLoading ? (openBlock(), createElementBlock("div", {
  11559. key: 0,
  11560. class: normalizeClass(_ctx.ns.e("empty-text"))
  11561. }, [
  11562. createVNode(_component_el_icon, {
  11563. size: "14",
  11564. class: normalizeClass(_ctx.ns.is("loading"))
  11565. }, {
  11566. default: withCtx(() => [
  11567. createVNode(_component_loading)
  11568. ]),
  11569. _: 1
  11570. }, 8, ["class"]),
  11571. createTextVNode(" " + toDisplayString(_ctx.t("el.cascader.loading")), 1)
  11572. ], 2)) : _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  11573. key: 1,
  11574. class: normalizeClass(_ctx.ns.e("empty-text"))
  11575. }, toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a2 = _ctx.panel) == null ? void 0 : _a2.isHoverMenu) ? (openBlock(), createElementBlock("svg", {
  11576. key: 2,
  11577. ref: "hoverZone",
  11578. class: normalizeClass(_ctx.ns.e("hover-zone"))
  11579. }, null, 2)) : createCommentVNode("v-if", true)
  11580. ];
  11581. }),
  11582. _: 1
  11583. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  11584. }
  11585. var ElCascaderMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["render", _sfc_render$m], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/menu.vue"]]);
  11586. var ExpandTrigger = /* @__PURE__ */ ((ExpandTrigger2) => {
  11587. ExpandTrigger2["CLICK"] = "click";
  11588. ExpandTrigger2["HOVER"] = "hover";
  11589. return ExpandTrigger2;
  11590. })(ExpandTrigger || {});
  11591. let uid = 0;
  11592. const calculatePathNodes = (node) => {
  11593. const nodes = [node];
  11594. let { parent } = node;
  11595. while (parent) {
  11596. nodes.unshift(parent);
  11597. parent = parent.parent;
  11598. }
  11599. return nodes;
  11600. };
  11601. class Node {
  11602. constructor(data2, config, parent, root2 = false) {
  11603. this.data = data2;
  11604. this.config = config;
  11605. this.parent = parent;
  11606. this.root = root2;
  11607. this.uid = uid++;
  11608. this.checked = false;
  11609. this.indeterminate = false;
  11610. this.loading = false;
  11611. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  11612. const childrenData = data2[childrenKey];
  11613. const pathNodes = calculatePathNodes(this);
  11614. this.level = root2 ? 0 : parent ? parent.level + 1 : 1;
  11615. this.value = data2[valueKey];
  11616. this.label = data2[labelKey];
  11617. this.pathNodes = pathNodes;
  11618. this.pathValues = pathNodes.map((node) => node.value);
  11619. this.pathLabels = pathNodes.map((node) => node.label);
  11620. this.childrenData = childrenData;
  11621. this.children = (childrenData || []).map((child) => new Node(child, config, this));
  11622. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  11623. }
  11624. get isDisabled() {
  11625. const { data: data2, parent, config } = this;
  11626. const { disabled, checkStrictly } = config;
  11627. const isDisabled = isFunction(disabled) ? disabled(data2, this) : !!data2[disabled];
  11628. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  11629. }
  11630. get isLeaf() {
  11631. const { data: data2, config, childrenData, loaded } = this;
  11632. const { lazy, leaf } = config;
  11633. const isLeaf2 = isFunction(leaf) ? leaf(data2, this) : data2[leaf];
  11634. return isUndefined(isLeaf2) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf2;
  11635. }
  11636. get valueByOption() {
  11637. return this.config.emitPath ? this.pathValues : this.value;
  11638. }
  11639. appendChild(childData) {
  11640. const { childrenData, children } = this;
  11641. const node = new Node(childData, this.config, this);
  11642. if (Array.isArray(childrenData)) {
  11643. childrenData.push(childData);
  11644. } else {
  11645. this.childrenData = [childData];
  11646. }
  11647. children.push(node);
  11648. return node;
  11649. }
  11650. calcText(allLevels, separator) {
  11651. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  11652. this.text = text;
  11653. return text;
  11654. }
  11655. broadcast(event, ...args) {
  11656. const handlerName = `onParent${capitalize(event)}`;
  11657. this.children.forEach((child) => {
  11658. if (child) {
  11659. child.broadcast(event, ...args);
  11660. child[handlerName] && child[handlerName](...args);
  11661. }
  11662. });
  11663. }
  11664. emit(event, ...args) {
  11665. const { parent } = this;
  11666. const handlerName = `onChild${capitalize(event)}`;
  11667. if (parent) {
  11668. parent[handlerName] && parent[handlerName](...args);
  11669. parent.emit(event, ...args);
  11670. }
  11671. }
  11672. onParentCheck(checked) {
  11673. if (!this.isDisabled) {
  11674. this.setCheckState(checked);
  11675. }
  11676. }
  11677. onChildCheck() {
  11678. const { children } = this;
  11679. const validChildren = children.filter((child) => !child.isDisabled);
  11680. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  11681. this.setCheckState(checked);
  11682. }
  11683. setCheckState(checked) {
  11684. const totalNum = this.children.length;
  11685. const checkedNum = this.children.reduce((c, p2) => {
  11686. const num = p2.checked ? 1 : p2.indeterminate ? 0.5 : 0;
  11687. return c + num;
  11688. }, 0);
  11689. this.checked = this.loaded && this.children.every((child) => child.loaded && child.checked) && checked;
  11690. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  11691. }
  11692. doCheck(checked) {
  11693. if (this.checked === checked)
  11694. return;
  11695. const { checkStrictly, multiple } = this.config;
  11696. if (checkStrictly || !multiple) {
  11697. this.checked = checked;
  11698. } else {
  11699. this.broadcast("check", checked);
  11700. this.setCheckState(checked);
  11701. this.emit("check");
  11702. }
  11703. }
  11704. }
  11705. const flatNodes = (nodes, leafOnly) => {
  11706. return nodes.reduce((res, node) => {
  11707. if (node.isLeaf) {
  11708. res.push(node);
  11709. } else {
  11710. !leafOnly && res.push(node);
  11711. res = res.concat(flatNodes(node.children, leafOnly));
  11712. }
  11713. return res;
  11714. }, []);
  11715. };
  11716. class Store {
  11717. constructor(data2, config) {
  11718. this.config = config;
  11719. const nodes = (data2 || []).map((nodeData) => new Node(nodeData, this.config));
  11720. this.nodes = nodes;
  11721. this.allNodes = flatNodes(nodes, false);
  11722. this.leafNodes = flatNodes(nodes, true);
  11723. }
  11724. getNodes() {
  11725. return this.nodes;
  11726. }
  11727. getFlattedNodes(leafOnly) {
  11728. return leafOnly ? this.leafNodes : this.allNodes;
  11729. }
  11730. appendNode(nodeData, parentNode) {
  11731. const node = parentNode ? parentNode.appendChild(nodeData) : new Node(nodeData, this.config);
  11732. if (!parentNode)
  11733. this.nodes.push(node);
  11734. this.allNodes.push(node);
  11735. node.isLeaf && this.leafNodes.push(node);
  11736. }
  11737. appendNodes(nodeDataList, parentNode) {
  11738. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  11739. }
  11740. getNodeByValue(value, leafOnly = false) {
  11741. if (!value && value !== 0)
  11742. return null;
  11743. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual(node2.value, value) || isEqual(node2.pathValues, value));
  11744. return node || null;
  11745. }
  11746. getSameNode(node) {
  11747. if (!node)
  11748. return null;
  11749. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual(node.value, value) && node.level === level);
  11750. return node_ || null;
  11751. }
  11752. }
  11753. const CommonProps = {
  11754. modelValue: [Number, String, Array],
  11755. options: {
  11756. type: Array,
  11757. default: () => []
  11758. },
  11759. props: {
  11760. type: Object,
  11761. default: () => ({})
  11762. }
  11763. };
  11764. const DefaultProps = {
  11765. expandTrigger: ExpandTrigger.CLICK,
  11766. multiple: false,
  11767. checkStrictly: false,
  11768. emitPath: true,
  11769. lazy: false,
  11770. lazyLoad: NOOP,
  11771. value: "value",
  11772. label: "label",
  11773. children: "children",
  11774. leaf: "leaf",
  11775. disabled: "disabled",
  11776. hoverThreshold: 500
  11777. };
  11778. const useCascaderConfig = (props) => {
  11779. return computed(() => __spreadValues(__spreadValues({}, DefaultProps), props.props));
  11780. };
  11781. const getMenuIndex = (el) => {
  11782. if (!el)
  11783. return 0;
  11784. const pieces = el.id.split("-");
  11785. return Number(pieces[pieces.length - 2]);
  11786. };
  11787. const checkNode = (el) => {
  11788. if (!el)
  11789. return;
  11790. const input = el.querySelector("input");
  11791. if (input) {
  11792. input.click();
  11793. } else if (isLeaf(el)) {
  11794. el.click();
  11795. }
  11796. };
  11797. const sortByOriginalOrder = (oldNodes, newNodes) => {
  11798. const newNodesCopy = newNodes.slice(0);
  11799. const newIds = newNodesCopy.map((node) => node.uid);
  11800. const res = oldNodes.reduce((acc, item) => {
  11801. const index = newIds.indexOf(item.uid);
  11802. if (index > -1) {
  11803. acc.push(item);
  11804. newNodesCopy.splice(index, 1);
  11805. newIds.splice(index, 1);
  11806. }
  11807. return acc;
  11808. }, []);
  11809. res.push(...newNodesCopy);
  11810. return res;
  11811. };
  11812. const _sfc_main$G = defineComponent({
  11813. name: "ElCascaderPanel",
  11814. components: {
  11815. ElCascaderMenu
  11816. },
  11817. props: __spreadProps(__spreadValues({}, CommonProps), {
  11818. border: {
  11819. type: Boolean,
  11820. default: true
  11821. },
  11822. renderLabel: Function
  11823. }),
  11824. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  11825. setup(props, { emit, slots }) {
  11826. let manualChecked = false;
  11827. const ns = useNamespace("cascader");
  11828. const config = useCascaderConfig(props);
  11829. let store = null;
  11830. const initialLoaded = ref(true);
  11831. const menuList = ref([]);
  11832. const checkedValue = ref(null);
  11833. const menus = ref([]);
  11834. const expandingNode = ref(null);
  11835. const checkedNodes = ref([]);
  11836. const isHoverMenu = computed(() => config.value.expandTrigger === ExpandTrigger.HOVER);
  11837. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  11838. const initStore = () => {
  11839. const { options } = props;
  11840. const cfg = config.value;
  11841. manualChecked = false;
  11842. store = new Store(options, cfg);
  11843. menus.value = [store.getNodes()];
  11844. if (cfg.lazy && isEmpty(props.options)) {
  11845. initialLoaded.value = false;
  11846. lazyLoad(void 0, (list) => {
  11847. if (list) {
  11848. store = new Store(list, cfg);
  11849. menus.value = [store.getNodes()];
  11850. }
  11851. initialLoaded.value = true;
  11852. syncCheckedValue(false, true);
  11853. });
  11854. } else {
  11855. syncCheckedValue(false, true);
  11856. }
  11857. };
  11858. const lazyLoad = (node, cb) => {
  11859. const cfg = config.value;
  11860. node = node || new Node({}, cfg, void 0, true);
  11861. node.loading = true;
  11862. const resolve = (dataList) => {
  11863. const _node = node;
  11864. const parent = _node.root ? null : _node;
  11865. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  11866. _node.loading = false;
  11867. _node.loaded = true;
  11868. _node.childrenData = _node.childrenData || [];
  11869. cb && cb(dataList);
  11870. };
  11871. cfg.lazyLoad(node, resolve);
  11872. };
  11873. const expandNode = (node, silent) => {
  11874. var _a2;
  11875. const { level } = node;
  11876. const newMenus = menus.value.slice(0, level);
  11877. let newExpandingNode;
  11878. if (node.isLeaf) {
  11879. newExpandingNode = node.pathNodes[level - 2];
  11880. } else {
  11881. newExpandingNode = node;
  11882. newMenus.push(node.children);
  11883. }
  11884. if (((_a2 = expandingNode.value) == null ? void 0 : _a2.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  11885. expandingNode.value = node;
  11886. menus.value = newMenus;
  11887. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  11888. }
  11889. };
  11890. const handleCheckChange = (node, checked, emitClose = true) => {
  11891. const { checkStrictly, multiple } = config.value;
  11892. const oldNode = checkedNodes.value[0];
  11893. manualChecked = true;
  11894. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  11895. node.doCheck(checked);
  11896. calculateCheckedValue();
  11897. emitClose && !multiple && !checkStrictly && emit("close");
  11898. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  11899. };
  11900. const expandParentNode = (node) => {
  11901. if (!node)
  11902. return;
  11903. node = node.parent;
  11904. expandParentNode(node);
  11905. node && expandNode(node);
  11906. };
  11907. const getFlattedNodes = (leafOnly) => {
  11908. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  11909. };
  11910. const getCheckedNodes = (leafOnly) => {
  11911. var _a2;
  11912. return (_a2 = getFlattedNodes(leafOnly)) == null ? void 0 : _a2.filter((node) => node.checked !== false);
  11913. };
  11914. const clearCheckedNodes = () => {
  11915. checkedNodes.value.forEach((node) => node.doCheck(false));
  11916. calculateCheckedValue();
  11917. };
  11918. const calculateCheckedValue = () => {
  11919. var _a2;
  11920. const { checkStrictly, multiple } = config.value;
  11921. const oldNodes = checkedNodes.value;
  11922. const newNodes = getCheckedNodes(!checkStrictly);
  11923. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  11924. const values = nodes.map((node) => node.valueByOption);
  11925. checkedNodes.value = nodes;
  11926. checkedValue.value = multiple ? values : (_a2 = values[0]) != null ? _a2 : null;
  11927. };
  11928. const syncCheckedValue = (loaded = false, forced = false) => {
  11929. const { modelValue } = props;
  11930. const { lazy, multiple, checkStrictly } = config.value;
  11931. const leafOnly = !checkStrictly;
  11932. if (!initialLoaded.value || manualChecked || !forced && isEqual(modelValue, checkedValue.value))
  11933. return;
  11934. if (lazy && !loaded) {
  11935. const values = unique(flattenDeep(castArray(modelValue)));
  11936. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  11937. if (nodes.length) {
  11938. nodes.forEach((node) => {
  11939. lazyLoad(node, () => syncCheckedValue(false, forced));
  11940. });
  11941. } else {
  11942. syncCheckedValue(true, forced);
  11943. }
  11944. } else {
  11945. const values = multiple ? castArray(modelValue) : [modelValue];
  11946. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  11947. syncMenuState(nodes, false);
  11948. checkedValue.value = modelValue;
  11949. }
  11950. };
  11951. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  11952. const { checkStrictly } = config.value;
  11953. const oldNodes = checkedNodes.value;
  11954. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  11955. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  11956. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  11957. if (newExpandingNode) {
  11958. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  11959. } else {
  11960. expandingNode.value = null;
  11961. }
  11962. oldNodes.forEach((node) => node.doCheck(false));
  11963. newNodes.forEach((node) => node.doCheck(true));
  11964. checkedNodes.value = newNodes;
  11965. nextTick(scrollToExpandingNode);
  11966. };
  11967. const scrollToExpandingNode = () => {
  11968. if (!isClient$1)
  11969. return;
  11970. menuList.value.forEach((menu) => {
  11971. const menuElement = menu == null ? void 0 : menu.$el;
  11972. if (menuElement) {
  11973. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  11974. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  11975. scrollIntoView(container, activeNode);
  11976. }
  11977. });
  11978. };
  11979. const handleKeyDown2 = (e) => {
  11980. const target = e.target;
  11981. const { code } = e;
  11982. switch (code) {
  11983. case EVENT_CODE.up:
  11984. case EVENT_CODE.down: {
  11985. e.preventDefault();
  11986. const distance = code === EVENT_CODE.up ? -1 : 1;
  11987. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  11988. break;
  11989. }
  11990. case EVENT_CODE.left: {
  11991. e.preventDefault();
  11992. const preMenu = menuList.value[getMenuIndex(target) - 1];
  11993. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  11994. focusNode(expandedNode);
  11995. break;
  11996. }
  11997. case EVENT_CODE.right: {
  11998. e.preventDefault();
  11999. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  12000. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  12001. focusNode(firstNode);
  12002. break;
  12003. }
  12004. case EVENT_CODE.enter:
  12005. checkNode(target);
  12006. break;
  12007. case EVENT_CODE.esc:
  12008. case EVENT_CODE.tab:
  12009. emit("close");
  12010. break;
  12011. }
  12012. };
  12013. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  12014. config,
  12015. expandingNode,
  12016. checkedNodes,
  12017. isHoverMenu,
  12018. initialLoaded,
  12019. renderLabelFn,
  12020. lazyLoad,
  12021. expandNode,
  12022. handleCheckChange
  12023. }));
  12024. watch([config, () => props.options], initStore, {
  12025. deep: true,
  12026. immediate: true
  12027. });
  12028. watch(() => props.modelValue, () => {
  12029. manualChecked = false;
  12030. syncCheckedValue();
  12031. });
  12032. watch(checkedValue, (val) => {
  12033. if (!isEqual(val, props.modelValue)) {
  12034. emit(UPDATE_MODEL_EVENT, val);
  12035. emit(CHANGE_EVENT, val);
  12036. }
  12037. });
  12038. onBeforeUpdate(() => menuList.value = []);
  12039. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  12040. return {
  12041. ns,
  12042. menuList,
  12043. menus,
  12044. checkedNodes,
  12045. handleKeyDown: handleKeyDown2,
  12046. handleCheckChange,
  12047. getFlattedNodes,
  12048. getCheckedNodes,
  12049. clearCheckedNodes,
  12050. calculateCheckedValue,
  12051. scrollToExpandingNode
  12052. };
  12053. }
  12054. });
  12055. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  12056. const _component_el_cascader_menu = resolveComponent("el-cascader-menu");
  12057. return openBlock(), createElementBlock("div", {
  12058. class: normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  12059. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  12060. }, [
  12061. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menus, (menu, index) => {
  12062. return openBlock(), createBlock(_component_el_cascader_menu, {
  12063. key: index,
  12064. ref_for: true,
  12065. ref: (item) => _ctx.menuList[index] = item,
  12066. index,
  12067. nodes: [...menu]
  12068. }, null, 8, ["index", "nodes"]);
  12069. }), 128))
  12070. ], 34);
  12071. }
  12072. var CascaderPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$G, [["render", _sfc_render$l], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/index.vue"]]);
  12073. CascaderPanel.install = (app) => {
  12074. app.component(CascaderPanel.name, CascaderPanel);
  12075. };
  12076. const _CascaderPanel = CascaderPanel;
  12077. const tagProps = buildProps({
  12078. closable: Boolean,
  12079. type: {
  12080. type: String,
  12081. values: ["success", "info", "warning", "danger", ""],
  12082. default: ""
  12083. },
  12084. hit: Boolean,
  12085. disableTransitions: Boolean,
  12086. color: {
  12087. type: String,
  12088. default: ""
  12089. },
  12090. size: {
  12091. type: String,
  12092. values: componentSizes,
  12093. default: ""
  12094. },
  12095. effect: {
  12096. type: String,
  12097. values: ["dark", "light", "plain"],
  12098. default: "light"
  12099. },
  12100. round: Boolean
  12101. });
  12102. const tagEmits = {
  12103. close: (evt) => evt instanceof MouseEvent,
  12104. click: (evt) => evt instanceof MouseEvent
  12105. };
  12106. const __default__$d = {
  12107. name: "ElTag"
  12108. };
  12109. const _sfc_main$F = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$d), {
  12110. props: tagProps,
  12111. emits: tagEmits,
  12112. setup(__props, { emit }) {
  12113. const props = __props;
  12114. const tagSize = useSize();
  12115. const ns = useNamespace("tag");
  12116. const classes = computed(() => {
  12117. const { type: type4, hit, effect: effect2, closable, round: round2 } = props;
  12118. return [
  12119. ns.b(),
  12120. ns.is("closable", closable),
  12121. ns.m(type4),
  12122. ns.m(tagSize.value),
  12123. ns.m(effect2),
  12124. ns.is("hit", hit),
  12125. ns.is("round", round2)
  12126. ];
  12127. });
  12128. const handleClose = (event) => {
  12129. event.stopPropagation();
  12130. emit("close", event);
  12131. };
  12132. const handleClick = (event) => {
  12133. emit("click", event);
  12134. };
  12135. return (_ctx, _cache) => {
  12136. return !_ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  12137. key: 0,
  12138. class: normalizeClass(unref(classes)),
  12139. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12140. onClick: handleClick
  12141. }, [
  12142. createElementVNode("span", {
  12143. class: normalizeClass(unref(ns).e("content"))
  12144. }, [
  12145. renderSlot(_ctx.$slots, "default")
  12146. ], 2),
  12147. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12148. key: 0,
  12149. class: normalizeClass(unref(ns).e("close")),
  12150. onClick: handleClose
  12151. }, {
  12152. default: withCtx(() => [
  12153. createVNode(unref(close))
  12154. ]),
  12155. _: 1
  12156. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12157. ], 6)) : (openBlock(), createBlock(Transition, {
  12158. key: 1,
  12159. name: `${unref(ns).namespace.value}-zoom-in-center`
  12160. }, {
  12161. default: withCtx(() => [
  12162. createElementVNode("span", {
  12163. class: normalizeClass(unref(classes)),
  12164. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12165. onClick: handleClick
  12166. }, [
  12167. createElementVNode("span", {
  12168. class: normalizeClass(unref(ns).e("content"))
  12169. }, [
  12170. renderSlot(_ctx.$slots, "default")
  12171. ], 2),
  12172. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12173. key: 0,
  12174. class: normalizeClass(unref(ns).e("close")),
  12175. onClick: handleClose
  12176. }, {
  12177. default: withCtx(() => [
  12178. createVNode(unref(close))
  12179. ]),
  12180. _: 1
  12181. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12182. ], 6)
  12183. ]),
  12184. _: 3
  12185. }, 8, ["name"]));
  12186. };
  12187. }
  12188. }));
  12189. var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$F, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
  12190. const ElTag = withInstall(Tag);
  12191. const DEFAULT_INPUT_HEIGHT = 40;
  12192. const INPUT_HEIGHT_MAP = {
  12193. large: 36,
  12194. default: 32,
  12195. small: 28
  12196. };
  12197. const popperOptions = {
  12198. modifiers: [
  12199. {
  12200. name: "arrowPosition",
  12201. enabled: true,
  12202. phase: "main",
  12203. fn: ({ state }) => {
  12204. const { modifiersData, placement } = state;
  12205. if (["right", "left", "bottom", "top"].includes(placement))
  12206. return;
  12207. modifiersData.arrow.x = 35;
  12208. },
  12209. requires: ["arrow"]
  12210. }
  12211. ]
  12212. };
  12213. const COMPONENT_NAME$3 = "ElCascader";
  12214. const _sfc_main$E = defineComponent({
  12215. name: COMPONENT_NAME$3,
  12216. components: {
  12217. ElCascaderPanel: _CascaderPanel,
  12218. ElInput,
  12219. ElTooltip,
  12220. ElScrollbar,
  12221. ElTag,
  12222. ElIcon,
  12223. CircleClose: circleClose,
  12224. Check: check,
  12225. ArrowDown: arrowDown
  12226. },
  12227. directives: {
  12228. Clickoutside: ClickOutside
  12229. },
  12230. props: __spreadProps(__spreadValues({}, CommonProps), {
  12231. size: {
  12232. type: String,
  12233. validator: isValidComponentSize
  12234. },
  12235. placeholder: {
  12236. type: String
  12237. },
  12238. disabled: Boolean,
  12239. clearable: Boolean,
  12240. filterable: Boolean,
  12241. filterMethod: {
  12242. type: Function,
  12243. default: (node, keyword) => node.text.includes(keyword)
  12244. },
  12245. separator: {
  12246. type: String,
  12247. default: " / "
  12248. },
  12249. showAllLevels: {
  12250. type: Boolean,
  12251. default: true
  12252. },
  12253. collapseTags: Boolean,
  12254. collapseTagsTooltip: {
  12255. type: Boolean,
  12256. default: false
  12257. },
  12258. debounce: {
  12259. type: Number,
  12260. default: 300
  12261. },
  12262. beforeFilter: {
  12263. type: Function,
  12264. default: () => true
  12265. },
  12266. popperClass: {
  12267. type: String,
  12268. default: ""
  12269. },
  12270. popperAppendToBody: {
  12271. type: Boolean,
  12272. default: void 0
  12273. },
  12274. teleported: useTooltipContentProps.teleported,
  12275. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  12276. }),
  12277. emits: [
  12278. UPDATE_MODEL_EVENT,
  12279. CHANGE_EVENT,
  12280. "focus",
  12281. "blur",
  12282. "visible-change",
  12283. "expand-change",
  12284. "remove-tag"
  12285. ],
  12286. setup(props, { emit }) {
  12287. let inputInitialHeight = 0;
  12288. let pressDeleteCount = 0;
  12289. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$3, "popperAppendToBody");
  12290. const nsCascader = useNamespace("cascader");
  12291. const nsInput = useNamespace("input");
  12292. const { t } = useLocale();
  12293. const elForm2 = inject(formContextKey, {});
  12294. const elFormItem2 = inject(formItemContextKey, {});
  12295. const tooltipRef = ref(null);
  12296. const input = ref(null);
  12297. const tagWrapper = ref(null);
  12298. const panel = ref(null);
  12299. const suggestionPanel = ref(null);
  12300. const popperVisible = ref(false);
  12301. const inputHover = ref(false);
  12302. const filtering = ref(false);
  12303. const inputValue = ref("");
  12304. const searchInputValue = ref("");
  12305. const presentTags = ref([]);
  12306. const allPresentTags = ref([]);
  12307. const suggestions = ref([]);
  12308. const isOnComposition = ref(false);
  12309. const isDisabled = computed(() => props.disabled || elForm2.disabled);
  12310. const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
  12311. const realSize = useSize();
  12312. const tagSize = computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  12313. const multiple = computed(() => !!props.props.multiple);
  12314. const readonly2 = computed(() => !props.filterable || multiple.value);
  12315. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  12316. const checkedNodes = computed(() => {
  12317. var _a2;
  12318. return ((_a2 = panel.value) == null ? void 0 : _a2.checkedNodes) || [];
  12319. });
  12320. const clearBtnVisible = computed(() => {
  12321. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  12322. return false;
  12323. return !!checkedNodes.value.length;
  12324. });
  12325. const presentText = computed(() => {
  12326. const { showAllLevels, separator } = props;
  12327. const nodes = checkedNodes.value;
  12328. return nodes.length ? multiple.value ? " " : nodes[0].calcText(showAllLevels, separator) : "";
  12329. });
  12330. const checkedValue = computed({
  12331. get() {
  12332. return props.modelValue;
  12333. },
  12334. set(val) {
  12335. var _a2;
  12336. emit(UPDATE_MODEL_EVENT, val);
  12337. emit(CHANGE_EVENT, val);
  12338. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  12339. }
  12340. });
  12341. const popperPaneRef = computed(() => {
  12342. var _a2, _b2;
  12343. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  12344. });
  12345. const togglePopperVisible = (visible) => {
  12346. var _a2, _b2, _c;
  12347. if (isDisabled.value)
  12348. return;
  12349. visible = visible != null ? visible : !popperVisible.value;
  12350. if (visible !== popperVisible.value) {
  12351. popperVisible.value = visible;
  12352. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.input) == null ? void 0 : _b2.setAttribute("aria-expanded", `${visible}`);
  12353. if (visible) {
  12354. updatePopperPosition();
  12355. nextTick((_c = panel.value) == null ? void 0 : _c.scrollToExpandingNode);
  12356. } else if (props.filterable) {
  12357. const { value } = presentText;
  12358. inputValue.value = value;
  12359. searchInputValue.value = value;
  12360. }
  12361. emit("visible-change", visible);
  12362. }
  12363. };
  12364. const updatePopperPosition = () => {
  12365. nextTick(() => {
  12366. var _a2;
  12367. (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper();
  12368. });
  12369. };
  12370. const hideSuggestionPanel = () => {
  12371. filtering.value = false;
  12372. };
  12373. const genTag2 = (node) => {
  12374. const { showAllLevels, separator } = props;
  12375. return {
  12376. node,
  12377. key: node.uid,
  12378. text: node.calcText(showAllLevels, separator),
  12379. hitState: false,
  12380. closable: !isDisabled.value && !node.isDisabled,
  12381. isCollapseTag: false
  12382. };
  12383. };
  12384. const deleteTag = (tag) => {
  12385. var _a2;
  12386. const node = tag.node;
  12387. node.doCheck(false);
  12388. (_a2 = panel.value) == null ? void 0 : _a2.calculateCheckedValue();
  12389. emit("remove-tag", node.valueByOption);
  12390. };
  12391. const calculatePresentTags = () => {
  12392. if (!multiple.value)
  12393. return;
  12394. const nodes = checkedNodes.value;
  12395. const tags = [];
  12396. const allTags = [];
  12397. nodes.forEach((node) => allTags.push(genTag2(node)));
  12398. allPresentTags.value = allTags;
  12399. if (nodes.length) {
  12400. const [first, ...rest] = nodes;
  12401. const restCount = rest.length;
  12402. tags.push(genTag2(first));
  12403. if (restCount) {
  12404. if (props.collapseTags) {
  12405. tags.push({
  12406. key: -1,
  12407. text: `+ ${restCount}`,
  12408. closable: false,
  12409. isCollapseTag: true
  12410. });
  12411. } else {
  12412. rest.forEach((node) => tags.push(genTag2(node)));
  12413. }
  12414. }
  12415. }
  12416. presentTags.value = tags;
  12417. };
  12418. const calculateSuggestions = () => {
  12419. var _a2, _b2;
  12420. const { filterMethod, showAllLevels, separator } = props;
  12421. const res = (_b2 = (_a2 = panel.value) == null ? void 0 : _a2.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b2.filter((node) => {
  12422. if (node.isDisabled)
  12423. return false;
  12424. node.calcText(showAllLevels, separator);
  12425. return filterMethod(node, searchKeyword.value);
  12426. });
  12427. if (multiple.value) {
  12428. presentTags.value.forEach((tag) => {
  12429. tag.hitState = false;
  12430. });
  12431. allPresentTags.value.forEach((tag) => {
  12432. tag.hitState = false;
  12433. });
  12434. }
  12435. filtering.value = true;
  12436. suggestions.value = res;
  12437. updatePopperPosition();
  12438. };
  12439. const focusFirstNode = () => {
  12440. var _a2;
  12441. let firstNode;
  12442. if (filtering.value && suggestionPanel.value) {
  12443. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  12444. } else {
  12445. firstNode = (_a2 = panel.value) == null ? void 0 : _a2.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  12446. }
  12447. if (firstNode) {
  12448. firstNode.focus();
  12449. !filtering.value && firstNode.click();
  12450. }
  12451. };
  12452. const updateStyle = () => {
  12453. var _a2, _b2;
  12454. const inputInner = (_a2 = input.value) == null ? void 0 : _a2.input;
  12455. const tagWrapperEl = tagWrapper.value;
  12456. const suggestionPanelEl = (_b2 = suggestionPanel.value) == null ? void 0 : _b2.$el;
  12457. if (!isClient$1 || !inputInner)
  12458. return;
  12459. if (suggestionPanelEl) {
  12460. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  12461. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  12462. }
  12463. if (tagWrapperEl) {
  12464. const { offsetHeight } = tagWrapperEl;
  12465. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  12466. inputInner.style.height = height;
  12467. updatePopperPosition();
  12468. }
  12469. };
  12470. const getCheckedNodes = (leafOnly) => {
  12471. var _a2;
  12472. return (_a2 = panel.value) == null ? void 0 : _a2.getCheckedNodes(leafOnly);
  12473. };
  12474. const handleExpandChange = (value) => {
  12475. updatePopperPosition();
  12476. emit("expand-change", value);
  12477. };
  12478. const handleComposition = (event) => {
  12479. var _a2;
  12480. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  12481. if (event.type === "compositionend") {
  12482. isOnComposition.value = false;
  12483. nextTick(() => handleInput(text));
  12484. } else {
  12485. const lastCharacter = text[text.length - 1] || "";
  12486. isOnComposition.value = !isKorean(lastCharacter);
  12487. }
  12488. };
  12489. const handleKeyDown2 = (e) => {
  12490. if (isOnComposition.value)
  12491. return;
  12492. switch (e.code) {
  12493. case EVENT_CODE.enter:
  12494. togglePopperVisible();
  12495. break;
  12496. case EVENT_CODE.down:
  12497. togglePopperVisible(true);
  12498. nextTick(focusFirstNode);
  12499. e.preventDefault();
  12500. break;
  12501. case EVENT_CODE.esc:
  12502. case EVENT_CODE.tab:
  12503. togglePopperVisible(false);
  12504. break;
  12505. }
  12506. };
  12507. const handleClear = () => {
  12508. var _a2;
  12509. (_a2 = panel.value) == null ? void 0 : _a2.clearCheckedNodes();
  12510. togglePopperVisible(false);
  12511. };
  12512. const handleSuggestionClick = (node) => {
  12513. var _a2, _b2;
  12514. const { checked } = node;
  12515. if (multiple.value) {
  12516. (_a2 = panel.value) == null ? void 0 : _a2.handleCheckChange(node, !checked, false);
  12517. } else {
  12518. !checked && ((_b2 = panel.value) == null ? void 0 : _b2.handleCheckChange(node, true, false));
  12519. togglePopperVisible(false);
  12520. }
  12521. };
  12522. const handleSuggestionKeyDown = (e) => {
  12523. const target = e.target;
  12524. const { code } = e;
  12525. switch (code) {
  12526. case EVENT_CODE.up:
  12527. case EVENT_CODE.down: {
  12528. const distance = code === EVENT_CODE.up ? -1 : 1;
  12529. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  12530. break;
  12531. }
  12532. case EVENT_CODE.enter:
  12533. target.click();
  12534. break;
  12535. case EVENT_CODE.esc:
  12536. case EVENT_CODE.tab:
  12537. togglePopperVisible(false);
  12538. break;
  12539. }
  12540. };
  12541. const handleDelete = () => {
  12542. const tags = presentTags.value;
  12543. const lastTag = tags[tags.length - 1];
  12544. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  12545. if (!lastTag || !pressDeleteCount)
  12546. return;
  12547. if (lastTag.hitState) {
  12548. deleteTag(lastTag);
  12549. } else {
  12550. lastTag.hitState = true;
  12551. }
  12552. };
  12553. const handleFilter = debounce$1(() => {
  12554. const { value } = searchKeyword;
  12555. if (!value)
  12556. return;
  12557. const passed = props.beforeFilter(value);
  12558. if (isPromise(passed)) {
  12559. passed.then(calculateSuggestions).catch(() => {
  12560. });
  12561. } else if (passed !== false) {
  12562. calculateSuggestions();
  12563. } else {
  12564. hideSuggestionPanel();
  12565. }
  12566. }, props.debounce);
  12567. const handleInput = (val, e) => {
  12568. !popperVisible.value && togglePopperVisible(true);
  12569. if (e == null ? void 0 : e.isComposing)
  12570. return;
  12571. val ? handleFilter() : hideSuggestionPanel();
  12572. };
  12573. watch(filtering, updatePopperPosition);
  12574. watch([checkedNodes, isDisabled], calculatePresentTags);
  12575. watch(presentTags, () => {
  12576. nextTick(() => updateStyle());
  12577. });
  12578. watch(presentText, (val) => inputValue.value = val, { immediate: true });
  12579. onMounted(() => {
  12580. var _a2;
  12581. const inputEl = (_a2 = input.value) == null ? void 0 : _a2.$el;
  12582. inputInitialHeight = (inputEl == null ? void 0 : inputEl.offsetHeight) || INPUT_HEIGHT_MAP[realSize.value] || DEFAULT_INPUT_HEIGHT;
  12583. addResizeListener(inputEl, updateStyle);
  12584. });
  12585. onBeforeUnmount(() => {
  12586. var _a2;
  12587. removeResizeListener((_a2 = input.value) == null ? void 0 : _a2.$el, updateStyle);
  12588. });
  12589. return {
  12590. popperOptions,
  12591. tooltipRef,
  12592. popperPaneRef,
  12593. input,
  12594. tagWrapper,
  12595. panel,
  12596. suggestionPanel,
  12597. popperVisible,
  12598. inputHover,
  12599. inputPlaceholder,
  12600. filtering,
  12601. presentText,
  12602. checkedValue,
  12603. inputValue,
  12604. searchInputValue,
  12605. presentTags,
  12606. allPresentTags,
  12607. suggestions,
  12608. isDisabled,
  12609. isOnComposition,
  12610. realSize,
  12611. tagSize,
  12612. multiple,
  12613. readonly: readonly2,
  12614. clearBtnVisible,
  12615. compatTeleported,
  12616. nsCascader,
  12617. nsInput,
  12618. t,
  12619. togglePopperVisible,
  12620. hideSuggestionPanel,
  12621. deleteTag,
  12622. focusFirstNode,
  12623. getCheckedNodes,
  12624. handleExpandChange,
  12625. handleKeyDown: handleKeyDown2,
  12626. handleComposition,
  12627. handleClear,
  12628. handleSuggestionClick,
  12629. handleSuggestionKeyDown,
  12630. handleDelete,
  12631. handleInput
  12632. };
  12633. }
  12634. });
  12635. const _hoisted_1$r = { key: 0 };
  12636. const _hoisted_2$k = { class: "el-cascader__collapse-tags" };
  12637. const _hoisted_3$e = ["placeholder"];
  12638. const _hoisted_4$c = ["onClick"];
  12639. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  12640. const _component_circle_close = resolveComponent("circle-close");
  12641. const _component_el_icon = resolveComponent("el-icon");
  12642. const _component_arrow_down = resolveComponent("arrow-down");
  12643. const _component_el_input = resolveComponent("el-input");
  12644. const _component_el_tag = resolveComponent("el-tag");
  12645. const _component_el_tooltip = resolveComponent("el-tooltip");
  12646. const _component_el_cascader_panel = resolveComponent("el-cascader-panel");
  12647. const _component_check = resolveComponent("check");
  12648. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  12649. const _directive_clickoutside = resolveDirective("clickoutside");
  12650. return openBlock(), createBlock(_component_el_tooltip, {
  12651. ref: "tooltipRef",
  12652. visible: _ctx.popperVisible,
  12653. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.popperVisible = $event),
  12654. teleported: _ctx.compatTeleported,
  12655. "popper-class": [_ctx.nsCascader.e("dropdown"), _ctx.popperClass],
  12656. "popper-options": _ctx.popperOptions,
  12657. "fallback-placements": [
  12658. "bottom-start",
  12659. "bottom",
  12660. "top-start",
  12661. "top",
  12662. "right",
  12663. "left"
  12664. ],
  12665. "stop-popper-mouse-event": false,
  12666. "gpu-acceleration": false,
  12667. placement: "bottom-start",
  12668. transition: `${_ctx.nsCascader.namespace.value}-zoom-in-top`,
  12669. effect: "light",
  12670. pure: "",
  12671. persistent: "",
  12672. onHide: _ctx.hideSuggestionPanel
  12673. }, {
  12674. default: withCtx(() => [
  12675. withDirectives((openBlock(), createElementBlock("div", {
  12676. class: normalizeClass([
  12677. _ctx.nsCascader.b(),
  12678. _ctx.nsCascader.m(_ctx.realSize),
  12679. _ctx.nsCascader.is("disabled", _ctx.isDisabled),
  12680. _ctx.$attrs.class
  12681. ]),
  12682. style: normalizeStyle(_ctx.$attrs.style),
  12683. onClick: _cache[11] || (_cache[11] = () => _ctx.togglePopperVisible(_ctx.readonly ? void 0 : true)),
  12684. onKeydown: _cache[12] || (_cache[12] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
  12685. onMouseenter: _cache[13] || (_cache[13] = ($event) => _ctx.inputHover = true),
  12686. onMouseleave: _cache[14] || (_cache[14] = ($event) => _ctx.inputHover = false)
  12687. }, [
  12688. createVNode(_component_el_input, {
  12689. ref: "input",
  12690. modelValue: _ctx.inputValue,
  12691. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.inputValue = $event),
  12692. placeholder: _ctx.inputPlaceholder,
  12693. readonly: _ctx.readonly,
  12694. disabled: _ctx.isDisabled,
  12695. "validate-event": false,
  12696. size: _ctx.realSize,
  12697. class: normalizeClass(_ctx.nsCascader.is("focus", _ctx.popperVisible)),
  12698. onCompositionstart: _ctx.handleComposition,
  12699. onCompositionupdate: _ctx.handleComposition,
  12700. onCompositionend: _ctx.handleComposition,
  12701. onFocus: _cache[2] || (_cache[2] = (e) => _ctx.$emit("focus", e)),
  12702. onBlur: _cache[3] || (_cache[3] = (e) => _ctx.$emit("blur", e)),
  12703. onInput: _ctx.handleInput
  12704. }, {
  12705. suffix: withCtx(() => [
  12706. _ctx.clearBtnVisible ? (openBlock(), createBlock(_component_el_icon, {
  12707. key: "clear",
  12708. class: normalizeClass([_ctx.nsInput.e("icon"), "icon-circle-close"]),
  12709. onClick: withModifiers(_ctx.handleClear, ["stop"])
  12710. }, {
  12711. default: withCtx(() => [
  12712. createVNode(_component_circle_close)
  12713. ]),
  12714. _: 1
  12715. }, 8, ["class", "onClick"])) : (openBlock(), createBlock(_component_el_icon, {
  12716. key: "arrow-down",
  12717. class: normalizeClass([
  12718. _ctx.nsInput.e("icon"),
  12719. "icon-arrow-down",
  12720. _ctx.nsCascader.is("reverse", _ctx.popperVisible)
  12721. ]),
  12722. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.togglePopperVisible(), ["stop"]))
  12723. }, {
  12724. default: withCtx(() => [
  12725. createVNode(_component_arrow_down)
  12726. ]),
  12727. _: 1
  12728. }, 8, ["class"]))
  12729. ]),
  12730. _: 1
  12731. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput"]),
  12732. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  12733. key: 0,
  12734. ref: "tagWrapper",
  12735. class: normalizeClass(_ctx.nsCascader.e("tags"))
  12736. }, [
  12737. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.presentTags, (tag) => {
  12738. return openBlock(), createBlock(_component_el_tag, {
  12739. key: tag.key,
  12740. type: _ctx.tagType,
  12741. size: _ctx.tagSize,
  12742. hit: tag.hitState,
  12743. closable: tag.closable,
  12744. "disable-transitions": "",
  12745. onClose: ($event) => _ctx.deleteTag(tag)
  12746. }, {
  12747. default: withCtx(() => [
  12748. tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", _hoisted_1$r, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(_component_el_tooltip, {
  12749. key: 1,
  12750. teleported: false,
  12751. disabled: _ctx.popperVisible || !_ctx.collapseTagsTooltip,
  12752. "fallback-placements": ["bottom", "top", "right", "left"],
  12753. placement: "bottom",
  12754. effect: "light"
  12755. }, {
  12756. default: withCtx(() => [
  12757. createElementVNode("span", null, toDisplayString(tag.text), 1)
  12758. ]),
  12759. content: withCtx(() => [
  12760. createElementVNode("div", _hoisted_2$k, [
  12761. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.allPresentTags, (tag2, idx) => {
  12762. return openBlock(), createElementBlock("div", {
  12763. key: idx,
  12764. class: "el-cascader__collapse-tag"
  12765. }, [
  12766. (openBlock(), createBlock(_component_el_tag, {
  12767. key: tag2.key,
  12768. class: "in-tooltip",
  12769. type: _ctx.tagType,
  12770. size: _ctx.tagSize,
  12771. hit: tag2.hitState,
  12772. closable: tag2.closable,
  12773. "disable-transitions": "",
  12774. onClose: ($event) => _ctx.deleteTag(tag2)
  12775. }, {
  12776. default: withCtx(() => [
  12777. createElementVNode("span", null, toDisplayString(tag2.text), 1)
  12778. ]),
  12779. _: 2
  12780. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  12781. ]);
  12782. }), 128))
  12783. ])
  12784. ]),
  12785. _: 2
  12786. }, 1032, ["disabled"]))
  12787. ]),
  12788. _: 2
  12789. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  12790. }), 128)),
  12791. _ctx.filterable && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("input", {
  12792. key: 0,
  12793. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.searchInputValue = $event),
  12794. type: "text",
  12795. class: normalizeClass(_ctx.nsCascader.e("search-input")),
  12796. placeholder: _ctx.presentText ? "" : _ctx.inputPlaceholder,
  12797. onInput: _cache[5] || (_cache[5] = (e) => _ctx.handleInput(_ctx.searchInputValue, e)),
  12798. onClick: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.togglePopperVisible(true), ["stop"])),
  12799. onKeydown: _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleDelete && _ctx.handleDelete(...args), ["delete"])),
  12800. onCompositionstart: _cache[8] || (_cache[8] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12801. onCompositionupdate: _cache[9] || (_cache[9] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12802. onCompositionend: _cache[10] || (_cache[10] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args))
  12803. }, null, 42, _hoisted_3$e)), [
  12804. [vModelText, _ctx.searchInputValue]
  12805. ]) : createCommentVNode("v-if", true)
  12806. ], 2)) : createCommentVNode("v-if", true)
  12807. ], 38)), [
  12808. [_directive_clickoutside, () => _ctx.togglePopperVisible(false), _ctx.popperPaneRef]
  12809. ])
  12810. ]),
  12811. content: withCtx(() => [
  12812. withDirectives(createVNode(_component_el_cascader_panel, {
  12813. ref: "panel",
  12814. modelValue: _ctx.checkedValue,
  12815. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.checkedValue = $event),
  12816. options: _ctx.options,
  12817. props: _ctx.props,
  12818. border: false,
  12819. "render-label": _ctx.$slots.default,
  12820. onExpandChange: _ctx.handleExpandChange,
  12821. onClose: _cache[16] || (_cache[16] = ($event) => _ctx.$nextTick(() => _ctx.togglePopperVisible(false)))
  12822. }, null, 8, ["modelValue", "options", "props", "render-label", "onExpandChange"]), [
  12823. [vShow, !_ctx.filtering]
  12824. ]),
  12825. _ctx.filterable ? withDirectives((openBlock(), createBlock(_component_el_scrollbar, {
  12826. key: 0,
  12827. ref: "suggestionPanel",
  12828. tag: "ul",
  12829. class: normalizeClass(_ctx.nsCascader.e("suggestion-panel")),
  12830. "view-class": _ctx.nsCascader.e("suggestion-list"),
  12831. onKeydown: _ctx.handleSuggestionKeyDown
  12832. }, {
  12833. default: withCtx(() => [
  12834. _ctx.suggestions.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.suggestions, (item) => {
  12835. return openBlock(), createElementBlock("li", {
  12836. key: item.uid,
  12837. class: normalizeClass([
  12838. _ctx.nsCascader.e("suggestion-item"),
  12839. _ctx.nsCascader.is("checked", item.checked)
  12840. ]),
  12841. tabindex: -1,
  12842. onClick: ($event) => _ctx.handleSuggestionClick(item)
  12843. }, [
  12844. createElementVNode("span", null, toDisplayString(item.text), 1),
  12845. item.checked ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  12846. default: withCtx(() => [
  12847. createVNode(_component_check)
  12848. ]),
  12849. _: 1
  12850. })) : createCommentVNode("v-if", true)
  12851. ], 10, _hoisted_4$c);
  12852. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  12853. createElementVNode("li", {
  12854. class: normalizeClass(_ctx.nsCascader.e("empty-text"))
  12855. }, toDisplayString(_ctx.t("el.cascader.noMatch")), 3)
  12856. ])
  12857. ]),
  12858. _: 3
  12859. }, 8, ["class", "view-class", "onKeydown"])), [
  12860. [vShow, _ctx.filtering]
  12861. ]) : createCommentVNode("v-if", true)
  12862. ]),
  12863. _: 3
  12864. }, 8, ["visible", "teleported", "popper-class", "popper-options", "transition", "onHide"]);
  12865. }
  12866. var Cascader = /* @__PURE__ */ _export_sfc$1(_sfc_main$E, [["render", _sfc_render$k], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader/src/index.vue"]]);
  12867. Cascader.install = (app) => {
  12868. app.component(Cascader.name, Cascader);
  12869. };
  12870. const _Cascader = Cascader;
  12871. const ElCascader = _Cascader;
  12872. var advancedFormat$1 = { exports: {} };
  12873. (function(module2, exports2) {
  12874. !function(e, t) {
  12875. module2.exports = t();
  12876. }(commonjsGlobal, function() {
  12877. return function(e, t, r) {
  12878. var n = t.prototype, s2 = n.format;
  12879. r.en.ordinal = function(e2) {
  12880. var t2 = ["th", "st", "nd", "rd"], r2 = e2 % 100;
  12881. return "[" + e2 + (t2[(r2 - 20) % 10] || t2[r2] || t2[0]) + "]";
  12882. }, n.format = function(e2) {
  12883. var t2 = this, r2 = this.$locale();
  12884. if (!this.isValid())
  12885. return s2.bind(this)(e2);
  12886. var n2 = 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) {
  12887. switch (e3) {
  12888. case "Q":
  12889. return Math.ceil((t2.$M + 1) / 3);
  12890. case "Do":
  12891. return r2.ordinal(t2.$D);
  12892. case "gggg":
  12893. return t2.weekYear();
  12894. case "GGGG":
  12895. return t2.isoWeekYear();
  12896. case "wo":
  12897. return r2.ordinal(t2.week(), "W");
  12898. case "w":
  12899. case "ww":
  12900. return n2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  12901. case "W":
  12902. case "WW":
  12903. return n2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  12904. case "k":
  12905. case "kk":
  12906. return n2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  12907. case "X":
  12908. return Math.floor(t2.$d.getTime() / 1e3);
  12909. case "x":
  12910. return t2.$d.getTime();
  12911. case "z":
  12912. return "[" + t2.offsetName() + "]";
  12913. case "zzz":
  12914. return "[" + t2.offsetName("long") + "]";
  12915. default:
  12916. return e3;
  12917. }
  12918. });
  12919. return s2.bind(this)(a2);
  12920. };
  12921. };
  12922. });
  12923. })(advancedFormat$1);
  12924. var advancedFormat = advancedFormat$1.exports;
  12925. var weekOfYear$1 = { exports: {} };
  12926. (function(module2, exports2) {
  12927. !function(e, t) {
  12928. module2.exports = t();
  12929. }(commonjsGlobal, function() {
  12930. var e = "week", t = "year";
  12931. return function(i, n, r) {
  12932. var f = n.prototype;
  12933. f.week = function(i2) {
  12934. if (i2 === void 0 && (i2 = null), i2 !== null)
  12935. return this.add(7 * (i2 - this.week()), "day");
  12936. var n2 = this.$locale().yearStart || 1;
  12937. if (this.month() === 11 && this.date() > 25) {
  12938. var f2 = r(this).startOf(t).add(1, t).date(n2), s2 = r(this).endOf(e);
  12939. if (f2.isBefore(s2))
  12940. return 1;
  12941. }
  12942. var a2 = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o2 = this.diff(a2, e, true);
  12943. return o2 < 0 ? r(this).startOf("week").week() : Math.ceil(o2);
  12944. }, f.weeks = function(e2) {
  12945. return e2 === void 0 && (e2 = null), this.week(e2);
  12946. };
  12947. };
  12948. });
  12949. })(weekOfYear$1);
  12950. var weekOfYear = weekOfYear$1.exports;
  12951. var weekYear$1 = { exports: {} };
  12952. (function(module2, exports2) {
  12953. !function(e, t) {
  12954. module2.exports = t();
  12955. }(commonjsGlobal, function() {
  12956. return function(e, t) {
  12957. t.prototype.weekYear = function() {
  12958. var e2 = this.month(), t2 = this.week(), n = this.year();
  12959. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  12960. };
  12961. };
  12962. });
  12963. })(weekYear$1);
  12964. var weekYear = weekYear$1.exports;
  12965. var dayOfYear$1 = { exports: {} };
  12966. (function(module2, exports2) {
  12967. !function(e, t) {
  12968. module2.exports = t();
  12969. }(commonjsGlobal, function() {
  12970. return function(e, t, n) {
  12971. t.prototype.dayOfYear = function(e2) {
  12972. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  12973. return e2 == null ? t2 : this.add(e2 - t2, "day");
  12974. };
  12975. };
  12976. });
  12977. })(dayOfYear$1);
  12978. var dayOfYear = dayOfYear$1.exports;
  12979. var isSameOrAfter$1 = { exports: {} };
  12980. (function(module2, exports2) {
  12981. !function(e, t) {
  12982. module2.exports = t();
  12983. }(commonjsGlobal, function() {
  12984. return function(e, t) {
  12985. t.prototype.isSameOrAfter = function(e2, t2) {
  12986. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  12987. };
  12988. };
  12989. });
  12990. })(isSameOrAfter$1);
  12991. var isSameOrAfter = isSameOrAfter$1.exports;
  12992. var isSameOrBefore$1 = { exports: {} };
  12993. (function(module2, exports2) {
  12994. !function(e, i) {
  12995. module2.exports = i();
  12996. }(commonjsGlobal, function() {
  12997. return function(e, i) {
  12998. i.prototype.isSameOrBefore = function(e2, i2) {
  12999. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  13000. };
  13001. };
  13002. });
  13003. })(isSameOrBefore$1);
  13004. var isSameOrBefore = isSameOrBefore$1.exports;
  13005. const ROOT_PICKER_INJECTION_KEY = Symbol();
  13006. var ElDatePickerCell = defineComponent({
  13007. name: "ElDatePickerCell",
  13008. props: buildProps({
  13009. cell: {
  13010. type: definePropType(Object)
  13011. }
  13012. }),
  13013. setup(props) {
  13014. const picker = inject(ROOT_PICKER_INJECTION_KEY);
  13015. return () => {
  13016. const cell = props.cell;
  13017. if (picker == null ? void 0 : picker.ctx.slots.default) {
  13018. const list = picker.ctx.slots.default(cell).filter((item) => {
  13019. return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)";
  13020. });
  13021. if (list.length) {
  13022. return list;
  13023. }
  13024. }
  13025. return h$1("div", {
  13026. class: "el-date-table-cell"
  13027. }, [
  13028. h$1("span", {
  13029. class: "el-date-table-cell__text"
  13030. }, [cell == null ? void 0 : cell.text])
  13031. ]);
  13032. };
  13033. }
  13034. });
  13035. const _sfc_main$D = defineComponent({
  13036. components: {
  13037. ElDatePickerCell
  13038. },
  13039. props: {
  13040. date: {
  13041. type: Object
  13042. },
  13043. minDate: {
  13044. type: Object
  13045. },
  13046. maxDate: {
  13047. type: Object
  13048. },
  13049. parsedValue: {
  13050. type: [Object, Array]
  13051. },
  13052. selectionMode: {
  13053. type: String,
  13054. default: "day"
  13055. },
  13056. showWeekNumber: {
  13057. type: Boolean,
  13058. default: false
  13059. },
  13060. disabledDate: {
  13061. type: Function
  13062. },
  13063. cellClassName: {
  13064. type: Function
  13065. },
  13066. rangeState: {
  13067. type: Object,
  13068. default: () => ({
  13069. endDate: null,
  13070. selecting: false
  13071. })
  13072. }
  13073. },
  13074. emits: ["changerange", "pick", "select"],
  13075. setup(props, ctx) {
  13076. const { t, lang } = useLocale();
  13077. const lastRow = ref(null);
  13078. const lastColumn = ref(null);
  13079. const tableRows = ref([[], [], [], [], [], []]);
  13080. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  13081. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_2) => _2.toLowerCase());
  13082. const offsetDay = computed(() => {
  13083. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  13084. });
  13085. const startDate = computed(() => {
  13086. const startDayOfMonth = props.date.startOf("month");
  13087. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  13088. });
  13089. const WEEKS = computed(() => {
  13090. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  13091. });
  13092. const rows = computed(() => {
  13093. var _a2;
  13094. const startOfMonth = props.date.startOf("month");
  13095. const startOfMonthDay = startOfMonth.day() || 7;
  13096. const dateCountOfMonth = startOfMonth.daysInMonth();
  13097. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  13098. const offset2 = offsetDay.value;
  13099. const rows_ = tableRows.value;
  13100. let count = 1;
  13101. const selectedDate = props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  13102. const calNow = dayjs().locale(lang.value).startOf("day");
  13103. for (let i = 0; i < 6; i++) {
  13104. const row = rows_[i];
  13105. if (props.showWeekNumber) {
  13106. if (!row[0]) {
  13107. row[0] = {
  13108. type: "week",
  13109. text: startDate.value.add(i * 7 + 1, "day").week()
  13110. };
  13111. }
  13112. }
  13113. for (let j = 0; j < 7; j++) {
  13114. let cell = row[props.showWeekNumber ? j + 1 : j];
  13115. if (!cell) {
  13116. cell = {
  13117. row: i,
  13118. column: j,
  13119. type: "normal",
  13120. inRange: false,
  13121. start: false,
  13122. end: false
  13123. };
  13124. }
  13125. const index = i * 7 + j;
  13126. const calTime = startDate.value.add(index - offset2, "day");
  13127. cell.dayjs = calTime;
  13128. cell.date = calTime.toDate();
  13129. cell.timestamp = calTime.valueOf();
  13130. cell.type = "normal";
  13131. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13132. 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");
  13133. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13134. cell.start = calEndDate && calTime.isSame(calEndDate, "day");
  13135. cell.end = props.minDate && calTime.isSame(props.minDate, "day");
  13136. } else {
  13137. cell.start = props.minDate && calTime.isSame(props.minDate, "day");
  13138. cell.end = calEndDate && calTime.isSame(calEndDate, "day");
  13139. }
  13140. const isToday = calTime.isSame(calNow, "day");
  13141. if (isToday) {
  13142. cell.type = "today";
  13143. }
  13144. if (i >= 0 && i <= 1) {
  13145. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset2 < 0 ? 7 + startOfMonthDay + offset2 : startOfMonthDay + offset2;
  13146. if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
  13147. cell.text = count++;
  13148. } else {
  13149. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
  13150. cell.type = "prev-month";
  13151. }
  13152. } else {
  13153. if (count <= dateCountOfMonth) {
  13154. cell.text = count++;
  13155. } else {
  13156. cell.text = count++ - dateCountOfMonth;
  13157. cell.type = "next-month";
  13158. }
  13159. }
  13160. const cellDate = calTime.toDate();
  13161. cell.selected = selectedDate.find((_2) => _2.valueOf() === calTime.valueOf());
  13162. cell.isSelected = !!cell.selected;
  13163. cell.isCurrent = isCurrent(cell);
  13164. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13165. cell.customClass = props.cellClassName && props.cellClassName(cellDate);
  13166. row[props.showWeekNumber ? j + 1 : j] = cell;
  13167. }
  13168. if (props.selectionMode === "week") {
  13169. const start2 = props.showWeekNumber ? 1 : 0;
  13170. const end2 = props.showWeekNumber ? 7 : 6;
  13171. const isActive = isWeekActive(row[start2 + 1]);
  13172. row[start2].inRange = isActive;
  13173. row[start2].start = isActive;
  13174. row[end2].inRange = isActive;
  13175. row[end2].end = isActive;
  13176. }
  13177. }
  13178. return rows_;
  13179. });
  13180. const isCurrent = (cell) => {
  13181. return props.selectionMode === "day" && (cell.type === "normal" || cell.type === "today") && cellMatchesDate(cell, props.parsedValue);
  13182. };
  13183. const cellMatchesDate = (cell, date4) => {
  13184. if (!date4)
  13185. return false;
  13186. return dayjs(date4).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day");
  13187. };
  13188. const getCellClasses = (cell) => {
  13189. const classes = [];
  13190. if ((cell.type === "normal" || cell.type === "today") && !cell.disabled) {
  13191. classes.push("available");
  13192. if (cell.type === "today") {
  13193. classes.push("today");
  13194. }
  13195. } else {
  13196. classes.push(cell.type);
  13197. }
  13198. if (isCurrent(cell)) {
  13199. classes.push("current");
  13200. }
  13201. if (cell.inRange && (cell.type === "normal" || cell.type === "today" || props.selectionMode === "week")) {
  13202. classes.push("in-range");
  13203. if (cell.start) {
  13204. classes.push("start-date");
  13205. }
  13206. if (cell.end) {
  13207. classes.push("end-date");
  13208. }
  13209. }
  13210. if (cell.disabled) {
  13211. classes.push("disabled");
  13212. }
  13213. if (cell.selected) {
  13214. classes.push("selected");
  13215. }
  13216. if (cell.customClass) {
  13217. classes.push(cell.customClass);
  13218. }
  13219. return classes.join(" ");
  13220. };
  13221. const getDateOfCell = (row, column) => {
  13222. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value;
  13223. return startDate.value.add(offsetFromStart, "day");
  13224. };
  13225. const handleMouseMove = (event) => {
  13226. if (!props.rangeState.selecting)
  13227. return;
  13228. let target = event.target;
  13229. if (target.tagName === "SPAN") {
  13230. target = target.parentNode.parentNode;
  13231. }
  13232. if (target.tagName === "DIV") {
  13233. target = target.parentNode;
  13234. }
  13235. if (target.tagName !== "TD")
  13236. return;
  13237. const row = target.parentNode.rowIndex - 1;
  13238. const column = target.cellIndex;
  13239. if (rows.value[row][column].disabled)
  13240. return;
  13241. if (row !== lastRow.value || column !== lastColumn.value) {
  13242. lastRow.value = row;
  13243. lastColumn.value = column;
  13244. ctx.emit("changerange", {
  13245. selecting: true,
  13246. endDate: getDateOfCell(row, column)
  13247. });
  13248. }
  13249. };
  13250. const handleClick = (event) => {
  13251. let target = event.target;
  13252. while (target) {
  13253. if (target.tagName === "TD") {
  13254. break;
  13255. }
  13256. target = target.parentNode;
  13257. }
  13258. if (!target || target.tagName !== "TD")
  13259. return;
  13260. const row = target.parentNode.rowIndex - 1;
  13261. const column = target.cellIndex;
  13262. const cell = rows.value[row][column];
  13263. if (cell.disabled || cell.type === "week")
  13264. return;
  13265. const newDate = getDateOfCell(row, column);
  13266. if (props.selectionMode === "range") {
  13267. if (!props.rangeState.selecting) {
  13268. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13269. ctx.emit("select", true);
  13270. } else {
  13271. if (newDate >= props.minDate) {
  13272. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13273. } else {
  13274. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13275. }
  13276. ctx.emit("select", false);
  13277. }
  13278. } else if (props.selectionMode === "day") {
  13279. ctx.emit("pick", newDate);
  13280. } else if (props.selectionMode === "week") {
  13281. const weekNumber = newDate.week();
  13282. const value = `${newDate.year()}w${weekNumber}`;
  13283. ctx.emit("pick", {
  13284. year: newDate.year(),
  13285. week: weekNumber,
  13286. value,
  13287. date: newDate.startOf("week")
  13288. });
  13289. } else if (props.selectionMode === "dates") {
  13290. const newValue = cell.selected ? castArray(props.parsedValue).filter((_2) => _2.valueOf() !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  13291. ctx.emit("pick", newValue);
  13292. }
  13293. };
  13294. const isWeekActive = (cell) => {
  13295. if (props.selectionMode !== "week")
  13296. return false;
  13297. let newDate = props.date.startOf("day");
  13298. if (cell.type === "prev-month") {
  13299. newDate = newDate.subtract(1, "month");
  13300. }
  13301. if (cell.type === "next-month") {
  13302. newDate = newDate.add(1, "month");
  13303. }
  13304. newDate = newDate.date(Number.parseInt(cell.text, 10));
  13305. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  13306. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  13307. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  13308. return weekDate.isSame(newDate, "day");
  13309. }
  13310. return false;
  13311. };
  13312. return {
  13313. handleMouseMove,
  13314. t,
  13315. rows,
  13316. isWeekActive,
  13317. getCellClasses,
  13318. WEEKS,
  13319. handleClick
  13320. };
  13321. }
  13322. });
  13323. const _hoisted_1$q = { key: 0 };
  13324. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  13325. const _component_el_date_picker_cell = resolveComponent("el-date-picker-cell");
  13326. return openBlock(), createElementBlock("table", {
  13327. cellspacing: "0",
  13328. cellpadding: "0",
  13329. class: normalizeClass(["el-date-table", { "is-week-mode": _ctx.selectionMode === "week" }]),
  13330. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
  13331. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13332. }, [
  13333. createElementVNode("tbody", null, [
  13334. createElementVNode("tr", null, [
  13335. _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", _hoisted_1$q, toDisplayString(_ctx.t("el.datepicker.week")), 1)) : createCommentVNode("v-if", true),
  13336. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.WEEKS, (week, key) => {
  13337. return openBlock(), createElementBlock("th", { key }, toDisplayString(_ctx.t("el.datepicker.weeks." + week)), 1);
  13338. }), 128))
  13339. ]),
  13340. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13341. return openBlock(), createElementBlock("tr", {
  13342. key,
  13343. class: normalizeClass(["el-date-table__row", { current: _ctx.isWeekActive(row[1]) }])
  13344. }, [
  13345. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13346. return openBlock(), createElementBlock("td", {
  13347. key: key_,
  13348. class: normalizeClass(_ctx.getCellClasses(cell))
  13349. }, [
  13350. createVNode(_component_el_date_picker_cell, { cell }, null, 8, ["cell"])
  13351. ], 2);
  13352. }), 128))
  13353. ], 2);
  13354. }), 128))
  13355. ])
  13356. ], 34);
  13357. }
  13358. var DateTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$j], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-date-table.vue"]]);
  13359. const datesInMonth = (year, month, lang) => {
  13360. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  13361. const numOfDays = firstDay.daysInMonth();
  13362. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13363. };
  13364. const _sfc_main$C = defineComponent({
  13365. props: {
  13366. disabledDate: {
  13367. type: Function
  13368. },
  13369. selectionMode: {
  13370. type: String,
  13371. default: "month"
  13372. },
  13373. minDate: {
  13374. type: Object
  13375. },
  13376. maxDate: {
  13377. type: Object
  13378. },
  13379. date: {
  13380. type: Object
  13381. },
  13382. parsedValue: {
  13383. type: Object
  13384. },
  13385. rangeState: {
  13386. type: Object,
  13387. default: () => ({
  13388. endDate: null,
  13389. selecting: false
  13390. })
  13391. }
  13392. },
  13393. emits: ["changerange", "pick", "select"],
  13394. setup(props, ctx) {
  13395. const { t, lang } = useLocale();
  13396. const months = ref(props.date.locale("en").localeData().monthsShort().map((_2) => _2.toLowerCase()));
  13397. const tableRows = ref([[], [], []]);
  13398. const lastRow = ref(null);
  13399. const lastColumn = ref(null);
  13400. const rows = computed(() => {
  13401. var _a2;
  13402. const rows2 = tableRows.value;
  13403. const now2 = dayjs().locale(lang.value).startOf("month");
  13404. for (let i = 0; i < 3; i++) {
  13405. const row = rows2[i];
  13406. for (let j = 0; j < 4; j++) {
  13407. let cell = row[j];
  13408. if (!cell) {
  13409. cell = {
  13410. row: i,
  13411. column: j,
  13412. type: "normal",
  13413. inRange: false,
  13414. start: false,
  13415. end: false
  13416. };
  13417. }
  13418. cell.type = "normal";
  13419. const index = i * 4 + j;
  13420. const calTime = props.date.startOf("year").month(index);
  13421. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13422. 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");
  13423. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13424. cell.start = calEndDate && calTime.isSame(calEndDate, "month");
  13425. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  13426. } else {
  13427. cell.start = props.minDate && calTime.isSame(props.minDate, "month");
  13428. cell.end = calEndDate && calTime.isSame(calEndDate, "month");
  13429. }
  13430. const isToday = now2.isSame(calTime);
  13431. if (isToday) {
  13432. cell.type = "today";
  13433. }
  13434. cell.text = index;
  13435. const cellDate = calTime.toDate();
  13436. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13437. row[j] = cell;
  13438. }
  13439. }
  13440. return rows2;
  13441. });
  13442. const getCellStyle = (cell) => {
  13443. const style = {};
  13444. const year = props.date.year();
  13445. const today = new Date();
  13446. const month = cell.text;
  13447. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  13448. style.current = castArray(props.parsedValue).findIndex((date4) => date4.year() === year && date4.month() === month) >= 0;
  13449. style.today = today.getFullYear() === year && today.getMonth() === month;
  13450. if (cell.inRange) {
  13451. style["in-range"] = true;
  13452. if (cell.start) {
  13453. style["start-date"] = true;
  13454. }
  13455. if (cell.end) {
  13456. style["end-date"] = true;
  13457. }
  13458. }
  13459. return style;
  13460. };
  13461. const handleMouseMove = (event) => {
  13462. if (!props.rangeState.selecting)
  13463. return;
  13464. let target = event.target;
  13465. if (target.tagName === "A") {
  13466. target = target.parentNode.parentNode;
  13467. }
  13468. if (target.tagName === "DIV") {
  13469. target = target.parentNode;
  13470. }
  13471. if (target.tagName !== "TD")
  13472. return;
  13473. const row = target.parentNode.rowIndex;
  13474. const column = target.cellIndex;
  13475. if (rows.value[row][column].disabled)
  13476. return;
  13477. if (row !== lastRow.value || column !== lastColumn.value) {
  13478. lastRow.value = row;
  13479. lastColumn.value = column;
  13480. ctx.emit("changerange", {
  13481. selecting: true,
  13482. endDate: props.date.startOf("year").month(row * 4 + column)
  13483. });
  13484. }
  13485. };
  13486. const handleMonthTableClick = (event) => {
  13487. let target = event.target;
  13488. if (target.tagName === "A") {
  13489. target = target.parentNode.parentNode;
  13490. }
  13491. if (target.tagName === "DIV") {
  13492. target = target.parentNode;
  13493. }
  13494. if (target.tagName !== "TD")
  13495. return;
  13496. if (hasClass(target, "disabled"))
  13497. return;
  13498. const column = target.cellIndex;
  13499. const row = target.parentNode.rowIndex;
  13500. const month = row * 4 + column;
  13501. const newDate = props.date.startOf("year").month(month);
  13502. if (props.selectionMode === "range") {
  13503. if (!props.rangeState.selecting) {
  13504. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13505. ctx.emit("select", true);
  13506. } else {
  13507. if (newDate >= props.minDate) {
  13508. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13509. } else {
  13510. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13511. }
  13512. ctx.emit("select", false);
  13513. }
  13514. } else {
  13515. ctx.emit("pick", month);
  13516. }
  13517. };
  13518. return {
  13519. handleMouseMove,
  13520. handleMonthTableClick,
  13521. rows,
  13522. getCellStyle,
  13523. t,
  13524. months
  13525. };
  13526. }
  13527. });
  13528. const _hoisted_1$p = { class: "cell" };
  13529. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  13530. return openBlock(), createElementBlock("table", {
  13531. class: "el-month-table",
  13532. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleMonthTableClick && _ctx.handleMonthTableClick(...args)),
  13533. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13534. }, [
  13535. createElementVNode("tbody", null, [
  13536. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13537. return openBlock(), createElementBlock("tr", { key }, [
  13538. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13539. return openBlock(), createElementBlock("td", {
  13540. key: key_,
  13541. class: normalizeClass(_ctx.getCellStyle(cell))
  13542. }, [
  13543. createElementVNode("div", null, [
  13544. createElementVNode("a", _hoisted_1$p, toDisplayString(_ctx.t("el.datepicker.months." + _ctx.months[cell.text])), 1)
  13545. ])
  13546. ], 2);
  13547. }), 128))
  13548. ]);
  13549. }), 128))
  13550. ])
  13551. ], 32);
  13552. }
  13553. var MonthTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$C, [["render", _sfc_render$i], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-month-table.vue"]]);
  13554. const datesInYear = (year, lang) => {
  13555. const firstDay = dayjs(String(year)).locale(lang).startOf("year");
  13556. const lastDay = firstDay.endOf("year");
  13557. const numOfDays = lastDay.dayOfYear();
  13558. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13559. };
  13560. const _sfc_main$B = defineComponent({
  13561. props: {
  13562. disabledDate: {
  13563. type: Function
  13564. },
  13565. parsedValue: {
  13566. type: Object
  13567. },
  13568. date: {
  13569. type: Object
  13570. }
  13571. },
  13572. emits: ["pick"],
  13573. setup(props, ctx) {
  13574. const { lang } = useLocale();
  13575. const startYear = computed(() => {
  13576. return Math.floor(props.date.year() / 10) * 10;
  13577. });
  13578. const getCellStyle = (year) => {
  13579. const style = {};
  13580. const today = dayjs().locale(lang.value);
  13581. style.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  13582. style.current = castArray(props.parsedValue).findIndex((_2) => _2.year() === year) >= 0;
  13583. style.today = today.year() === year;
  13584. return style;
  13585. };
  13586. const handleYearTableClick = (event) => {
  13587. const target = event.target;
  13588. if (target.tagName === "A") {
  13589. if (hasClass(target.parentNode, "disabled"))
  13590. return;
  13591. const year = target.textContent || target.innerText;
  13592. ctx.emit("pick", Number(year));
  13593. }
  13594. };
  13595. return {
  13596. startYear,
  13597. getCellStyle,
  13598. handleYearTableClick
  13599. };
  13600. }
  13601. });
  13602. const _hoisted_1$o = { class: "cell" };
  13603. const _hoisted_2$j = { class: "cell" };
  13604. const _hoisted_3$d = { class: "cell" };
  13605. const _hoisted_4$b = { class: "cell" };
  13606. const _hoisted_5$b = { class: "cell" };
  13607. const _hoisted_6$9 = { class: "cell" };
  13608. const _hoisted_7$6 = { class: "cell" };
  13609. const _hoisted_8$5 = { class: "cell" };
  13610. const _hoisted_9$5 = { class: "cell" };
  13611. const _hoisted_10$5 = { class: "cell" };
  13612. const _hoisted_11$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13613. const _hoisted_12$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13614. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  13615. return openBlock(), createElementBlock("table", {
  13616. class: "el-year-table",
  13617. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleYearTableClick && _ctx.handleYearTableClick(...args))
  13618. }, [
  13619. createElementVNode("tbody", null, [
  13620. createElementVNode("tr", null, [
  13621. createElementVNode("td", {
  13622. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 0)])
  13623. }, [
  13624. createElementVNode("a", _hoisted_1$o, toDisplayString(_ctx.startYear), 1)
  13625. ], 2),
  13626. createElementVNode("td", {
  13627. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 1)])
  13628. }, [
  13629. createElementVNode("a", _hoisted_2$j, toDisplayString(_ctx.startYear + 1), 1)
  13630. ], 2),
  13631. createElementVNode("td", {
  13632. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 2)])
  13633. }, [
  13634. createElementVNode("a", _hoisted_3$d, toDisplayString(_ctx.startYear + 2), 1)
  13635. ], 2),
  13636. createElementVNode("td", {
  13637. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 3)])
  13638. }, [
  13639. createElementVNode("a", _hoisted_4$b, toDisplayString(_ctx.startYear + 3), 1)
  13640. ], 2)
  13641. ]),
  13642. createElementVNode("tr", null, [
  13643. createElementVNode("td", {
  13644. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 4)])
  13645. }, [
  13646. createElementVNode("a", _hoisted_5$b, toDisplayString(_ctx.startYear + 4), 1)
  13647. ], 2),
  13648. createElementVNode("td", {
  13649. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 5)])
  13650. }, [
  13651. createElementVNode("a", _hoisted_6$9, toDisplayString(_ctx.startYear + 5), 1)
  13652. ], 2),
  13653. createElementVNode("td", {
  13654. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 6)])
  13655. }, [
  13656. createElementVNode("a", _hoisted_7$6, toDisplayString(_ctx.startYear + 6), 1)
  13657. ], 2),
  13658. createElementVNode("td", {
  13659. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 7)])
  13660. }, [
  13661. createElementVNode("a", _hoisted_8$5, toDisplayString(_ctx.startYear + 7), 1)
  13662. ], 2)
  13663. ]),
  13664. createElementVNode("tr", null, [
  13665. createElementVNode("td", {
  13666. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 8)])
  13667. }, [
  13668. createElementVNode("a", _hoisted_9$5, toDisplayString(_ctx.startYear + 8), 1)
  13669. ], 2),
  13670. createElementVNode("td", {
  13671. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 9)])
  13672. }, [
  13673. createElementVNode("a", _hoisted_10$5, toDisplayString(_ctx.startYear + 9), 1)
  13674. ], 2),
  13675. _hoisted_11$4,
  13676. _hoisted_12$4
  13677. ])
  13678. ])
  13679. ]);
  13680. }
  13681. var YearTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["render", _sfc_render$h], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-year-table.vue"]]);
  13682. const timeWithinRange = (_2, __, ___) => true;
  13683. const _sfc_main$A = defineComponent({
  13684. components: {
  13685. DateTable,
  13686. ElInput,
  13687. ElButton,
  13688. ElIcon,
  13689. TimePickPanel,
  13690. MonthTable,
  13691. YearTable,
  13692. DArrowLeft: dArrowLeft,
  13693. ArrowLeft: arrowLeft,
  13694. DArrowRight: dArrowRight,
  13695. ArrowRight: arrowRight
  13696. },
  13697. directives: { clickoutside: ClickOutside },
  13698. props: {
  13699. visible: {
  13700. type: Boolean,
  13701. default: false
  13702. },
  13703. parsedValue: {
  13704. type: [Object, Array]
  13705. },
  13706. format: {
  13707. type: String,
  13708. default: ""
  13709. },
  13710. type: {
  13711. type: String,
  13712. required: true,
  13713. validator: isValidDatePickType
  13714. }
  13715. },
  13716. emits: ["pick", "set-picker-option", "panel-change"],
  13717. setup(props, ctx) {
  13718. const { t, lang } = useLocale();
  13719. const pickerBase = inject("EP_PICKER_BASE");
  13720. const popper2 = inject(TOOLTIP_INJECTION_KEY);
  13721. const {
  13722. shortcuts,
  13723. disabledDate,
  13724. cellClassName,
  13725. defaultTime,
  13726. arrowControl
  13727. } = pickerBase.props;
  13728. const defaultValue = toRef(pickerBase.props, "defaultValue");
  13729. const innerDate = ref(dayjs().locale(lang.value));
  13730. const defaultTimeD = computed(() => {
  13731. return dayjs(defaultTime).locale(lang.value);
  13732. });
  13733. const month = computed(() => {
  13734. return innerDate.value.month();
  13735. });
  13736. const year = computed(() => {
  13737. return innerDate.value.year();
  13738. });
  13739. const selectableRange = ref([]);
  13740. const userInputDate = ref(null);
  13741. const userInputTime = ref(null);
  13742. const checkDateWithinRange = (date4) => {
  13743. return selectableRange.value.length > 0 ? timeWithinRange(date4, selectableRange.value, props.format || "HH:mm:ss") : true;
  13744. };
  13745. const formatEmit = (emitDayjs) => {
  13746. if (defaultTime && !visibleTime.value) {
  13747. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  13748. }
  13749. if (showTime.value)
  13750. return emitDayjs.millisecond(0);
  13751. return emitDayjs.startOf("day");
  13752. };
  13753. const emit = (value, ...args) => {
  13754. if (!value) {
  13755. ctx.emit("pick", value, ...args);
  13756. } else if (Array.isArray(value)) {
  13757. const dates = value.map(formatEmit);
  13758. ctx.emit("pick", dates, ...args);
  13759. } else {
  13760. ctx.emit("pick", formatEmit(value), ...args);
  13761. }
  13762. userInputDate.value = null;
  13763. userInputTime.value = null;
  13764. };
  13765. const handleDatePick = (value) => {
  13766. if (selectionMode.value === "day") {
  13767. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  13768. if (!checkDateWithinRange(newDate)) {
  13769. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  13770. }
  13771. innerDate.value = newDate;
  13772. emit(newDate, showTime.value);
  13773. } else if (selectionMode.value === "week") {
  13774. emit(value.date);
  13775. } else if (selectionMode.value === "dates") {
  13776. emit(value, true);
  13777. }
  13778. };
  13779. const prevMonth_ = () => {
  13780. innerDate.value = innerDate.value.subtract(1, "month");
  13781. handlePanelChange("month");
  13782. };
  13783. const nextMonth_ = () => {
  13784. innerDate.value = innerDate.value.add(1, "month");
  13785. handlePanelChange("month");
  13786. };
  13787. const prevYear_ = () => {
  13788. if (currentView.value === "year") {
  13789. innerDate.value = innerDate.value.subtract(10, "year");
  13790. } else {
  13791. innerDate.value = innerDate.value.subtract(1, "year");
  13792. }
  13793. handlePanelChange("year");
  13794. };
  13795. const nextYear_ = () => {
  13796. if (currentView.value === "year") {
  13797. innerDate.value = innerDate.value.add(10, "year");
  13798. } else {
  13799. innerDate.value = innerDate.value.add(1, "year");
  13800. }
  13801. handlePanelChange("year");
  13802. };
  13803. const currentView = ref("date");
  13804. const yearLabel = computed(() => {
  13805. const yearTranslation = t("el.datepicker.year");
  13806. if (currentView.value === "year") {
  13807. const startYear = Math.floor(year.value / 10) * 10;
  13808. if (yearTranslation) {
  13809. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  13810. }
  13811. return `${startYear} - ${startYear + 9}`;
  13812. }
  13813. return `${year.value} ${yearTranslation}`;
  13814. });
  13815. const handleShortcutClick = (shortcut) => {
  13816. const shortcutValue = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  13817. if (shortcutValue) {
  13818. emit(dayjs(shortcutValue).locale(lang.value));
  13819. return;
  13820. }
  13821. if (shortcut.onClick) {
  13822. shortcut.onClick(ctx);
  13823. }
  13824. };
  13825. const selectionMode = computed(() => {
  13826. if (["week", "month", "year", "dates"].includes(props.type)) {
  13827. return props.type;
  13828. }
  13829. return "day";
  13830. });
  13831. watch(() => selectionMode.value, (val) => {
  13832. if (["month", "year"].includes(val)) {
  13833. currentView.value = val;
  13834. return;
  13835. }
  13836. currentView.value = "date";
  13837. }, { immediate: true });
  13838. watch(() => currentView.value, () => {
  13839. popper2 == null ? void 0 : popper2.updatePopper();
  13840. });
  13841. const hasShortcuts = computed(() => !!shortcuts.length);
  13842. const handleMonthPick = (month2) => {
  13843. innerDate.value = innerDate.value.startOf("month").month(month2);
  13844. if (selectionMode.value === "month") {
  13845. emit(innerDate.value);
  13846. } else {
  13847. currentView.value = "date";
  13848. }
  13849. handlePanelChange("month");
  13850. };
  13851. const handleYearPick = (year2) => {
  13852. if (selectionMode.value === "year") {
  13853. innerDate.value = innerDate.value.startOf("year").year(year2);
  13854. emit(innerDate.value);
  13855. } else {
  13856. innerDate.value = innerDate.value.year(year2);
  13857. currentView.value = "month";
  13858. }
  13859. handlePanelChange("year");
  13860. };
  13861. const showMonthPicker = () => {
  13862. currentView.value = "month";
  13863. };
  13864. const showYearPicker = () => {
  13865. currentView.value = "year";
  13866. };
  13867. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  13868. const footerVisible = computed(() => {
  13869. return showTime.value || selectionMode.value === "dates";
  13870. });
  13871. const onConfirm = () => {
  13872. if (selectionMode.value === "dates") {
  13873. emit(props.parsedValue);
  13874. } else {
  13875. let result = props.parsedValue;
  13876. if (!result) {
  13877. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  13878. const defaultValueD = getDefaultValue();
  13879. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  13880. }
  13881. innerDate.value = result;
  13882. emit(result);
  13883. }
  13884. };
  13885. const changeToNow = () => {
  13886. const now2 = dayjs().locale(lang.value);
  13887. const nowDate = now2.toDate();
  13888. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  13889. innerDate.value = dayjs().locale(lang.value);
  13890. emit(innerDate.value);
  13891. }
  13892. };
  13893. const timeFormat = computed(() => {
  13894. return extractTimeFormat(props.format);
  13895. });
  13896. const dateFormat = computed(() => {
  13897. return extractDateFormat(props.format);
  13898. });
  13899. const visibleTime = computed(() => {
  13900. if (userInputTime.value)
  13901. return userInputTime.value;
  13902. if (!props.parsedValue && !defaultValue.value)
  13903. return;
  13904. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  13905. });
  13906. const visibleDate = computed(() => {
  13907. if (userInputDate.value)
  13908. return userInputDate.value;
  13909. if (!props.parsedValue && !defaultValue.value)
  13910. return;
  13911. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  13912. });
  13913. const timePickerVisible = ref(false);
  13914. const onTimePickerInputFocus = () => {
  13915. timePickerVisible.value = true;
  13916. };
  13917. const handleTimePickClose = () => {
  13918. timePickerVisible.value = false;
  13919. };
  13920. const handleTimePick = (value, visible, first) => {
  13921. const newDate = props.parsedValue ? props.parsedValue.hour(value.hour()).minute(value.minute()).second(value.second()) : value;
  13922. innerDate.value = newDate;
  13923. emit(innerDate.value, true);
  13924. if (!first) {
  13925. timePickerVisible.value = visible;
  13926. }
  13927. };
  13928. const handleVisibleTimeChange = (value) => {
  13929. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  13930. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  13931. innerDate.value = newDate.year(innerDate.value.year()).month(innerDate.value.month()).date(innerDate.value.date());
  13932. userInputTime.value = null;
  13933. timePickerVisible.value = false;
  13934. emit(innerDate.value, true);
  13935. }
  13936. };
  13937. const handleVisibleDateChange = (value) => {
  13938. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  13939. if (newDate.isValid()) {
  13940. if (disabledDate && disabledDate(newDate.toDate())) {
  13941. return;
  13942. }
  13943. innerDate.value = newDate.hour(innerDate.value.hour()).minute(innerDate.value.minute()).second(innerDate.value.second());
  13944. userInputDate.value = null;
  13945. emit(innerDate.value, true);
  13946. }
  13947. };
  13948. const isValidValue = (date4) => {
  13949. return dayjs.isDayjs(date4) && date4.isValid() && (disabledDate ? !disabledDate(date4.toDate()) : true);
  13950. };
  13951. const formatToString = (value) => {
  13952. if (selectionMode.value === "dates") {
  13953. return value.map((_2) => _2.format(props.format));
  13954. }
  13955. return value.format(props.format);
  13956. };
  13957. const parseUserInput = (value) => {
  13958. return dayjs(value, props.format).locale(lang.value);
  13959. };
  13960. const getDefaultValue = () => {
  13961. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  13962. if (!defaultValue.value) {
  13963. const defaultTimeDValue = defaultTimeD.value;
  13964. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  13965. }
  13966. return parseDate;
  13967. };
  13968. const handleKeydown = (event) => {
  13969. const { code, keyCode } = event;
  13970. const list = [
  13971. EVENT_CODE.up,
  13972. EVENT_CODE.down,
  13973. EVENT_CODE.left,
  13974. EVENT_CODE.right
  13975. ];
  13976. if (props.visible && !timePickerVisible.value) {
  13977. if (list.includes(code)) {
  13978. handleKeyControl(keyCode);
  13979. event.stopPropagation();
  13980. event.preventDefault();
  13981. }
  13982. if (code === EVENT_CODE.enter && userInputDate.value === null && userInputTime.value === null) {
  13983. emit(innerDate, false);
  13984. }
  13985. }
  13986. };
  13987. const handleKeyControl = (keyCode) => {
  13988. const mapping = {
  13989. year: {
  13990. 38: -4,
  13991. 40: 4,
  13992. 37: -1,
  13993. 39: 1,
  13994. offset: (date4, step) => date4.setFullYear(date4.getFullYear() + step)
  13995. },
  13996. month: {
  13997. 38: -4,
  13998. 40: 4,
  13999. 37: -1,
  14000. 39: 1,
  14001. offset: (date4, step) => date4.setMonth(date4.getMonth() + step)
  14002. },
  14003. week: {
  14004. 38: -1,
  14005. 40: 1,
  14006. 37: -1,
  14007. 39: 1,
  14008. offset: (date4, step) => date4.setDate(date4.getDate() + step * 7)
  14009. },
  14010. day: {
  14011. 38: -7,
  14012. 40: 7,
  14013. 37: -1,
  14014. 39: 1,
  14015. offset: (date4, step) => date4.setDate(date4.getDate() + step)
  14016. }
  14017. };
  14018. const newDate = innerDate.value.toDate();
  14019. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  14020. const map = mapping[selectionMode.value];
  14021. map.offset(newDate, map[keyCode]);
  14022. if (disabledDate && disabledDate(newDate)) {
  14023. continue;
  14024. }
  14025. const result = dayjs(newDate).locale(lang.value);
  14026. innerDate.value = result;
  14027. ctx.emit("pick", result, true);
  14028. break;
  14029. }
  14030. };
  14031. const handlePanelChange = (mode) => {
  14032. ctx.emit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  14033. };
  14034. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14035. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14036. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14037. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  14038. watch(() => defaultValue.value, (val) => {
  14039. if (val) {
  14040. innerDate.value = getDefaultValue();
  14041. }
  14042. }, { immediate: true });
  14043. watch(() => props.parsedValue, (val) => {
  14044. if (val) {
  14045. if (selectionMode.value === "dates")
  14046. return;
  14047. if (Array.isArray(val))
  14048. return;
  14049. innerDate.value = val;
  14050. } else {
  14051. innerDate.value = getDefaultValue();
  14052. }
  14053. }, { immediate: true });
  14054. return {
  14055. handleTimePick,
  14056. handleTimePickClose,
  14057. onTimePickerInputFocus,
  14058. timePickerVisible,
  14059. visibleTime,
  14060. visibleDate,
  14061. showTime,
  14062. changeToNow,
  14063. onConfirm,
  14064. footerVisible,
  14065. handleYearPick,
  14066. showMonthPicker,
  14067. showYearPicker,
  14068. handleMonthPick,
  14069. hasShortcuts,
  14070. shortcuts,
  14071. arrowControl,
  14072. disabledDate,
  14073. cellClassName,
  14074. selectionMode,
  14075. handleShortcutClick,
  14076. prevYear_,
  14077. nextYear_,
  14078. prevMonth_,
  14079. nextMonth_,
  14080. innerDate,
  14081. t,
  14082. yearLabel,
  14083. currentView,
  14084. month,
  14085. handleDatePick,
  14086. handleVisibleTimeChange,
  14087. handleVisibleDateChange,
  14088. timeFormat,
  14089. userInputTime,
  14090. userInputDate
  14091. };
  14092. }
  14093. });
  14094. const _hoisted_1$n = { class: "el-picker-panel__body-wrapper" };
  14095. const _hoisted_2$i = {
  14096. key: 0,
  14097. class: "el-picker-panel__sidebar"
  14098. };
  14099. const _hoisted_3$c = ["onClick"];
  14100. const _hoisted_4$a = { class: "el-picker-panel__body" };
  14101. const _hoisted_5$a = {
  14102. key: 0,
  14103. class: "el-date-picker__time-header"
  14104. };
  14105. const _hoisted_6$8 = { class: "el-date-picker__editor-wrap" };
  14106. const _hoisted_7$5 = { class: "el-date-picker__editor-wrap" };
  14107. const _hoisted_8$4 = ["aria-label"];
  14108. const _hoisted_9$4 = ["aria-label"];
  14109. const _hoisted_10$4 = ["aria-label"];
  14110. const _hoisted_11$3 = ["aria-label"];
  14111. const _hoisted_12$3 = { class: "el-picker-panel__content" };
  14112. const _hoisted_13$3 = { class: "el-picker-panel__footer" };
  14113. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  14114. const _component_el_input = resolveComponent("el-input");
  14115. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14116. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14117. const _component_el_icon = resolveComponent("el-icon");
  14118. const _component_arrow_left = resolveComponent("arrow-left");
  14119. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14120. const _component_arrow_right = resolveComponent("arrow-right");
  14121. const _component_date_table = resolveComponent("date-table");
  14122. const _component_year_table = resolveComponent("year-table");
  14123. const _component_month_table = resolveComponent("month-table");
  14124. const _component_el_button = resolveComponent("el-button");
  14125. const _directive_clickoutside = resolveDirective("clickoutside");
  14126. return openBlock(), createElementBlock("div", {
  14127. class: normalizeClass(["el-picker-panel el-date-picker", [
  14128. {
  14129. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  14130. "has-time": _ctx.showTime
  14131. }
  14132. ]])
  14133. }, [
  14134. createElementVNode("div", _hoisted_1$n, [
  14135. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  14136. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
  14137. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  14138. return openBlock(), createElementBlock("button", {
  14139. key,
  14140. type: "button",
  14141. class: "el-picker-panel__shortcut",
  14142. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  14143. }, toDisplayString(shortcut.text), 9, _hoisted_3$c);
  14144. }), 128))
  14145. ])) : createCommentVNode("v-if", true),
  14146. createElementVNode("div", _hoisted_4$a, [
  14147. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$a, [
  14148. createElementVNode("span", _hoisted_6$8, [
  14149. createVNode(_component_el_input, {
  14150. placeholder: _ctx.t("el.datepicker.selectDate"),
  14151. "model-value": _ctx.visibleDate,
  14152. size: "small",
  14153. onInput: _cache[0] || (_cache[0] = (val) => _ctx.userInputDate = val),
  14154. onChange: _ctx.handleVisibleDateChange
  14155. }, null, 8, ["placeholder", "model-value", "onChange"])
  14156. ]),
  14157. withDirectives((openBlock(), createElementBlock("span", _hoisted_7$5, [
  14158. createVNode(_component_el_input, {
  14159. placeholder: _ctx.t("el.datepicker.selectTime"),
  14160. "model-value": _ctx.visibleTime,
  14161. size: "small",
  14162. onFocus: _ctx.onTimePickerInputFocus,
  14163. onInput: _cache[1] || (_cache[1] = (val) => _ctx.userInputTime = val),
  14164. onChange: _ctx.handleVisibleTimeChange
  14165. }, null, 8, ["placeholder", "model-value", "onFocus", "onChange"]),
  14166. createVNode(_component_time_pick_panel, {
  14167. visible: _ctx.timePickerVisible,
  14168. format: _ctx.timeFormat,
  14169. "time-arrow-control": _ctx.arrowControl,
  14170. "parsed-value": _ctx.innerDate,
  14171. onPick: _ctx.handleTimePick
  14172. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14173. ])), [
  14174. [_directive_clickoutside, _ctx.handleTimePickClose]
  14175. ])
  14176. ])) : createCommentVNode("v-if", true),
  14177. withDirectives(createElementVNode("div", {
  14178. class: normalizeClass(["el-date-picker__header", {
  14179. "el-date-picker__header--bordered": _ctx.currentView === "year" || _ctx.currentView === "month"
  14180. }])
  14181. }, [
  14182. createElementVNode("button", {
  14183. type: "button",
  14184. "aria-label": _ctx.t(`el.datepicker.prevYear`),
  14185. class: "el-picker-panel__icon-btn el-date-picker__prev-btn d-arrow-left",
  14186. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.prevYear_ && _ctx.prevYear_(...args))
  14187. }, [
  14188. createVNode(_component_el_icon, null, {
  14189. default: withCtx(() => [
  14190. createVNode(_component_d_arrow_left)
  14191. ]),
  14192. _: 1
  14193. })
  14194. ], 8, _hoisted_8$4),
  14195. withDirectives(createElementVNode("button", {
  14196. type: "button",
  14197. "aria-label": _ctx.t(`el.datepicker.prevMonth`),
  14198. class: "el-picker-panel__icon-btn el-date-picker__prev-btn arrow-left",
  14199. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.prevMonth_ && _ctx.prevMonth_(...args))
  14200. }, [
  14201. createVNode(_component_el_icon, null, {
  14202. default: withCtx(() => [
  14203. createVNode(_component_arrow_left)
  14204. ]),
  14205. _: 1
  14206. })
  14207. ], 8, _hoisted_9$4), [
  14208. [vShow, _ctx.currentView === "date"]
  14209. ]),
  14210. createElementVNode("span", {
  14211. role: "button",
  14212. class: "el-date-picker__header-label",
  14213. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showYearPicker && _ctx.showYearPicker(...args))
  14214. }, toDisplayString(_ctx.yearLabel), 1),
  14215. withDirectives(createElementVNode("span", {
  14216. role: "button",
  14217. class: normalizeClass(["el-date-picker__header-label", { active: _ctx.currentView === "month" }]),
  14218. onClick: _cache[5] || (_cache[5] = (...args) => _ctx.showMonthPicker && _ctx.showMonthPicker(...args))
  14219. }, toDisplayString(_ctx.t(`el.datepicker.month${_ctx.month + 1}`)), 3), [
  14220. [vShow, _ctx.currentView === "date"]
  14221. ]),
  14222. createElementVNode("button", {
  14223. type: "button",
  14224. "aria-label": _ctx.t(`el.datepicker.nextYear`),
  14225. class: "el-picker-panel__icon-btn el-date-picker__next-btn d-arrow-right",
  14226. onClick: _cache[6] || (_cache[6] = (...args) => _ctx.nextYear_ && _ctx.nextYear_(...args))
  14227. }, [
  14228. createVNode(_component_el_icon, null, {
  14229. default: withCtx(() => [
  14230. createVNode(_component_d_arrow_right)
  14231. ]),
  14232. _: 1
  14233. })
  14234. ], 8, _hoisted_10$4),
  14235. withDirectives(createElementVNode("button", {
  14236. type: "button",
  14237. "aria-label": _ctx.t(`el.datepicker.nextMonth`),
  14238. class: "el-picker-panel__icon-btn el-date-picker__next-btn arrow-right",
  14239. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.nextMonth_ && _ctx.nextMonth_(...args))
  14240. }, [
  14241. createVNode(_component_el_icon, null, {
  14242. default: withCtx(() => [
  14243. createVNode(_component_arrow_right)
  14244. ]),
  14245. _: 1
  14246. })
  14247. ], 8, _hoisted_11$3), [
  14248. [vShow, _ctx.currentView === "date"]
  14249. ])
  14250. ], 2), [
  14251. [vShow, _ctx.currentView !== "time"]
  14252. ]),
  14253. createElementVNode("div", _hoisted_12$3, [
  14254. _ctx.currentView === "date" ? (openBlock(), createBlock(_component_date_table, {
  14255. key: 0,
  14256. "selection-mode": _ctx.selectionMode,
  14257. date: _ctx.innerDate,
  14258. "parsed-value": _ctx.parsedValue,
  14259. "disabled-date": _ctx.disabledDate,
  14260. "cell-class-name": _ctx.cellClassName,
  14261. onPick: _ctx.handleDatePick
  14262. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name", "onPick"])) : createCommentVNode("v-if", true),
  14263. _ctx.currentView === "year" ? (openBlock(), createBlock(_component_year_table, {
  14264. key: 1,
  14265. date: _ctx.innerDate,
  14266. "disabled-date": _ctx.disabledDate,
  14267. "parsed-value": _ctx.parsedValue,
  14268. onPick: _ctx.handleYearPick
  14269. }, null, 8, ["date", "disabled-date", "parsed-value", "onPick"])) : createCommentVNode("v-if", true),
  14270. _ctx.currentView === "month" ? (openBlock(), createBlock(_component_month_table, {
  14271. key: 2,
  14272. date: _ctx.innerDate,
  14273. "parsed-value": _ctx.parsedValue,
  14274. "disabled-date": _ctx.disabledDate,
  14275. onPick: _ctx.handleMonthPick
  14276. }, null, 8, ["date", "parsed-value", "disabled-date", "onPick"])) : createCommentVNode("v-if", true)
  14277. ])
  14278. ])
  14279. ]),
  14280. withDirectives(createElementVNode("div", _hoisted_13$3, [
  14281. withDirectives(createVNode(_component_el_button, {
  14282. size: "small",
  14283. type: "text",
  14284. class: "el-picker-panel__link-btn",
  14285. onClick: _ctx.changeToNow
  14286. }, {
  14287. default: withCtx(() => [
  14288. createTextVNode(toDisplayString(_ctx.t("el.datepicker.now")), 1)
  14289. ]),
  14290. _: 1
  14291. }, 8, ["onClick"]), [
  14292. [vShow, _ctx.selectionMode !== "dates"]
  14293. ]),
  14294. createVNode(_component_el_button, {
  14295. plain: "",
  14296. size: "small",
  14297. class: "el-picker-panel__link-btn",
  14298. onClick: _ctx.onConfirm
  14299. }, {
  14300. default: withCtx(() => [
  14301. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  14302. ]),
  14303. _: 1
  14304. }, 8, ["onClick"])
  14305. ], 512), [
  14306. [vShow, _ctx.footerVisible && _ctx.currentView === "date"]
  14307. ])
  14308. ], 2);
  14309. }
  14310. var DatePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["render", _sfc_render$g], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue"]]);
  14311. const _sfc_main$z = defineComponent({
  14312. directives: { clickoutside: ClickOutside },
  14313. components: {
  14314. TimePickPanel,
  14315. DateTable,
  14316. ElInput,
  14317. ElButton,
  14318. ElIcon,
  14319. DArrowLeft: dArrowLeft,
  14320. ArrowLeft: arrowLeft,
  14321. DArrowRight: dArrowRight,
  14322. ArrowRight: arrowRight
  14323. },
  14324. props: {
  14325. unlinkPanels: Boolean,
  14326. parsedValue: {
  14327. type: Array
  14328. },
  14329. type: {
  14330. type: String,
  14331. required: true,
  14332. validator: isValidDatePickType
  14333. }
  14334. },
  14335. emits: ["pick", "set-picker-option", "calendar-change", "panel-change"],
  14336. setup(props, ctx) {
  14337. const { t, lang } = useLocale();
  14338. const leftDate = ref(dayjs().locale(lang.value));
  14339. const rightDate = ref(dayjs().locale(lang.value).add(1, "month"));
  14340. const minDate = ref(null);
  14341. const maxDate = ref(null);
  14342. const dateUserInput = ref({
  14343. min: null,
  14344. max: null
  14345. });
  14346. const timeUserInput = ref({
  14347. min: null,
  14348. max: null
  14349. });
  14350. const leftLabel = computed(() => {
  14351. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  14352. });
  14353. const rightLabel = computed(() => {
  14354. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  14355. });
  14356. const leftYear = computed(() => {
  14357. return leftDate.value.year();
  14358. });
  14359. const leftMonth = computed(() => {
  14360. return leftDate.value.month();
  14361. });
  14362. const rightYear = computed(() => {
  14363. return rightDate.value.year();
  14364. });
  14365. const rightMonth = computed(() => {
  14366. return rightDate.value.month();
  14367. });
  14368. const hasShortcuts = computed(() => !!shortcuts.length);
  14369. const minVisibleDate = computed(() => {
  14370. if (dateUserInput.value.min !== null)
  14371. return dateUserInput.value.min;
  14372. if (minDate.value)
  14373. return minDate.value.format(dateFormat.value);
  14374. return "";
  14375. });
  14376. const maxVisibleDate = computed(() => {
  14377. if (dateUserInput.value.max !== null)
  14378. return dateUserInput.value.max;
  14379. if (maxDate.value || minDate.value)
  14380. return (maxDate.value || minDate.value).format(dateFormat.value);
  14381. return "";
  14382. });
  14383. const minVisibleTime = computed(() => {
  14384. if (timeUserInput.value.min !== null)
  14385. return timeUserInput.value.min;
  14386. if (minDate.value)
  14387. return minDate.value.format(timeFormat.value);
  14388. return "";
  14389. });
  14390. const maxVisibleTime = computed(() => {
  14391. if (timeUserInput.value.max !== null)
  14392. return timeUserInput.value.max;
  14393. if (maxDate.value || minDate.value)
  14394. return (maxDate.value || minDate.value).format(timeFormat.value);
  14395. return "";
  14396. });
  14397. const timeFormat = computed(() => {
  14398. return extractTimeFormat(format2);
  14399. });
  14400. const dateFormat = computed(() => {
  14401. return extractDateFormat(format2);
  14402. });
  14403. const leftPrevYear = () => {
  14404. leftDate.value = leftDate.value.subtract(1, "year");
  14405. if (!props.unlinkPanels) {
  14406. rightDate.value = leftDate.value.add(1, "month");
  14407. }
  14408. handlePanelChange("year");
  14409. };
  14410. const leftPrevMonth = () => {
  14411. leftDate.value = leftDate.value.subtract(1, "month");
  14412. if (!props.unlinkPanels) {
  14413. rightDate.value = leftDate.value.add(1, "month");
  14414. }
  14415. handlePanelChange("month");
  14416. };
  14417. const rightNextYear = () => {
  14418. if (!props.unlinkPanels) {
  14419. leftDate.value = leftDate.value.add(1, "year");
  14420. rightDate.value = leftDate.value.add(1, "month");
  14421. } else {
  14422. rightDate.value = rightDate.value.add(1, "year");
  14423. }
  14424. handlePanelChange("year");
  14425. };
  14426. const rightNextMonth = () => {
  14427. if (!props.unlinkPanels) {
  14428. leftDate.value = leftDate.value.add(1, "month");
  14429. rightDate.value = leftDate.value.add(1, "month");
  14430. } else {
  14431. rightDate.value = rightDate.value.add(1, "month");
  14432. }
  14433. handlePanelChange("month");
  14434. };
  14435. const leftNextYear = () => {
  14436. leftDate.value = leftDate.value.add(1, "year");
  14437. handlePanelChange("year");
  14438. };
  14439. const leftNextMonth = () => {
  14440. leftDate.value = leftDate.value.add(1, "month");
  14441. handlePanelChange("month");
  14442. };
  14443. const rightPrevYear = () => {
  14444. rightDate.value = rightDate.value.subtract(1, "year");
  14445. handlePanelChange("year");
  14446. };
  14447. const rightPrevMonth = () => {
  14448. rightDate.value = rightDate.value.subtract(1, "month");
  14449. handlePanelChange("month");
  14450. };
  14451. const handlePanelChange = (mode) => {
  14452. ctx.emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  14453. };
  14454. const enableMonthArrow = computed(() => {
  14455. const nextMonth = (leftMonth.value + 1) % 12;
  14456. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  14457. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  14458. });
  14459. const enableYearArrow = computed(() => {
  14460. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  14461. });
  14462. const isValidValue = (value) => {
  14463. return Array.isArray(value) && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  14464. };
  14465. const rangeState = ref({
  14466. endDate: null,
  14467. selecting: false
  14468. });
  14469. const btnDisabled = computed(() => {
  14470. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidValue([minDate.value, maxDate.value]));
  14471. });
  14472. const handleChangeRange = (val) => {
  14473. rangeState.value = val;
  14474. };
  14475. const onSelect = (selecting) => {
  14476. rangeState.value.selecting = selecting;
  14477. if (!selecting) {
  14478. rangeState.value.endDate = null;
  14479. }
  14480. };
  14481. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  14482. const handleConfirm = (visible = false) => {
  14483. if (isValidValue([minDate.value, maxDate.value])) {
  14484. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  14485. }
  14486. };
  14487. const formatEmit = (emitDayjs, index) => {
  14488. if (!emitDayjs)
  14489. return;
  14490. if (defaultTime) {
  14491. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  14492. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  14493. }
  14494. return emitDayjs;
  14495. };
  14496. const handleRangePick = (val, close2 = true) => {
  14497. const min_ = val.minDate;
  14498. const max_ = val.maxDate;
  14499. const minDate_ = formatEmit(min_, 0);
  14500. const maxDate_ = formatEmit(max_, 1);
  14501. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  14502. return;
  14503. }
  14504. ctx.emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  14505. maxDate.value = maxDate_;
  14506. minDate.value = minDate_;
  14507. if (!close2 || showTime.value)
  14508. return;
  14509. handleConfirm();
  14510. };
  14511. const handleShortcutClick = (shortcut) => {
  14512. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  14513. if (shortcutValues) {
  14514. ctx.emit("pick", [
  14515. dayjs(shortcutValues[0]).locale(lang.value),
  14516. dayjs(shortcutValues[1]).locale(lang.value)
  14517. ]);
  14518. return;
  14519. }
  14520. if (shortcut.onClick) {
  14521. shortcut.onClick(ctx);
  14522. }
  14523. };
  14524. const minTimePickerVisible = ref(false);
  14525. const maxTimePickerVisible = ref(false);
  14526. const handleMinTimeClose = () => {
  14527. minTimePickerVisible.value = false;
  14528. };
  14529. const handleMaxTimeClose = () => {
  14530. maxTimePickerVisible.value = false;
  14531. };
  14532. const handleDateInput = (value, type4) => {
  14533. dateUserInput.value[type4] = value;
  14534. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  14535. if (parsedValueD.isValid()) {
  14536. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  14537. return;
  14538. }
  14539. if (type4 === "min") {
  14540. leftDate.value = parsedValueD;
  14541. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14542. if (!props.unlinkPanels) {
  14543. rightDate.value = parsedValueD.add(1, "month");
  14544. maxDate.value = minDate.value.add(1, "month");
  14545. }
  14546. } else {
  14547. rightDate.value = parsedValueD;
  14548. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14549. if (!props.unlinkPanels) {
  14550. leftDate.value = parsedValueD.subtract(1, "month");
  14551. minDate.value = maxDate.value.subtract(1, "month");
  14552. }
  14553. }
  14554. }
  14555. };
  14556. const handleDateChange = (_2, type4) => {
  14557. dateUserInput.value[type4] = null;
  14558. };
  14559. const handleTimeInput = (value, type4) => {
  14560. timeUserInput.value[type4] = value;
  14561. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  14562. if (parsedValueD.isValid()) {
  14563. if (type4 === "min") {
  14564. minTimePickerVisible.value = true;
  14565. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14566. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14567. maxDate.value = minDate.value;
  14568. }
  14569. } else {
  14570. maxTimePickerVisible.value = true;
  14571. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14572. rightDate.value = maxDate.value;
  14573. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14574. minDate.value = maxDate.value;
  14575. }
  14576. }
  14577. }
  14578. };
  14579. const handleTimeChange = (value, type4) => {
  14580. timeUserInput.value[type4] = null;
  14581. if (type4 === "min") {
  14582. leftDate.value = minDate.value;
  14583. minTimePickerVisible.value = false;
  14584. } else {
  14585. rightDate.value = maxDate.value;
  14586. maxTimePickerVisible.value = false;
  14587. }
  14588. };
  14589. const handleMinTimePick = (value, visible, first) => {
  14590. if (timeUserInput.value.min)
  14591. return;
  14592. if (value) {
  14593. leftDate.value = value;
  14594. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14595. }
  14596. if (!first) {
  14597. minTimePickerVisible.value = visible;
  14598. }
  14599. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14600. maxDate.value = minDate.value;
  14601. rightDate.value = value;
  14602. }
  14603. };
  14604. const handleMaxTimePick = (value, visible, first) => {
  14605. if (timeUserInput.value.max)
  14606. return;
  14607. if (value) {
  14608. rightDate.value = value;
  14609. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14610. }
  14611. if (!first) {
  14612. maxTimePickerVisible.value = visible;
  14613. }
  14614. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14615. minDate.value = maxDate.value;
  14616. }
  14617. };
  14618. const handleClear = () => {
  14619. leftDate.value = getDefaultValue()[0];
  14620. rightDate.value = leftDate.value.add(1, "month");
  14621. ctx.emit("pick", null);
  14622. };
  14623. const formatToString = (value) => {
  14624. return Array.isArray(value) ? value.map((_2) => _2.format(format2)) : value.format(format2);
  14625. };
  14626. const parseUserInput = (value) => {
  14627. return Array.isArray(value) ? value.map((_2) => dayjs(_2, format2).locale(lang.value)) : dayjs(value, format2).locale(lang.value);
  14628. };
  14629. const getDefaultValue = () => {
  14630. let start2;
  14631. if (Array.isArray(defaultValue.value)) {
  14632. const left2 = dayjs(defaultValue.value[0]);
  14633. let right2 = dayjs(defaultValue.value[1]);
  14634. if (!props.unlinkPanels) {
  14635. right2 = left2.add(1, "month");
  14636. }
  14637. return [left2, right2];
  14638. } else if (defaultValue.value) {
  14639. start2 = dayjs(defaultValue.value);
  14640. } else {
  14641. start2 = dayjs();
  14642. }
  14643. start2 = start2.locale(lang.value);
  14644. return [start2, start2.add(1, "month")];
  14645. };
  14646. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14647. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14648. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14649. ctx.emit("set-picker-option", ["handleClear", handleClear]);
  14650. const pickerBase = inject("EP_PICKER_BASE");
  14651. const {
  14652. shortcuts,
  14653. disabledDate,
  14654. cellClassName,
  14655. format: format2,
  14656. defaultTime,
  14657. arrowControl,
  14658. clearable
  14659. } = pickerBase.props;
  14660. const defaultValue = toRef(pickerBase.props, "defaultValue");
  14661. watch(() => defaultValue.value, (val) => {
  14662. if (val) {
  14663. const defaultArr = getDefaultValue();
  14664. minDate.value = null;
  14665. maxDate.value = null;
  14666. leftDate.value = defaultArr[0];
  14667. rightDate.value = defaultArr[1];
  14668. }
  14669. }, { immediate: true });
  14670. watch(() => props.parsedValue, (newVal) => {
  14671. if (newVal && newVal.length === 2) {
  14672. minDate.value = newVal[0];
  14673. maxDate.value = newVal[1];
  14674. leftDate.value = minDate.value;
  14675. if (props.unlinkPanels && maxDate.value) {
  14676. const minDateYear = minDate.value.year();
  14677. const minDateMonth = minDate.value.month();
  14678. const maxDateYear = maxDate.value.year();
  14679. const maxDateMonth = maxDate.value.month();
  14680. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate.value.add(1, "month") : maxDate.value;
  14681. } else {
  14682. rightDate.value = leftDate.value.add(1, "month");
  14683. if (maxDate.value) {
  14684. rightDate.value = rightDate.value.hour(maxDate.value.hour()).minute(maxDate.value.minute()).second(maxDate.value.second());
  14685. }
  14686. }
  14687. } else {
  14688. const defaultArr = getDefaultValue();
  14689. minDate.value = null;
  14690. maxDate.value = null;
  14691. leftDate.value = defaultArr[0];
  14692. rightDate.value = defaultArr[1];
  14693. }
  14694. }, { immediate: true });
  14695. return {
  14696. shortcuts,
  14697. disabledDate,
  14698. cellClassName,
  14699. minTimePickerVisible,
  14700. maxTimePickerVisible,
  14701. handleMinTimeClose,
  14702. handleMaxTimeClose,
  14703. handleShortcutClick,
  14704. rangeState,
  14705. minDate,
  14706. maxDate,
  14707. handleRangePick,
  14708. onSelect,
  14709. handleChangeRange,
  14710. btnDisabled,
  14711. enableYearArrow,
  14712. enableMonthArrow,
  14713. rightPrevMonth,
  14714. rightPrevYear,
  14715. rightNextMonth,
  14716. rightNextYear,
  14717. leftPrevMonth,
  14718. leftPrevYear,
  14719. leftNextMonth,
  14720. leftNextYear,
  14721. hasShortcuts,
  14722. leftLabel,
  14723. rightLabel,
  14724. leftDate,
  14725. rightDate,
  14726. showTime,
  14727. t,
  14728. minVisibleDate,
  14729. maxVisibleDate,
  14730. minVisibleTime,
  14731. maxVisibleTime,
  14732. arrowControl,
  14733. handleDateInput,
  14734. handleDateChange,
  14735. handleTimeInput,
  14736. handleTimeChange,
  14737. handleMinTimePick,
  14738. handleMaxTimePick,
  14739. handleClear,
  14740. handleConfirm,
  14741. timeFormat,
  14742. clearable
  14743. };
  14744. }
  14745. });
  14746. const _hoisted_1$m = { class: "el-picker-panel__body-wrapper" };
  14747. const _hoisted_2$h = {
  14748. key: 0,
  14749. class: "el-picker-panel__sidebar"
  14750. };
  14751. const _hoisted_3$b = ["onClick"];
  14752. const _hoisted_4$9 = { class: "el-picker-panel__body" };
  14753. const _hoisted_5$9 = {
  14754. key: 0,
  14755. class: "el-date-range-picker__time-header"
  14756. };
  14757. const _hoisted_6$7 = { class: "el-date-range-picker__editors-wrap" };
  14758. const _hoisted_7$4 = { class: "el-date-range-picker__time-picker-wrap" };
  14759. const _hoisted_8$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14760. const _hoisted_9$3 = { class: "el-date-range-picker__editors-wrap is-right" };
  14761. const _hoisted_10$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14762. const _hoisted_11$2 = { class: "el-date-range-picker__time-picker-wrap" };
  14763. const _hoisted_12$2 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  14764. const _hoisted_13$2 = { class: "el-date-range-picker__header" };
  14765. const _hoisted_14$2 = ["disabled"];
  14766. const _hoisted_15$1 = ["disabled"];
  14767. const _hoisted_16$1 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  14768. const _hoisted_17$1 = { class: "el-date-range-picker__header" };
  14769. const _hoisted_18$1 = ["disabled"];
  14770. const _hoisted_19$1 = ["disabled"];
  14771. const _hoisted_20$1 = {
  14772. key: 0,
  14773. class: "el-picker-panel__footer"
  14774. };
  14775. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  14776. const _component_el_input = resolveComponent("el-input");
  14777. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14778. const _component_arrow_right = resolveComponent("arrow-right");
  14779. const _component_el_icon = resolveComponent("el-icon");
  14780. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14781. const _component_arrow_left = resolveComponent("arrow-left");
  14782. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14783. const _component_date_table = resolveComponent("date-table");
  14784. const _component_el_button = resolveComponent("el-button");
  14785. const _directive_clickoutside = resolveDirective("clickoutside");
  14786. return openBlock(), createElementBlock("div", {
  14787. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  14788. {
  14789. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  14790. "has-time": _ctx.showTime
  14791. }
  14792. ]])
  14793. }, [
  14794. createElementVNode("div", _hoisted_1$m, [
  14795. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  14796. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$h, [
  14797. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  14798. return openBlock(), createElementBlock("button", {
  14799. key,
  14800. type: "button",
  14801. class: "el-picker-panel__shortcut",
  14802. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  14803. }, toDisplayString(shortcut.text), 9, _hoisted_3$b);
  14804. }), 128))
  14805. ])) : createCommentVNode("v-if", true),
  14806. createElementVNode("div", _hoisted_4$9, [
  14807. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$9, [
  14808. createElementVNode("span", _hoisted_6$7, [
  14809. createElementVNode("span", _hoisted_7$4, [
  14810. createVNode(_component_el_input, {
  14811. size: "small",
  14812. disabled: _ctx.rangeState.selecting,
  14813. placeholder: _ctx.t("el.datepicker.startDate"),
  14814. class: "el-date-range-picker__editor",
  14815. "model-value": _ctx.minVisibleDate,
  14816. onInput: _cache[0] || (_cache[0] = (val) => _ctx.handleDateInput(val, "min")),
  14817. onChange: _cache[1] || (_cache[1] = (val) => _ctx.handleDateChange(val, "min"))
  14818. }, null, 8, ["disabled", "placeholder", "model-value"])
  14819. ]),
  14820. withDirectives((openBlock(), createElementBlock("span", _hoisted_8$3, [
  14821. createVNode(_component_el_input, {
  14822. size: "small",
  14823. class: "el-date-range-picker__editor",
  14824. disabled: _ctx.rangeState.selecting,
  14825. placeholder: _ctx.t("el.datepicker.startTime"),
  14826. "model-value": _ctx.minVisibleTime,
  14827. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.minTimePickerVisible = true),
  14828. onInput: _cache[3] || (_cache[3] = (val) => _ctx.handleTimeInput(val, "min")),
  14829. onChange: _cache[4] || (_cache[4] = (val) => _ctx.handleTimeChange(val, "min"))
  14830. }, null, 8, ["disabled", "placeholder", "model-value"]),
  14831. createVNode(_component_time_pick_panel, {
  14832. visible: _ctx.minTimePickerVisible,
  14833. format: _ctx.timeFormat,
  14834. "datetime-role": "start",
  14835. "time-arrow-control": _ctx.arrowControl,
  14836. "parsed-value": _ctx.leftDate,
  14837. onPick: _ctx.handleMinTimePick
  14838. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14839. ])), [
  14840. [_directive_clickoutside, _ctx.handleMinTimeClose]
  14841. ])
  14842. ]),
  14843. createElementVNode("span", null, [
  14844. createVNode(_component_el_icon, null, {
  14845. default: withCtx(() => [
  14846. createVNode(_component_arrow_right)
  14847. ]),
  14848. _: 1
  14849. })
  14850. ]),
  14851. createElementVNode("span", _hoisted_9$3, [
  14852. createElementVNode("span", _hoisted_10$3, [
  14853. createVNode(_component_el_input, {
  14854. size: "small",
  14855. class: "el-date-range-picker__editor",
  14856. disabled: _ctx.rangeState.selecting,
  14857. placeholder: _ctx.t("el.datepicker.endDate"),
  14858. "model-value": _ctx.maxVisibleDate,
  14859. readonly: !_ctx.minDate,
  14860. onInput: _cache[5] || (_cache[5] = (val) => _ctx.handleDateInput(val, "max")),
  14861. onChange: _cache[6] || (_cache[6] = (val) => _ctx.handleDateChange(val, "max"))
  14862. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"])
  14863. ]),
  14864. withDirectives((openBlock(), createElementBlock("span", _hoisted_11$2, [
  14865. createVNode(_component_el_input, {
  14866. size: "small",
  14867. class: "el-date-range-picker__editor",
  14868. disabled: _ctx.rangeState.selecting,
  14869. placeholder: _ctx.t("el.datepicker.endTime"),
  14870. "model-value": _ctx.maxVisibleTime,
  14871. readonly: !_ctx.minDate,
  14872. onFocus: _cache[7] || (_cache[7] = ($event) => _ctx.minDate && (_ctx.maxTimePickerVisible = true)),
  14873. onInput: _cache[8] || (_cache[8] = (val) => _ctx.handleTimeInput(val, "max")),
  14874. onChange: _cache[9] || (_cache[9] = (val) => _ctx.handleTimeChange(val, "max"))
  14875. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"]),
  14876. createVNode(_component_time_pick_panel, {
  14877. "datetime-role": "end",
  14878. visible: _ctx.maxTimePickerVisible,
  14879. format: _ctx.timeFormat,
  14880. "time-arrow-control": _ctx.arrowControl,
  14881. "parsed-value": _ctx.rightDate,
  14882. onPick: _ctx.handleMaxTimePick
  14883. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14884. ])), [
  14885. [_directive_clickoutside, _ctx.handleMaxTimeClose]
  14886. ])
  14887. ])
  14888. ])) : createCommentVNode("v-if", true),
  14889. createElementVNode("div", _hoisted_12$2, [
  14890. createElementVNode("div", _hoisted_13$2, [
  14891. createElementVNode("button", {
  14892. type: "button",
  14893. class: "el-picker-panel__icon-btn d-arrow-left",
  14894. onClick: _cache[10] || (_cache[10] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  14895. }, [
  14896. createVNode(_component_el_icon, null, {
  14897. default: withCtx(() => [
  14898. createVNode(_component_d_arrow_left)
  14899. ]),
  14900. _: 1
  14901. })
  14902. ]),
  14903. createElementVNode("button", {
  14904. type: "button",
  14905. class: "el-picker-panel__icon-btn arrow-left",
  14906. onClick: _cache[11] || (_cache[11] = (...args) => _ctx.leftPrevMonth && _ctx.leftPrevMonth(...args))
  14907. }, [
  14908. createVNode(_component_el_icon, null, {
  14909. default: withCtx(() => [
  14910. createVNode(_component_arrow_left)
  14911. ]),
  14912. _: 1
  14913. })
  14914. ]),
  14915. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  14916. key: 0,
  14917. type: "button",
  14918. disabled: !_ctx.enableYearArrow,
  14919. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  14920. onClick: _cache[12] || (_cache[12] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  14921. }, [
  14922. createVNode(_component_el_icon, null, {
  14923. default: withCtx(() => [
  14924. createVNode(_component_d_arrow_right)
  14925. ]),
  14926. _: 1
  14927. })
  14928. ], 10, _hoisted_14$2)) : createCommentVNode("v-if", true),
  14929. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  14930. key: 1,
  14931. type: "button",
  14932. disabled: !_ctx.enableMonthArrow,
  14933. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-right"]),
  14934. onClick: _cache[13] || (_cache[13] = (...args) => _ctx.leftNextMonth && _ctx.leftNextMonth(...args))
  14935. }, [
  14936. createVNode(_component_el_icon, null, {
  14937. default: withCtx(() => [
  14938. createVNode(_component_arrow_right)
  14939. ]),
  14940. _: 1
  14941. })
  14942. ], 10, _hoisted_15$1)) : createCommentVNode("v-if", true),
  14943. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  14944. ]),
  14945. createVNode(_component_date_table, {
  14946. "selection-mode": "range",
  14947. date: _ctx.leftDate,
  14948. "min-date": _ctx.minDate,
  14949. "max-date": _ctx.maxDate,
  14950. "range-state": _ctx.rangeState,
  14951. "disabled-date": _ctx.disabledDate,
  14952. "cell-class-name": _ctx.cellClassName,
  14953. onChangerange: _ctx.handleChangeRange,
  14954. onPick: _ctx.handleRangePick,
  14955. onSelect: _ctx.onSelect
  14956. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  14957. ]),
  14958. createElementVNode("div", _hoisted_16$1, [
  14959. createElementVNode("div", _hoisted_17$1, [
  14960. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  14961. key: 0,
  14962. type: "button",
  14963. disabled: !_ctx.enableYearArrow,
  14964. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  14965. onClick: _cache[14] || (_cache[14] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  14966. }, [
  14967. createVNode(_component_el_icon, null, {
  14968. default: withCtx(() => [
  14969. createVNode(_component_d_arrow_left)
  14970. ]),
  14971. _: 1
  14972. })
  14973. ], 10, _hoisted_18$1)) : createCommentVNode("v-if", true),
  14974. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  14975. key: 1,
  14976. type: "button",
  14977. disabled: !_ctx.enableMonthArrow,
  14978. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-left"]),
  14979. onClick: _cache[15] || (_cache[15] = (...args) => _ctx.rightPrevMonth && _ctx.rightPrevMonth(...args))
  14980. }, [
  14981. createVNode(_component_el_icon, null, {
  14982. default: withCtx(() => [
  14983. createVNode(_component_arrow_left)
  14984. ]),
  14985. _: 1
  14986. })
  14987. ], 10, _hoisted_19$1)) : createCommentVNode("v-if", true),
  14988. createElementVNode("button", {
  14989. type: "button",
  14990. class: "el-picker-panel__icon-btn d-arrow-right",
  14991. onClick: _cache[16] || (_cache[16] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  14992. }, [
  14993. createVNode(_component_el_icon, null, {
  14994. default: withCtx(() => [
  14995. createVNode(_component_d_arrow_right)
  14996. ]),
  14997. _: 1
  14998. })
  14999. ]),
  15000. createElementVNode("button", {
  15001. type: "button",
  15002. class: "el-picker-panel__icon-btn arrow-right",
  15003. onClick: _cache[17] || (_cache[17] = (...args) => _ctx.rightNextMonth && _ctx.rightNextMonth(...args))
  15004. }, [
  15005. createVNode(_component_el_icon, null, {
  15006. default: withCtx(() => [
  15007. createVNode(_component_arrow_right)
  15008. ]),
  15009. _: 1
  15010. })
  15011. ]),
  15012. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15013. ]),
  15014. createVNode(_component_date_table, {
  15015. "selection-mode": "range",
  15016. date: _ctx.rightDate,
  15017. "min-date": _ctx.minDate,
  15018. "max-date": _ctx.maxDate,
  15019. "range-state": _ctx.rangeState,
  15020. "disabled-date": _ctx.disabledDate,
  15021. "cell-class-name": _ctx.cellClassName,
  15022. onChangerange: _ctx.handleChangeRange,
  15023. onPick: _ctx.handleRangePick,
  15024. onSelect: _ctx.onSelect
  15025. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15026. ])
  15027. ])
  15028. ]),
  15029. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_20$1, [
  15030. _ctx.clearable ? (openBlock(), createBlock(_component_el_button, {
  15031. key: 0,
  15032. size: "small",
  15033. type: "text",
  15034. class: "el-picker-panel__link-btn",
  15035. onClick: _ctx.handleClear
  15036. }, {
  15037. default: withCtx(() => [
  15038. createTextVNode(toDisplayString(_ctx.t("el.datepicker.clear")), 1)
  15039. ]),
  15040. _: 1
  15041. }, 8, ["onClick"])) : createCommentVNode("v-if", true),
  15042. createVNode(_component_el_button, {
  15043. plain: "",
  15044. size: "small",
  15045. class: "el-picker-panel__link-btn",
  15046. disabled: _ctx.btnDisabled,
  15047. onClick: _cache[18] || (_cache[18] = ($event) => _ctx.handleConfirm(false))
  15048. }, {
  15049. default: withCtx(() => [
  15050. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  15051. ]),
  15052. _: 1
  15053. }, 8, ["disabled"])
  15054. ])) : createCommentVNode("v-if", true)
  15055. ], 2);
  15056. }
  15057. var DateRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["render", _sfc_render$f], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-range.vue"]]);
  15058. const _sfc_main$y = defineComponent({
  15059. components: { MonthTable, ElIcon, DArrowLeft: dArrowLeft, DArrowRight: dArrowRight },
  15060. props: {
  15061. unlinkPanels: Boolean,
  15062. parsedValue: {
  15063. type: Array
  15064. }
  15065. },
  15066. emits: ["pick", "set-picker-option"],
  15067. setup(props, ctx) {
  15068. const { t, lang } = useLocale();
  15069. const leftDate = ref(dayjs().locale(lang.value));
  15070. const rightDate = ref(dayjs().locale(lang.value).add(1, "year"));
  15071. const hasShortcuts = computed(() => !!shortcuts.length);
  15072. const handleShortcutClick = (shortcut) => {
  15073. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  15074. if (shortcutValues) {
  15075. ctx.emit("pick", [
  15076. dayjs(shortcutValues[0]).locale(lang.value),
  15077. dayjs(shortcutValues[1]).locale(lang.value)
  15078. ]);
  15079. return;
  15080. }
  15081. if (shortcut.onClick) {
  15082. shortcut.onClick(ctx);
  15083. }
  15084. };
  15085. const leftPrevYear = () => {
  15086. leftDate.value = leftDate.value.subtract(1, "year");
  15087. if (!props.unlinkPanels) {
  15088. rightDate.value = rightDate.value.subtract(1, "year");
  15089. }
  15090. };
  15091. const rightNextYear = () => {
  15092. if (!props.unlinkPanels) {
  15093. leftDate.value = leftDate.value.add(1, "year");
  15094. }
  15095. rightDate.value = rightDate.value.add(1, "year");
  15096. };
  15097. const leftNextYear = () => {
  15098. leftDate.value = leftDate.value.add(1, "year");
  15099. };
  15100. const rightPrevYear = () => {
  15101. rightDate.value = rightDate.value.subtract(1, "year");
  15102. };
  15103. const leftLabel = computed(() => {
  15104. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  15105. });
  15106. const rightLabel = computed(() => {
  15107. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  15108. });
  15109. const leftYear = computed(() => {
  15110. return leftDate.value.year();
  15111. });
  15112. const rightYear = computed(() => {
  15113. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  15114. });
  15115. const enableYearArrow = computed(() => {
  15116. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  15117. });
  15118. const minDate = ref(null);
  15119. const maxDate = ref(null);
  15120. const rangeState = ref({
  15121. endDate: null,
  15122. selecting: false
  15123. });
  15124. const handleChangeRange = (val) => {
  15125. rangeState.value = val;
  15126. };
  15127. const handleRangePick = (val, close2 = true) => {
  15128. const minDate_ = val.minDate;
  15129. const maxDate_ = val.maxDate;
  15130. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  15131. return;
  15132. }
  15133. maxDate.value = maxDate_;
  15134. minDate.value = minDate_;
  15135. if (!close2)
  15136. return;
  15137. handleConfirm();
  15138. };
  15139. const isValidValue = (value) => {
  15140. return Array.isArray(value) && value && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  15141. };
  15142. const handleConfirm = (visible = false) => {
  15143. if (isValidValue([minDate.value, maxDate.value])) {
  15144. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  15145. }
  15146. };
  15147. const onSelect = (selecting) => {
  15148. rangeState.value.selecting = selecting;
  15149. if (!selecting) {
  15150. rangeState.value.endDate = null;
  15151. }
  15152. };
  15153. const formatToString = (value) => {
  15154. return value.map((_2) => _2.format(format2));
  15155. };
  15156. const getDefaultValue = () => {
  15157. let start2;
  15158. if (Array.isArray(defaultValue.value)) {
  15159. const left2 = dayjs(defaultValue.value[0]);
  15160. let right2 = dayjs(defaultValue.value[1]);
  15161. if (!props.unlinkPanels) {
  15162. right2 = left2.add(1, "year");
  15163. }
  15164. return [left2, right2];
  15165. } else if (defaultValue.value) {
  15166. start2 = dayjs(defaultValue.value);
  15167. } else {
  15168. start2 = dayjs();
  15169. }
  15170. start2 = start2.locale(lang.value);
  15171. return [start2, start2.add(1, "year")];
  15172. };
  15173. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  15174. const pickerBase = inject("EP_PICKER_BASE");
  15175. const { shortcuts, disabledDate, format: format2 } = pickerBase.props;
  15176. const defaultValue = toRef(pickerBase.props, "defaultValue");
  15177. watch(() => defaultValue.value, (val) => {
  15178. if (val) {
  15179. const defaultArr = getDefaultValue();
  15180. leftDate.value = defaultArr[0];
  15181. rightDate.value = defaultArr[1];
  15182. }
  15183. }, { immediate: true });
  15184. watch(() => props.parsedValue, (newVal) => {
  15185. if (newVal && newVal.length === 2) {
  15186. minDate.value = newVal[0];
  15187. maxDate.value = newVal[1];
  15188. leftDate.value = minDate.value;
  15189. if (props.unlinkPanels && maxDate.value) {
  15190. const minDateYear = minDate.value.year();
  15191. const maxDateYear = maxDate.value.year();
  15192. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(1, "year") : maxDate.value;
  15193. } else {
  15194. rightDate.value = leftDate.value.add(1, "year");
  15195. }
  15196. } else {
  15197. const defaultArr = getDefaultValue();
  15198. minDate.value = null;
  15199. maxDate.value = null;
  15200. leftDate.value = defaultArr[0];
  15201. rightDate.value = defaultArr[1];
  15202. }
  15203. }, { immediate: true });
  15204. return {
  15205. shortcuts,
  15206. disabledDate,
  15207. onSelect,
  15208. handleRangePick,
  15209. rangeState,
  15210. handleChangeRange,
  15211. minDate,
  15212. maxDate,
  15213. enableYearArrow,
  15214. leftLabel,
  15215. rightLabel,
  15216. leftNextYear,
  15217. leftPrevYear,
  15218. rightNextYear,
  15219. rightPrevYear,
  15220. t,
  15221. leftDate,
  15222. rightDate,
  15223. hasShortcuts,
  15224. handleShortcutClick
  15225. };
  15226. }
  15227. });
  15228. const _hoisted_1$l = { class: "el-picker-panel__body-wrapper" };
  15229. const _hoisted_2$g = {
  15230. key: 0,
  15231. class: "el-picker-panel__sidebar"
  15232. };
  15233. const _hoisted_3$a = ["onClick"];
  15234. const _hoisted_4$8 = { class: "el-picker-panel__body" };
  15235. const _hoisted_5$8 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  15236. const _hoisted_6$6 = { class: "el-date-range-picker__header" };
  15237. const _hoisted_7$3 = ["disabled"];
  15238. const _hoisted_8$2 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  15239. const _hoisted_9$2 = { class: "el-date-range-picker__header" };
  15240. const _hoisted_10$2 = ["disabled"];
  15241. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  15242. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  15243. const _component_el_icon = resolveComponent("el-icon");
  15244. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  15245. const _component_month_table = resolveComponent("month-table");
  15246. return openBlock(), createElementBlock("div", {
  15247. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  15248. {
  15249. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts
  15250. }
  15251. ]])
  15252. }, [
  15253. createElementVNode("div", _hoisted_1$l, [
  15254. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  15255. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
  15256. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  15257. return openBlock(), createElementBlock("button", {
  15258. key,
  15259. type: "button",
  15260. class: "el-picker-panel__shortcut",
  15261. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  15262. }, toDisplayString(shortcut.text), 9, _hoisted_3$a);
  15263. }), 128))
  15264. ])) : createCommentVNode("v-if", true),
  15265. createElementVNode("div", _hoisted_4$8, [
  15266. createElementVNode("div", _hoisted_5$8, [
  15267. createElementVNode("div", _hoisted_6$6, [
  15268. createElementVNode("button", {
  15269. type: "button",
  15270. class: "el-picker-panel__icon-btn d-arrow-left",
  15271. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  15272. }, [
  15273. createVNode(_component_el_icon, null, {
  15274. default: withCtx(() => [
  15275. createVNode(_component_d_arrow_left)
  15276. ]),
  15277. _: 1
  15278. })
  15279. ]),
  15280. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15281. key: 0,
  15282. type: "button",
  15283. disabled: !_ctx.enableYearArrow,
  15284. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  15285. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  15286. }, [
  15287. createVNode(_component_el_icon, null, {
  15288. default: withCtx(() => [
  15289. createVNode(_component_d_arrow_right)
  15290. ]),
  15291. _: 1
  15292. })
  15293. ], 10, _hoisted_7$3)) : createCommentVNode("v-if", true),
  15294. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15295. ]),
  15296. createVNode(_component_month_table, {
  15297. "selection-mode": "range",
  15298. date: _ctx.leftDate,
  15299. "min-date": _ctx.minDate,
  15300. "max-date": _ctx.maxDate,
  15301. "range-state": _ctx.rangeState,
  15302. "disabled-date": _ctx.disabledDate,
  15303. onChangerange: _ctx.handleChangeRange,
  15304. onPick: _ctx.handleRangePick,
  15305. onSelect: _ctx.onSelect
  15306. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15307. ]),
  15308. createElementVNode("div", _hoisted_8$2, [
  15309. createElementVNode("div", _hoisted_9$2, [
  15310. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15311. key: 0,
  15312. type: "button",
  15313. disabled: !_ctx.enableYearArrow,
  15314. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15315. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15316. }, [
  15317. createVNode(_component_el_icon, null, {
  15318. default: withCtx(() => [
  15319. createVNode(_component_d_arrow_left)
  15320. ]),
  15321. _: 1
  15322. })
  15323. ], 10, _hoisted_10$2)) : createCommentVNode("v-if", true),
  15324. createElementVNode("button", {
  15325. type: "button",
  15326. class: "el-picker-panel__icon-btn d-arrow-right",
  15327. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15328. }, [
  15329. createVNode(_component_el_icon, null, {
  15330. default: withCtx(() => [
  15331. createVNode(_component_d_arrow_right)
  15332. ]),
  15333. _: 1
  15334. })
  15335. ]),
  15336. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15337. ]),
  15338. createVNode(_component_month_table, {
  15339. "selection-mode": "range",
  15340. date: _ctx.rightDate,
  15341. "min-date": _ctx.minDate,
  15342. "max-date": _ctx.maxDate,
  15343. "range-state": _ctx.rangeState,
  15344. "disabled-date": _ctx.disabledDate,
  15345. onChangerange: _ctx.handleChangeRange,
  15346. onPick: _ctx.handleRangePick,
  15347. onSelect: _ctx.onSelect
  15348. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15349. ])
  15350. ])
  15351. ])
  15352. ], 2);
  15353. }
  15354. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["render", _sfc_render$e], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-month-range.vue"]]);
  15355. dayjs.extend(localeData);
  15356. dayjs.extend(advancedFormat);
  15357. dayjs.extend(customParseFormat);
  15358. dayjs.extend(weekOfYear);
  15359. dayjs.extend(weekYear);
  15360. dayjs.extend(dayOfYear);
  15361. dayjs.extend(isSameOrAfter);
  15362. dayjs.extend(isSameOrBefore);
  15363. const getPanel = function(type4) {
  15364. if (type4 === "daterange" || type4 === "datetimerange") {
  15365. return DateRangePickPanel;
  15366. } else if (type4 === "monthrange") {
  15367. return MonthRangePickPanel;
  15368. }
  15369. return DatePickPanel;
  15370. };
  15371. var DatePicker = defineComponent({
  15372. name: "ElDatePicker",
  15373. install: null,
  15374. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  15375. type: {
  15376. type: String,
  15377. default: "date"
  15378. }
  15379. }),
  15380. emits: ["update:modelValue"],
  15381. setup(props, ctx) {
  15382. provide("ElPopperOptions", props.popperOptions);
  15383. provide(ROOT_PICKER_INJECTION_KEY, {
  15384. ctx
  15385. });
  15386. const commonPicker = ref(null);
  15387. const refProps = __spreadProps(__spreadValues({}, props), {
  15388. focus: (focusStartInput = true) => {
  15389. var _a2;
  15390. (_a2 = commonPicker.value) == null ? void 0 : _a2.focus(focusStartInput);
  15391. }
  15392. });
  15393. ctx.expose(refProps);
  15394. return () => {
  15395. var _a2;
  15396. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  15397. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  15398. format: format2,
  15399. type: props.type,
  15400. ref: commonPicker,
  15401. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  15402. }), {
  15403. default: (scopedProps) => h$1(getPanel(props.type), scopedProps),
  15404. "range-separator": () => renderSlot(ctx.slots, "range-separator")
  15405. });
  15406. };
  15407. }
  15408. });
  15409. const _DatePicker = DatePicker;
  15410. _DatePicker.install = (app) => {
  15411. app.component(_DatePicker.name, _DatePicker);
  15412. };
  15413. const ElDatePicker = _DatePicker;
  15414. const overlayProps = buildProps({
  15415. mask: {
  15416. type: Boolean,
  15417. default: true
  15418. },
  15419. customMaskEvent: {
  15420. type: Boolean,
  15421. default: false
  15422. },
  15423. overlayClass: {
  15424. type: definePropType([
  15425. String,
  15426. Array,
  15427. Object
  15428. ])
  15429. },
  15430. zIndex: {
  15431. type: definePropType([String, Number])
  15432. }
  15433. });
  15434. const overlayEmits = {
  15435. click: (evt) => evt instanceof MouseEvent
  15436. };
  15437. var Overlay = defineComponent({
  15438. name: "ElOverlay",
  15439. props: overlayProps,
  15440. emits: overlayEmits,
  15441. setup(props, { slots, emit }) {
  15442. const ns = useNamespace("overlay");
  15443. const onMaskClick = (e) => {
  15444. emit("click", e);
  15445. };
  15446. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  15447. return () => {
  15448. return props.mask ? createVNode("div", {
  15449. class: [ns.b(), props.overlayClass],
  15450. style: {
  15451. zIndex: props.zIndex
  15452. },
  15453. onClick,
  15454. onMousedown,
  15455. onMouseup
  15456. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
  15457. class: props.overlayClass,
  15458. style: {
  15459. zIndex: props.zIndex,
  15460. position: "fixed",
  15461. top: "0px",
  15462. right: "0px",
  15463. bottom: "0px",
  15464. left: "0px"
  15465. }
  15466. }, [renderSlot(slots, "default")]);
  15467. };
  15468. }
  15469. });
  15470. const ElOverlay = Overlay;
  15471. const dialogContentProps = buildProps({
  15472. center: {
  15473. type: Boolean,
  15474. default: false
  15475. },
  15476. closeIcon: {
  15477. type: iconPropType,
  15478. default: ""
  15479. },
  15480. customClass: {
  15481. type: String,
  15482. default: ""
  15483. },
  15484. draggable: {
  15485. type: Boolean,
  15486. default: false
  15487. },
  15488. fullscreen: {
  15489. type: Boolean,
  15490. default: false
  15491. },
  15492. showClose: {
  15493. type: Boolean,
  15494. default: true
  15495. },
  15496. title: {
  15497. type: String,
  15498. default: ""
  15499. }
  15500. });
  15501. const dialogContentEmits = {
  15502. close: () => true
  15503. };
  15504. const _hoisted_1$k = ["aria-label"];
  15505. const __default__$c = { name: "ElDialogContent" };
  15506. const _sfc_main$x = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$c), {
  15507. props: dialogContentProps,
  15508. emits: dialogContentEmits,
  15509. setup(__props) {
  15510. const { Close } = CloseComponents;
  15511. const { dialogRef, headerRef, ns, style } = inject(dialogInjectionKey);
  15512. return (_ctx, _cache) => {
  15513. return openBlock(), createElementBlock("div", {
  15514. ref_key: "dialogRef",
  15515. ref: dialogRef,
  15516. class: normalizeClass([
  15517. unref(ns).b(),
  15518. unref(ns).is("fullscreen", _ctx.fullscreen),
  15519. unref(ns).is("draggable", _ctx.draggable),
  15520. { [unref(ns).m("center")]: _ctx.center },
  15521. _ctx.customClass
  15522. ]),
  15523. "aria-modal": "true",
  15524. role: "dialog",
  15525. "aria-label": _ctx.title || "dialog",
  15526. style: normalizeStyle(unref(style)),
  15527. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  15528. }, ["stop"]))
  15529. }, [
  15530. createElementVNode("div", {
  15531. ref_key: "headerRef",
  15532. ref: headerRef,
  15533. class: normalizeClass(unref(ns).e("header"))
  15534. }, [
  15535. renderSlot(_ctx.$slots, "title", {}, () => [
  15536. createElementVNode("span", {
  15537. class: normalizeClass(unref(ns).e("title"))
  15538. }, toDisplayString(_ctx.title), 3)
  15539. ])
  15540. ], 2),
  15541. createElementVNode("div", {
  15542. class: normalizeClass(unref(ns).e("body"))
  15543. }, [
  15544. renderSlot(_ctx.$slots, "default")
  15545. ], 2),
  15546. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  15547. key: 0,
  15548. class: normalizeClass(unref(ns).e("footer"))
  15549. }, [
  15550. renderSlot(_ctx.$slots, "footer")
  15551. ], 2)) : createCommentVNode("v-if", true),
  15552. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  15553. key: 1,
  15554. "aria-label": "close",
  15555. class: normalizeClass(unref(ns).e("headerbtn")),
  15556. type: "button",
  15557. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  15558. }, [
  15559. createVNode(unref(ElIcon), {
  15560. class: normalizeClass(unref(ns).e("close"))
  15561. }, {
  15562. default: withCtx(() => [
  15563. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  15564. ]),
  15565. _: 1
  15566. }, 8, ["class"])
  15567. ], 2)) : createCommentVNode("v-if", true)
  15568. ], 14, _hoisted_1$k);
  15569. };
  15570. }
  15571. }));
  15572. var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
  15573. const dialogProps = buildProps(__spreadProps(__spreadValues({}, dialogContentProps), {
  15574. appendToBody: {
  15575. type: Boolean,
  15576. default: false
  15577. },
  15578. beforeClose: {
  15579. type: definePropType(Function)
  15580. },
  15581. destroyOnClose: {
  15582. type: Boolean,
  15583. default: false
  15584. },
  15585. closeOnClickModal: {
  15586. type: Boolean,
  15587. default: true
  15588. },
  15589. closeOnPressEscape: {
  15590. type: Boolean,
  15591. default: true
  15592. },
  15593. lockScroll: {
  15594. type: Boolean,
  15595. default: true
  15596. },
  15597. modal: {
  15598. type: Boolean,
  15599. default: true
  15600. },
  15601. openDelay: {
  15602. type: Number,
  15603. default: 0
  15604. },
  15605. closeDelay: {
  15606. type: Number,
  15607. default: 0
  15608. },
  15609. top: {
  15610. type: String
  15611. },
  15612. modelValue: {
  15613. type: Boolean,
  15614. required: true
  15615. },
  15616. modalClass: String,
  15617. width: {
  15618. type: [String, Number]
  15619. },
  15620. zIndex: {
  15621. type: Number
  15622. },
  15623. trapFocus: {
  15624. type: Boolean,
  15625. default: false
  15626. }
  15627. }));
  15628. const dialogEmits = {
  15629. open: () => true,
  15630. opened: () => true,
  15631. close: () => true,
  15632. closed: () => true,
  15633. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  15634. openAutoFocus: () => true,
  15635. closeAutoFocus: () => true
  15636. };
  15637. const useDialog = (props, targetRef) => {
  15638. const instance = getCurrentInstance();
  15639. const emit = instance.emit;
  15640. const { nextZIndex } = useZIndex();
  15641. let lastPosition = "";
  15642. const visible = ref(false);
  15643. const closed = ref(false);
  15644. const rendered = ref(false);
  15645. const zIndex2 = ref(props.zIndex || nextZIndex());
  15646. let openTimer = void 0;
  15647. let closeTimer = void 0;
  15648. const normalizeWidth = computed(() => isNumber(props.width) ? `${props.width}px` : props.width);
  15649. const style = computed(() => {
  15650. const style2 = {};
  15651. const varPrefix = `--el-dialog`;
  15652. if (!props.fullscreen) {
  15653. if (props.top) {
  15654. style2[`${varPrefix}-margin-top`] = props.top;
  15655. }
  15656. if (props.width) {
  15657. style2[`${varPrefix}-width`] = normalizeWidth.value;
  15658. }
  15659. }
  15660. return style2;
  15661. });
  15662. function afterEnter() {
  15663. emit("opened");
  15664. }
  15665. function afterLeave() {
  15666. emit("closed");
  15667. emit(UPDATE_MODEL_EVENT, false);
  15668. if (props.destroyOnClose) {
  15669. rendered.value = false;
  15670. }
  15671. }
  15672. function beforeLeave() {
  15673. emit("close");
  15674. }
  15675. function open() {
  15676. closeTimer == null ? void 0 : closeTimer();
  15677. openTimer == null ? void 0 : openTimer();
  15678. if (props.openDelay && props.openDelay > 0) {
  15679. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  15680. } else {
  15681. doOpen();
  15682. }
  15683. }
  15684. function close2() {
  15685. openTimer == null ? void 0 : openTimer();
  15686. closeTimer == null ? void 0 : closeTimer();
  15687. if (props.closeDelay && props.closeDelay > 0) {
  15688. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  15689. } else {
  15690. doClose();
  15691. }
  15692. }
  15693. function handleClose() {
  15694. function hide2(shouldCancel) {
  15695. if (shouldCancel)
  15696. return;
  15697. closed.value = true;
  15698. visible.value = false;
  15699. }
  15700. if (props.beforeClose) {
  15701. props.beforeClose(hide2);
  15702. } else {
  15703. close2();
  15704. }
  15705. }
  15706. function onModalClick() {
  15707. if (props.closeOnClickModal) {
  15708. handleClose();
  15709. }
  15710. }
  15711. function doOpen() {
  15712. if (!isClient$1)
  15713. return;
  15714. visible.value = true;
  15715. }
  15716. function doClose() {
  15717. visible.value = false;
  15718. }
  15719. if (props.lockScroll) {
  15720. useLockscreen(visible);
  15721. }
  15722. if (props.closeOnPressEscape) {
  15723. useModal({
  15724. handleClose
  15725. }, visible);
  15726. }
  15727. useRestoreActive(visible);
  15728. watch(() => props.modelValue, (val) => {
  15729. if (val) {
  15730. closed.value = false;
  15731. open();
  15732. rendered.value = true;
  15733. emit("open");
  15734. zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
  15735. nextTick(() => {
  15736. if (targetRef.value) {
  15737. targetRef.value.scrollTop = 0;
  15738. }
  15739. });
  15740. } else {
  15741. if (visible.value) {
  15742. close2();
  15743. }
  15744. }
  15745. });
  15746. watch(() => props.fullscreen, (val) => {
  15747. if (!targetRef.value)
  15748. return;
  15749. if (val) {
  15750. lastPosition = targetRef.value.style.transform;
  15751. targetRef.value.style.transform = "";
  15752. } else {
  15753. targetRef.value.style.transform = lastPosition;
  15754. }
  15755. });
  15756. onMounted(() => {
  15757. if (props.modelValue) {
  15758. visible.value = true;
  15759. rendered.value = true;
  15760. open();
  15761. }
  15762. });
  15763. return {
  15764. afterEnter,
  15765. afterLeave,
  15766. beforeLeave,
  15767. handleClose,
  15768. onModalClick,
  15769. close: close2,
  15770. doClose,
  15771. closed,
  15772. style,
  15773. rendered,
  15774. visible,
  15775. zIndex: zIndex2
  15776. };
  15777. };
  15778. const __default__$b = {
  15779. name: "ElDialog"
  15780. };
  15781. const _sfc_main$w = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$b), {
  15782. props: dialogProps,
  15783. emits: dialogEmits,
  15784. setup(__props, { expose }) {
  15785. const props = __props;
  15786. const ns = useNamespace("dialog");
  15787. const dialogRef = ref();
  15788. const headerRef = ref();
  15789. const {
  15790. visible,
  15791. style,
  15792. rendered,
  15793. zIndex: zIndex2,
  15794. afterEnter,
  15795. afterLeave,
  15796. beforeLeave,
  15797. handleClose,
  15798. onModalClick
  15799. } = useDialog(props, dialogRef);
  15800. provide(dialogInjectionKey, {
  15801. dialogRef,
  15802. headerRef,
  15803. ns,
  15804. rendered,
  15805. style
  15806. });
  15807. const overlayEvent = useSameTarget(onModalClick);
  15808. const draggable = computed(() => props.draggable && !props.fullscreen);
  15809. useDraggable(dialogRef, headerRef, draggable);
  15810. expose({
  15811. visible
  15812. });
  15813. return (_ctx, _cache) => {
  15814. return openBlock(), createBlock(Teleport, {
  15815. to: "body",
  15816. disabled: !_ctx.appendToBody
  15817. }, [
  15818. createVNode(Transition, {
  15819. name: "dialog-fade",
  15820. onAfterEnter: unref(afterEnter),
  15821. onAfterLeave: unref(afterLeave),
  15822. onBeforeLeave: unref(beforeLeave)
  15823. }, {
  15824. default: withCtx(() => [
  15825. withDirectives(createVNode(unref(ElOverlay), {
  15826. "custom-mask-event": "",
  15827. mask: _ctx.modal,
  15828. "overlay-class": _ctx.modalClass,
  15829. "z-index": unref(zIndex2)
  15830. }, {
  15831. default: withCtx(() => [
  15832. createElementVNode("div", {
  15833. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  15834. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  15835. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  15836. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  15837. }, [
  15838. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, {
  15839. key: 0,
  15840. "custom-class": _ctx.customClass,
  15841. center: _ctx.center,
  15842. "close-icon": _ctx.closeIcon,
  15843. draggable: unref(draggable),
  15844. fullscreen: _ctx.fullscreen,
  15845. "show-close": _ctx.showClose,
  15846. style: normalizeStyle(unref(style)),
  15847. title: _ctx.title,
  15848. onClose: unref(handleClose)
  15849. }, createSlots({
  15850. title: withCtx(() => [
  15851. renderSlot(_ctx.$slots, "title")
  15852. ]),
  15853. default: withCtx(() => [
  15854. renderSlot(_ctx.$slots, "default")
  15855. ]),
  15856. _: 2
  15857. }, [
  15858. _ctx.$slots.footer ? {
  15859. name: "footer",
  15860. fn: withCtx(() => [
  15861. renderSlot(_ctx.$slots, "footer")
  15862. ])
  15863. } : void 0
  15864. ]), 1032, ["custom-class", "center", "close-icon", "draggable", "fullscreen", "show-close", "style", "title", "onClose"])) : createCommentVNode("v-if", true)
  15865. ], 34)
  15866. ]),
  15867. _: 3
  15868. }, 8, ["mask", "overlay-class", "z-index"]), [
  15869. [vShow, unref(visible)]
  15870. ])
  15871. ]),
  15872. _: 3
  15873. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  15874. ], 8, ["disabled"]);
  15875. };
  15876. }
  15877. }));
  15878. var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
  15879. const ElDialog = withInstall(Dialog);
  15880. const dividerProps = buildProps({
  15881. direction: {
  15882. type: String,
  15883. values: ["horizontal", "vertical"],
  15884. default: "horizontal"
  15885. },
  15886. contentPosition: {
  15887. type: String,
  15888. values: ["left", "center", "right"],
  15889. default: "center"
  15890. },
  15891. borderStyle: {
  15892. type: definePropType(String),
  15893. default: "solid"
  15894. }
  15895. });
  15896. const __default__$a = {
  15897. name: "ElDivider"
  15898. };
  15899. const _sfc_main$v = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
  15900. props: dividerProps,
  15901. setup(__props) {
  15902. const props = __props;
  15903. const ns = useNamespace("divider");
  15904. const dividerStyle = computed(() => {
  15905. return {
  15906. "--el-border-style": props.borderStyle
  15907. };
  15908. });
  15909. return (_ctx, _cache) => {
  15910. return openBlock(), createElementBlock("div", {
  15911. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
  15912. style: normalizeStyle(unref(dividerStyle))
  15913. }, [
  15914. _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  15915. key: 0,
  15916. class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
  15917. }, [
  15918. renderSlot(_ctx.$slots, "default")
  15919. ], 2)) : createCommentVNode("v-if", true)
  15920. ], 6);
  15921. };
  15922. }
  15923. }));
  15924. var Divider = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/divider/src/divider.vue"]]);
  15925. const ElDivider = withInstall(Divider);
  15926. const formProps = buildProps({
  15927. model: Object,
  15928. rules: {
  15929. type: definePropType(Object)
  15930. },
  15931. labelPosition: String,
  15932. labelWidth: {
  15933. type: [String, Number],
  15934. default: ""
  15935. },
  15936. labelSuffix: {
  15937. type: String,
  15938. default: ""
  15939. },
  15940. inline: Boolean,
  15941. inlineMessage: Boolean,
  15942. statusIcon: Boolean,
  15943. showMessage: {
  15944. type: Boolean,
  15945. default: true
  15946. },
  15947. size: {
  15948. type: String,
  15949. values: componentSizes
  15950. },
  15951. disabled: Boolean,
  15952. validateOnRuleChange: {
  15953. type: Boolean,
  15954. default: true
  15955. },
  15956. hideRequiredAsterisk: {
  15957. type: Boolean,
  15958. default: false
  15959. },
  15960. scrollToError: Boolean
  15961. });
  15962. const formEmits = {
  15963. validate: (prop, isValid, message) => (isArray(prop) || isString(prop)) && isBoolean(isValid) && isString(message)
  15964. };
  15965. function useFormLabelWidth() {
  15966. const potentialLabelWidthArr = ref([]);
  15967. const autoLabelWidth = computed(() => {
  15968. if (!potentialLabelWidthArr.value.length)
  15969. return "0";
  15970. const max2 = Math.max(...potentialLabelWidthArr.value);
  15971. return max2 ? `${max2}px` : "";
  15972. });
  15973. function getLabelWidthIndex(width) {
  15974. const index = potentialLabelWidthArr.value.indexOf(width);
  15975. return index;
  15976. }
  15977. function registerLabelWidth(val, oldVal) {
  15978. if (val && oldVal) {
  15979. const index = getLabelWidthIndex(oldVal);
  15980. potentialLabelWidthArr.value.splice(index, 1, val);
  15981. } else if (val) {
  15982. potentialLabelWidthArr.value.push(val);
  15983. }
  15984. }
  15985. function deregisterLabelWidth(val) {
  15986. const index = getLabelWidthIndex(val);
  15987. if (index > -1) {
  15988. potentialLabelWidthArr.value.splice(index, 1);
  15989. }
  15990. }
  15991. return {
  15992. autoLabelWidth,
  15993. registerLabelWidth,
  15994. deregisterLabelWidth
  15995. };
  15996. }
  15997. const filterFields = (fields, props) => {
  15998. const normalized = castArray$1(props);
  15999. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  16000. };
  16001. const __default__$9 = {
  16002. name: "ElForm"
  16003. };
  16004. const _sfc_main$u = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
  16005. props: formProps,
  16006. emits: formEmits,
  16007. setup(__props, { expose, emit }) {
  16008. const props = __props;
  16009. const fields = [];
  16010. const formSize = useSize();
  16011. const ns = useNamespace("form");
  16012. const formClasses = computed(() => {
  16013. const { labelPosition, inline } = props;
  16014. return [
  16015. ns.b(),
  16016. ns.m(formSize.value || "default"),
  16017. {
  16018. [ns.m(`label-${labelPosition}`)]: labelPosition,
  16019. [ns.m("inline")]: inline
  16020. }
  16021. ];
  16022. });
  16023. const addField = (field) => {
  16024. fields.push(field);
  16025. };
  16026. const removeField = (field) => {
  16027. if (field.prop) {
  16028. fields.splice(fields.indexOf(field), 1);
  16029. }
  16030. };
  16031. const resetFields = (properties = []) => {
  16032. if (!props.model) {
  16033. return;
  16034. }
  16035. filterFields(fields, properties).forEach((field) => field.resetField());
  16036. };
  16037. const clearValidate = (props2 = []) => {
  16038. filterFields(fields, props2).forEach((field) => field.clearValidate());
  16039. };
  16040. const isValidatable = computed(() => {
  16041. const hasModel = !!props.model;
  16042. return hasModel;
  16043. });
  16044. const obtainValidateFields = (props2) => {
  16045. if (fields.length === 0)
  16046. return [];
  16047. const filteredFields = filterFields(fields, props2);
  16048. if (!filteredFields.length) {
  16049. return [];
  16050. }
  16051. return filteredFields;
  16052. };
  16053. const validate = async (callback) => validateField(void 0, callback);
  16054. const doValidateField = async (props2 = []) => {
  16055. if (!isValidatable.value)
  16056. return false;
  16057. const fields2 = obtainValidateFields(props2);
  16058. if (fields2.length === 0)
  16059. return true;
  16060. let validationErrors = {};
  16061. for (const field of fields2) {
  16062. try {
  16063. await field.validate("");
  16064. } catch (fields3) {
  16065. validationErrors = __spreadValues(__spreadValues({}, validationErrors), fields3);
  16066. }
  16067. }
  16068. if (Object.keys(validationErrors).length === 0)
  16069. return true;
  16070. return Promise.reject(validationErrors);
  16071. };
  16072. const validateField = async (modelProps = [], callback) => {
  16073. const shouldThrow = !isFunction(callback);
  16074. try {
  16075. const result = await doValidateField(modelProps);
  16076. if (result === true) {
  16077. callback == null ? void 0 : callback(result);
  16078. }
  16079. return result;
  16080. } catch (e) {
  16081. const invalidFields = e;
  16082. if (props.scrollToError) {
  16083. scrollToField(Object.keys(invalidFields)[0]);
  16084. }
  16085. callback == null ? void 0 : callback(false, invalidFields);
  16086. return shouldThrow && Promise.reject(invalidFields);
  16087. }
  16088. };
  16089. const scrollToField = (prop) => {
  16090. var _a2;
  16091. const field = filterFields(fields, prop)[0];
  16092. if (field) {
  16093. (_a2 = field.$el) == null ? void 0 : _a2.scrollIntoView();
  16094. }
  16095. };
  16096. watch(() => props.rules, () => {
  16097. if (props.validateOnRuleChange)
  16098. validate();
  16099. }, { deep: true });
  16100. provide(formContextKey, reactive(__spreadValues(__spreadProps(__spreadValues({}, toRefs(props)), {
  16101. emit,
  16102. resetFields,
  16103. clearValidate,
  16104. validateField,
  16105. addField,
  16106. removeField
  16107. }), useFormLabelWidth())));
  16108. expose({
  16109. validate,
  16110. validateField,
  16111. resetFields,
  16112. clearValidate,
  16113. scrollToField
  16114. });
  16115. return (_ctx, _cache) => {
  16116. return openBlock(), createElementBlock("form", {
  16117. class: normalizeClass(unref(formClasses))
  16118. }, [
  16119. renderSlot(_ctx.$slots, "default")
  16120. ], 2);
  16121. };
  16122. }
  16123. }));
  16124. var Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);
  16125. function _extends$1() {
  16126. _extends$1 = Object.assign || function(target) {
  16127. for (var i = 1; i < arguments.length; i++) {
  16128. var source = arguments[i];
  16129. for (var key in source) {
  16130. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16131. target[key] = source[key];
  16132. }
  16133. }
  16134. }
  16135. return target;
  16136. };
  16137. return _extends$1.apply(this, arguments);
  16138. }
  16139. function _inheritsLoose(subClass, superClass) {
  16140. subClass.prototype = Object.create(superClass.prototype);
  16141. subClass.prototype.constructor = subClass;
  16142. _setPrototypeOf(subClass, superClass);
  16143. }
  16144. function _getPrototypeOf(o2) {
  16145. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o3) {
  16146. return o3.__proto__ || Object.getPrototypeOf(o3);
  16147. };
  16148. return _getPrototypeOf(o2);
  16149. }
  16150. function _setPrototypeOf(o2, p2) {
  16151. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o3, p3) {
  16152. o3.__proto__ = p3;
  16153. return o3;
  16154. };
  16155. return _setPrototypeOf(o2, p2);
  16156. }
  16157. function _isNativeReflectConstruct() {
  16158. if (typeof Reflect === "undefined" || !Reflect.construct)
  16159. return false;
  16160. if (Reflect.construct.sham)
  16161. return false;
  16162. if (typeof Proxy === "function")
  16163. return true;
  16164. try {
  16165. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  16166. }));
  16167. return true;
  16168. } catch (e) {
  16169. return false;
  16170. }
  16171. }
  16172. function _construct(Parent, args, Class) {
  16173. if (_isNativeReflectConstruct()) {
  16174. _construct = Reflect.construct;
  16175. } else {
  16176. _construct = function _construct2(Parent2, args2, Class2) {
  16177. var a2 = [null];
  16178. a2.push.apply(a2, args2);
  16179. var Constructor = Function.bind.apply(Parent2, a2);
  16180. var instance = new Constructor();
  16181. if (Class2)
  16182. _setPrototypeOf(instance, Class2.prototype);
  16183. return instance;
  16184. };
  16185. }
  16186. return _construct.apply(null, arguments);
  16187. }
  16188. function _isNativeFunction(fn2) {
  16189. return Function.toString.call(fn2).indexOf("[native code]") !== -1;
  16190. }
  16191. function _wrapNativeSuper(Class) {
  16192. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  16193. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  16194. if (Class2 === null || !_isNativeFunction(Class2))
  16195. return Class2;
  16196. if (typeof Class2 !== "function") {
  16197. throw new TypeError("Super expression must either be null or a function");
  16198. }
  16199. if (typeof _cache !== "undefined") {
  16200. if (_cache.has(Class2))
  16201. return _cache.get(Class2);
  16202. _cache.set(Class2, Wrapper);
  16203. }
  16204. function Wrapper() {
  16205. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  16206. }
  16207. Wrapper.prototype = Object.create(Class2.prototype, {
  16208. constructor: {
  16209. value: Wrapper,
  16210. enumerable: false,
  16211. writable: true,
  16212. configurable: true
  16213. }
  16214. });
  16215. return _setPrototypeOf(Wrapper, Class2);
  16216. };
  16217. return _wrapNativeSuper(Class);
  16218. }
  16219. var formatRegExp = /%[sdj%]/g;
  16220. var warning = function warning2() {
  16221. };
  16222. if (typeof process !== "undefined" && process.env && false) {
  16223. warning = function warning3(type4, errors) {
  16224. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  16225. if (errors.every(function(e) {
  16226. return typeof e === "string";
  16227. })) {
  16228. console.warn(type4, errors);
  16229. }
  16230. }
  16231. };
  16232. }
  16233. function convertFieldsError(errors) {
  16234. if (!errors || !errors.length)
  16235. return null;
  16236. var fields = {};
  16237. errors.forEach(function(error) {
  16238. var field = error.field;
  16239. fields[field] = fields[field] || [];
  16240. fields[field].push(error);
  16241. });
  16242. return fields;
  16243. }
  16244. function format(template) {
  16245. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  16246. args[_key - 1] = arguments[_key];
  16247. }
  16248. var i = 0;
  16249. var len = args.length;
  16250. if (typeof template === "function") {
  16251. return template.apply(null, args);
  16252. }
  16253. if (typeof template === "string") {
  16254. var str = template.replace(formatRegExp, function(x2) {
  16255. if (x2 === "%%") {
  16256. return "%";
  16257. }
  16258. if (i >= len) {
  16259. return x2;
  16260. }
  16261. switch (x2) {
  16262. case "%s":
  16263. return String(args[i++]);
  16264. case "%d":
  16265. return Number(args[i++]);
  16266. case "%j":
  16267. try {
  16268. return JSON.stringify(args[i++]);
  16269. } catch (_2) {
  16270. return "[Circular]";
  16271. }
  16272. break;
  16273. default:
  16274. return x2;
  16275. }
  16276. });
  16277. return str;
  16278. }
  16279. return template;
  16280. }
  16281. function isNativeStringType(type4) {
  16282. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  16283. }
  16284. function isEmptyValue(value, type4) {
  16285. if (value === void 0 || value === null) {
  16286. return true;
  16287. }
  16288. if (type4 === "array" && Array.isArray(value) && !value.length) {
  16289. return true;
  16290. }
  16291. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  16292. return true;
  16293. }
  16294. return false;
  16295. }
  16296. function asyncParallelArray(arr, func, callback) {
  16297. var results = [];
  16298. var total = 0;
  16299. var arrLength = arr.length;
  16300. function count(errors) {
  16301. results.push.apply(results, errors || []);
  16302. total++;
  16303. if (total === arrLength) {
  16304. callback(results);
  16305. }
  16306. }
  16307. arr.forEach(function(a2) {
  16308. func(a2, count);
  16309. });
  16310. }
  16311. function asyncSerialArray(arr, func, callback) {
  16312. var index = 0;
  16313. var arrLength = arr.length;
  16314. function next(errors) {
  16315. if (errors && errors.length) {
  16316. callback(errors);
  16317. return;
  16318. }
  16319. var original = index;
  16320. index = index + 1;
  16321. if (original < arrLength) {
  16322. func(arr[original], next);
  16323. } else {
  16324. callback([]);
  16325. }
  16326. }
  16327. next([]);
  16328. }
  16329. function flattenObjArr(objArr) {
  16330. var ret = [];
  16331. Object.keys(objArr).forEach(function(k) {
  16332. ret.push.apply(ret, objArr[k] || []);
  16333. });
  16334. return ret;
  16335. }
  16336. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  16337. _inheritsLoose(AsyncValidationError2, _Error);
  16338. function AsyncValidationError2(errors, fields) {
  16339. var _this;
  16340. _this = _Error.call(this, "Async Validation Error") || this;
  16341. _this.errors = errors;
  16342. _this.fields = fields;
  16343. return _this;
  16344. }
  16345. return AsyncValidationError2;
  16346. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  16347. function asyncMap(objArr, option, func, callback, source) {
  16348. if (option.first) {
  16349. var _pending = new Promise(function(resolve, reject) {
  16350. var next = function next2(errors) {
  16351. callback(errors);
  16352. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  16353. };
  16354. var flattenArr = flattenObjArr(objArr);
  16355. asyncSerialArray(flattenArr, func, next);
  16356. });
  16357. _pending["catch"](function(e) {
  16358. return e;
  16359. });
  16360. return _pending;
  16361. }
  16362. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  16363. var objArrKeys = Object.keys(objArr);
  16364. var objArrLength = objArrKeys.length;
  16365. var total = 0;
  16366. var results = [];
  16367. var pending = new Promise(function(resolve, reject) {
  16368. var next = function next2(errors) {
  16369. results.push.apply(results, errors);
  16370. total++;
  16371. if (total === objArrLength) {
  16372. callback(results);
  16373. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  16374. }
  16375. };
  16376. if (!objArrKeys.length) {
  16377. callback(results);
  16378. resolve(source);
  16379. }
  16380. objArrKeys.forEach(function(key) {
  16381. var arr = objArr[key];
  16382. if (firstFields.indexOf(key) !== -1) {
  16383. asyncSerialArray(arr, func, next);
  16384. } else {
  16385. asyncParallelArray(arr, func, next);
  16386. }
  16387. });
  16388. });
  16389. pending["catch"](function(e) {
  16390. return e;
  16391. });
  16392. return pending;
  16393. }
  16394. function isErrorObj(obj) {
  16395. return !!(obj && obj.message !== void 0);
  16396. }
  16397. function getValue(value, path) {
  16398. var v2 = value;
  16399. for (var i = 0; i < path.length; i++) {
  16400. if (v2 == void 0) {
  16401. return v2;
  16402. }
  16403. v2 = v2[path[i]];
  16404. }
  16405. return v2;
  16406. }
  16407. function complementError(rule, source) {
  16408. return function(oe) {
  16409. var fieldValue;
  16410. if (rule.fullFields) {
  16411. fieldValue = getValue(source, rule.fullFields);
  16412. } else {
  16413. fieldValue = source[oe.field || rule.fullField];
  16414. }
  16415. if (isErrorObj(oe)) {
  16416. oe.field = oe.field || rule.fullField;
  16417. oe.fieldValue = fieldValue;
  16418. return oe;
  16419. }
  16420. return {
  16421. message: typeof oe === "function" ? oe() : oe,
  16422. fieldValue,
  16423. field: oe.field || rule.fullField
  16424. };
  16425. };
  16426. }
  16427. function deepMerge(target, source) {
  16428. if (source) {
  16429. for (var s2 in source) {
  16430. if (source.hasOwnProperty(s2)) {
  16431. var value = source[s2];
  16432. if (typeof value === "object" && typeof target[s2] === "object") {
  16433. target[s2] = _extends$1({}, target[s2], value);
  16434. } else {
  16435. target[s2] = value;
  16436. }
  16437. }
  16438. }
  16439. }
  16440. return target;
  16441. }
  16442. var required$1 = function required(rule, value, source, errors, options, type4) {
  16443. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  16444. errors.push(format(options.messages.required, rule.fullField));
  16445. }
  16446. };
  16447. var whitespace = function whitespace2(rule, value, source, errors, options) {
  16448. if (/^\s+$/.test(value) || value === "") {
  16449. errors.push(format(options.messages.whitespace, rule.fullField));
  16450. }
  16451. };
  16452. var pattern$2 = {
  16453. 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,}))$/,
  16454. url: new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", "i"),
  16455. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  16456. };
  16457. var types = {
  16458. integer: function integer(value) {
  16459. return types.number(value) && parseInt(value, 10) === value;
  16460. },
  16461. "float": function float(value) {
  16462. return types.number(value) && !types.integer(value);
  16463. },
  16464. array: function array(value) {
  16465. return Array.isArray(value);
  16466. },
  16467. regexp: function regexp(value) {
  16468. if (value instanceof RegExp) {
  16469. return true;
  16470. }
  16471. try {
  16472. return !!new RegExp(value);
  16473. } catch (e) {
  16474. return false;
  16475. }
  16476. },
  16477. date: function date(value) {
  16478. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  16479. },
  16480. number: function number(value) {
  16481. if (isNaN(value)) {
  16482. return false;
  16483. }
  16484. return typeof value === "number";
  16485. },
  16486. object: function object(value) {
  16487. return typeof value === "object" && !types.array(value);
  16488. },
  16489. method: function method(value) {
  16490. return typeof value === "function";
  16491. },
  16492. email: function email(value) {
  16493. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  16494. },
  16495. url: function url(value) {
  16496. return typeof value === "string" && value.length <= 2048 && !!value.match(pattern$2.url);
  16497. },
  16498. hex: function hex(value) {
  16499. return typeof value === "string" && !!value.match(pattern$2.hex);
  16500. }
  16501. };
  16502. var type$1 = function type(rule, value, source, errors, options) {
  16503. if (rule.required && value === void 0) {
  16504. required$1(rule, value, source, errors, options);
  16505. return;
  16506. }
  16507. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  16508. var ruleType = rule.type;
  16509. if (custom.indexOf(ruleType) > -1) {
  16510. if (!types[ruleType](value)) {
  16511. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16512. }
  16513. } else if (ruleType && typeof value !== rule.type) {
  16514. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16515. }
  16516. };
  16517. var range = function range2(rule, value, source, errors, options) {
  16518. var len = typeof rule.len === "number";
  16519. var min2 = typeof rule.min === "number";
  16520. var max2 = typeof rule.max === "number";
  16521. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  16522. var val = value;
  16523. var key = null;
  16524. var num = typeof value === "number";
  16525. var str = typeof value === "string";
  16526. var arr = Array.isArray(value);
  16527. if (num) {
  16528. key = "number";
  16529. } else if (str) {
  16530. key = "string";
  16531. } else if (arr) {
  16532. key = "array";
  16533. }
  16534. if (!key) {
  16535. return false;
  16536. }
  16537. if (arr) {
  16538. val = value.length;
  16539. }
  16540. if (str) {
  16541. val = value.replace(spRegexp, "_").length;
  16542. }
  16543. if (len) {
  16544. if (val !== rule.len) {
  16545. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  16546. }
  16547. } else if (min2 && !max2 && val < rule.min) {
  16548. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  16549. } else if (max2 && !min2 && val > rule.max) {
  16550. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  16551. } else if (min2 && max2 && (val < rule.min || val > rule.max)) {
  16552. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  16553. }
  16554. };
  16555. var ENUM$1 = "enum";
  16556. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  16557. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  16558. if (rule[ENUM$1].indexOf(value) === -1) {
  16559. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  16560. }
  16561. };
  16562. var pattern$1 = function pattern(rule, value, source, errors, options) {
  16563. if (rule.pattern) {
  16564. if (rule.pattern instanceof RegExp) {
  16565. rule.pattern.lastIndex = 0;
  16566. if (!rule.pattern.test(value)) {
  16567. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16568. }
  16569. } else if (typeof rule.pattern === "string") {
  16570. var _pattern = new RegExp(rule.pattern);
  16571. if (!_pattern.test(value)) {
  16572. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16573. }
  16574. }
  16575. }
  16576. };
  16577. var rules = {
  16578. required: required$1,
  16579. whitespace,
  16580. type: type$1,
  16581. range,
  16582. "enum": enumerable$1,
  16583. pattern: pattern$1
  16584. };
  16585. var string = function string2(rule, value, callback, source, options) {
  16586. var errors = [];
  16587. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16588. if (validate) {
  16589. if (isEmptyValue(value, "string") && !rule.required) {
  16590. return callback();
  16591. }
  16592. rules.required(rule, value, source, errors, options, "string");
  16593. if (!isEmptyValue(value, "string")) {
  16594. rules.type(rule, value, source, errors, options);
  16595. rules.range(rule, value, source, errors, options);
  16596. rules.pattern(rule, value, source, errors, options);
  16597. if (rule.whitespace === true) {
  16598. rules.whitespace(rule, value, source, errors, options);
  16599. }
  16600. }
  16601. }
  16602. callback(errors);
  16603. };
  16604. var method2 = function method3(rule, value, callback, source, options) {
  16605. var errors = [];
  16606. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16607. if (validate) {
  16608. if (isEmptyValue(value) && !rule.required) {
  16609. return callback();
  16610. }
  16611. rules.required(rule, value, source, errors, options);
  16612. if (value !== void 0) {
  16613. rules.type(rule, value, source, errors, options);
  16614. }
  16615. }
  16616. callback(errors);
  16617. };
  16618. var number2 = function number3(rule, value, callback, source, options) {
  16619. var errors = [];
  16620. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16621. if (validate) {
  16622. if (value === "") {
  16623. value = void 0;
  16624. }
  16625. if (isEmptyValue(value) && !rule.required) {
  16626. return callback();
  16627. }
  16628. rules.required(rule, value, source, errors, options);
  16629. if (value !== void 0) {
  16630. rules.type(rule, value, source, errors, options);
  16631. rules.range(rule, value, source, errors, options);
  16632. }
  16633. }
  16634. callback(errors);
  16635. };
  16636. var _boolean = function _boolean2(rule, value, callback, source, options) {
  16637. var errors = [];
  16638. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16639. if (validate) {
  16640. if (isEmptyValue(value) && !rule.required) {
  16641. return callback();
  16642. }
  16643. rules.required(rule, value, source, errors, options);
  16644. if (value !== void 0) {
  16645. rules.type(rule, value, source, errors, options);
  16646. }
  16647. }
  16648. callback(errors);
  16649. };
  16650. var regexp2 = function regexp3(rule, value, callback, source, options) {
  16651. var errors = [];
  16652. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16653. if (validate) {
  16654. if (isEmptyValue(value) && !rule.required) {
  16655. return callback();
  16656. }
  16657. rules.required(rule, value, source, errors, options);
  16658. if (!isEmptyValue(value)) {
  16659. rules.type(rule, value, source, errors, options);
  16660. }
  16661. }
  16662. callback(errors);
  16663. };
  16664. var integer2 = function integer3(rule, value, callback, source, options) {
  16665. var errors = [];
  16666. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16667. if (validate) {
  16668. if (isEmptyValue(value) && !rule.required) {
  16669. return callback();
  16670. }
  16671. rules.required(rule, value, source, errors, options);
  16672. if (value !== void 0) {
  16673. rules.type(rule, value, source, errors, options);
  16674. rules.range(rule, value, source, errors, options);
  16675. }
  16676. }
  16677. callback(errors);
  16678. };
  16679. var floatFn = function floatFn2(rule, value, callback, source, options) {
  16680. var errors = [];
  16681. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16682. if (validate) {
  16683. if (isEmptyValue(value) && !rule.required) {
  16684. return callback();
  16685. }
  16686. rules.required(rule, value, source, errors, options);
  16687. if (value !== void 0) {
  16688. rules.type(rule, value, source, errors, options);
  16689. rules.range(rule, value, source, errors, options);
  16690. }
  16691. }
  16692. callback(errors);
  16693. };
  16694. var array2 = function array3(rule, value, callback, source, options) {
  16695. var errors = [];
  16696. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16697. if (validate) {
  16698. if ((value === void 0 || value === null) && !rule.required) {
  16699. return callback();
  16700. }
  16701. rules.required(rule, value, source, errors, options, "array");
  16702. if (value !== void 0 && value !== null) {
  16703. rules.type(rule, value, source, errors, options);
  16704. rules.range(rule, value, source, errors, options);
  16705. }
  16706. }
  16707. callback(errors);
  16708. };
  16709. var object2 = function object3(rule, value, callback, source, options) {
  16710. var errors = [];
  16711. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16712. if (validate) {
  16713. if (isEmptyValue(value) && !rule.required) {
  16714. return callback();
  16715. }
  16716. rules.required(rule, value, source, errors, options);
  16717. if (value !== void 0) {
  16718. rules.type(rule, value, source, errors, options);
  16719. }
  16720. }
  16721. callback(errors);
  16722. };
  16723. var ENUM = "enum";
  16724. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  16725. var errors = [];
  16726. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16727. if (validate) {
  16728. if (isEmptyValue(value) && !rule.required) {
  16729. return callback();
  16730. }
  16731. rules.required(rule, value, source, errors, options);
  16732. if (value !== void 0) {
  16733. rules[ENUM](rule, value, source, errors, options);
  16734. }
  16735. }
  16736. callback(errors);
  16737. };
  16738. var pattern2 = function pattern3(rule, value, callback, source, options) {
  16739. var errors = [];
  16740. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16741. if (validate) {
  16742. if (isEmptyValue(value, "string") && !rule.required) {
  16743. return callback();
  16744. }
  16745. rules.required(rule, value, source, errors, options);
  16746. if (!isEmptyValue(value, "string")) {
  16747. rules.pattern(rule, value, source, errors, options);
  16748. }
  16749. }
  16750. callback(errors);
  16751. };
  16752. var date2 = function date3(rule, value, callback, source, options) {
  16753. var errors = [];
  16754. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16755. if (validate) {
  16756. if (isEmptyValue(value, "date") && !rule.required) {
  16757. return callback();
  16758. }
  16759. rules.required(rule, value, source, errors, options);
  16760. if (!isEmptyValue(value, "date")) {
  16761. var dateObject;
  16762. if (value instanceof Date) {
  16763. dateObject = value;
  16764. } else {
  16765. dateObject = new Date(value);
  16766. }
  16767. rules.type(rule, dateObject, source, errors, options);
  16768. if (dateObject) {
  16769. rules.range(rule, dateObject.getTime(), source, errors, options);
  16770. }
  16771. }
  16772. }
  16773. callback(errors);
  16774. };
  16775. var required2 = function required3(rule, value, callback, source, options) {
  16776. var errors = [];
  16777. var type4 = Array.isArray(value) ? "array" : typeof value;
  16778. rules.required(rule, value, source, errors, options, type4);
  16779. callback(errors);
  16780. };
  16781. var type2 = function type3(rule, value, callback, source, options) {
  16782. var ruleType = rule.type;
  16783. var errors = [];
  16784. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16785. if (validate) {
  16786. if (isEmptyValue(value, ruleType) && !rule.required) {
  16787. return callback();
  16788. }
  16789. rules.required(rule, value, source, errors, options, ruleType);
  16790. if (!isEmptyValue(value, ruleType)) {
  16791. rules.type(rule, value, source, errors, options);
  16792. }
  16793. }
  16794. callback(errors);
  16795. };
  16796. var any = function any2(rule, value, callback, source, options) {
  16797. var errors = [];
  16798. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16799. if (validate) {
  16800. if (isEmptyValue(value) && !rule.required) {
  16801. return callback();
  16802. }
  16803. rules.required(rule, value, source, errors, options);
  16804. }
  16805. callback(errors);
  16806. };
  16807. var validators = {
  16808. string,
  16809. method: method2,
  16810. number: number2,
  16811. "boolean": _boolean,
  16812. regexp: regexp2,
  16813. integer: integer2,
  16814. "float": floatFn,
  16815. array: array2,
  16816. object: object2,
  16817. "enum": enumerable2,
  16818. pattern: pattern2,
  16819. date: date2,
  16820. url: type2,
  16821. hex: type2,
  16822. email: type2,
  16823. required: required2,
  16824. any
  16825. };
  16826. function newMessages() {
  16827. return {
  16828. "default": "Validation error on field %s",
  16829. required: "%s is required",
  16830. "enum": "%s must be one of %s",
  16831. whitespace: "%s cannot be empty",
  16832. date: {
  16833. format: "%s date %s is invalid for format %s",
  16834. parse: "%s date could not be parsed, %s is invalid ",
  16835. invalid: "%s date %s is invalid"
  16836. },
  16837. types: {
  16838. string: "%s is not a %s",
  16839. method: "%s is not a %s (function)",
  16840. array: "%s is not an %s",
  16841. object: "%s is not an %s",
  16842. number: "%s is not a %s",
  16843. date: "%s is not a %s",
  16844. "boolean": "%s is not a %s",
  16845. integer: "%s is not an %s",
  16846. "float": "%s is not a %s",
  16847. regexp: "%s is not a valid %s",
  16848. email: "%s is not a valid %s",
  16849. url: "%s is not a valid %s",
  16850. hex: "%s is not a valid %s"
  16851. },
  16852. string: {
  16853. len: "%s must be exactly %s characters",
  16854. min: "%s must be at least %s characters",
  16855. max: "%s cannot be longer than %s characters",
  16856. range: "%s must be between %s and %s characters"
  16857. },
  16858. number: {
  16859. len: "%s must equal %s",
  16860. min: "%s cannot be less than %s",
  16861. max: "%s cannot be greater than %s",
  16862. range: "%s must be between %s and %s"
  16863. },
  16864. array: {
  16865. len: "%s must be exactly %s in length",
  16866. min: "%s cannot be less than %s in length",
  16867. max: "%s cannot be greater than %s in length",
  16868. range: "%s must be between %s and %s in length"
  16869. },
  16870. pattern: {
  16871. mismatch: "%s value %s does not match pattern %s"
  16872. },
  16873. clone: function clone2() {
  16874. var cloned = JSON.parse(JSON.stringify(this));
  16875. cloned.clone = this.clone;
  16876. return cloned;
  16877. }
  16878. };
  16879. }
  16880. var messages = newMessages();
  16881. var Schema = /* @__PURE__ */ function() {
  16882. function Schema2(descriptor) {
  16883. this.rules = null;
  16884. this._messages = messages;
  16885. this.define(descriptor);
  16886. }
  16887. var _proto = Schema2.prototype;
  16888. _proto.define = function define(rules2) {
  16889. var _this = this;
  16890. if (!rules2) {
  16891. throw new Error("Cannot configure a schema with no rules");
  16892. }
  16893. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  16894. throw new Error("Rules must be an object");
  16895. }
  16896. this.rules = {};
  16897. Object.keys(rules2).forEach(function(name) {
  16898. var item = rules2[name];
  16899. _this.rules[name] = Array.isArray(item) ? item : [item];
  16900. });
  16901. };
  16902. _proto.messages = function messages2(_messages) {
  16903. if (_messages) {
  16904. this._messages = deepMerge(newMessages(), _messages);
  16905. }
  16906. return this._messages;
  16907. };
  16908. _proto.validate = function validate(source_, o2, oc) {
  16909. var _this2 = this;
  16910. if (o2 === void 0) {
  16911. o2 = {};
  16912. }
  16913. if (oc === void 0) {
  16914. oc = function oc2() {
  16915. };
  16916. }
  16917. var source = source_;
  16918. var options = o2;
  16919. var callback = oc;
  16920. if (typeof options === "function") {
  16921. callback = options;
  16922. options = {};
  16923. }
  16924. if (!this.rules || Object.keys(this.rules).length === 0) {
  16925. if (callback) {
  16926. callback(null, source);
  16927. }
  16928. return Promise.resolve(source);
  16929. }
  16930. function complete(results) {
  16931. var errors = [];
  16932. var fields = {};
  16933. function add(e) {
  16934. if (Array.isArray(e)) {
  16935. var _errors;
  16936. errors = (_errors = errors).concat.apply(_errors, e);
  16937. } else {
  16938. errors.push(e);
  16939. }
  16940. }
  16941. for (var i = 0; i < results.length; i++) {
  16942. add(results[i]);
  16943. }
  16944. if (!errors.length) {
  16945. callback(null, source);
  16946. } else {
  16947. fields = convertFieldsError(errors);
  16948. callback(errors, fields);
  16949. }
  16950. }
  16951. if (options.messages) {
  16952. var messages$1 = this.messages();
  16953. if (messages$1 === messages) {
  16954. messages$1 = newMessages();
  16955. }
  16956. deepMerge(messages$1, options.messages);
  16957. options.messages = messages$1;
  16958. } else {
  16959. options.messages = this.messages();
  16960. }
  16961. var series = {};
  16962. var keys2 = options.keys || Object.keys(this.rules);
  16963. keys2.forEach(function(z) {
  16964. var arr = _this2.rules[z];
  16965. var value = source[z];
  16966. arr.forEach(function(r) {
  16967. var rule = r;
  16968. if (typeof rule.transform === "function") {
  16969. if (source === source_) {
  16970. source = _extends$1({}, source);
  16971. }
  16972. value = source[z] = rule.transform(value);
  16973. }
  16974. if (typeof rule === "function") {
  16975. rule = {
  16976. validator: rule
  16977. };
  16978. } else {
  16979. rule = _extends$1({}, rule);
  16980. }
  16981. rule.validator = _this2.getValidationMethod(rule);
  16982. if (!rule.validator) {
  16983. return;
  16984. }
  16985. rule.field = z;
  16986. rule.fullField = rule.fullField || z;
  16987. rule.type = _this2.getType(rule);
  16988. series[z] = series[z] || [];
  16989. series[z].push({
  16990. rule,
  16991. value,
  16992. source,
  16993. field: z
  16994. });
  16995. });
  16996. });
  16997. var errorFields = {};
  16998. return asyncMap(series, options, function(data2, doIt) {
  16999. var rule = data2.rule;
  17000. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  17001. deep = deep && (rule.required || !rule.required && data2.value);
  17002. rule.field = data2.field;
  17003. function addFullField(key, schema) {
  17004. return _extends$1({}, schema, {
  17005. fullField: rule.fullField + "." + key,
  17006. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  17007. });
  17008. }
  17009. function cb(e) {
  17010. if (e === void 0) {
  17011. e = [];
  17012. }
  17013. var errorList = Array.isArray(e) ? e : [e];
  17014. if (!options.suppressWarning && errorList.length) {
  17015. Schema2.warning("async-validator:", errorList);
  17016. }
  17017. if (errorList.length && rule.message !== void 0) {
  17018. errorList = [].concat(rule.message);
  17019. }
  17020. var filledErrors = errorList.map(complementError(rule, source));
  17021. if (options.first && filledErrors.length) {
  17022. errorFields[rule.field] = 1;
  17023. return doIt(filledErrors);
  17024. }
  17025. if (!deep) {
  17026. doIt(filledErrors);
  17027. } else {
  17028. if (rule.required && !data2.value) {
  17029. if (rule.message !== void 0) {
  17030. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  17031. } else if (options.error) {
  17032. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  17033. }
  17034. return doIt(filledErrors);
  17035. }
  17036. var fieldsSchema = {};
  17037. if (rule.defaultField) {
  17038. Object.keys(data2.value).map(function(key) {
  17039. fieldsSchema[key] = rule.defaultField;
  17040. });
  17041. }
  17042. fieldsSchema = _extends$1({}, fieldsSchema, data2.rule.fields);
  17043. var paredFieldsSchema = {};
  17044. Object.keys(fieldsSchema).forEach(function(field) {
  17045. var fieldSchema = fieldsSchema[field];
  17046. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  17047. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  17048. });
  17049. var schema = new Schema2(paredFieldsSchema);
  17050. schema.messages(options.messages);
  17051. if (data2.rule.options) {
  17052. data2.rule.options.messages = options.messages;
  17053. data2.rule.options.error = options.error;
  17054. }
  17055. schema.validate(data2.value, data2.rule.options || options, function(errs) {
  17056. var finalErrors = [];
  17057. if (filledErrors && filledErrors.length) {
  17058. finalErrors.push.apply(finalErrors, filledErrors);
  17059. }
  17060. if (errs && errs.length) {
  17061. finalErrors.push.apply(finalErrors, errs);
  17062. }
  17063. doIt(finalErrors.length ? finalErrors : null);
  17064. });
  17065. }
  17066. }
  17067. var res;
  17068. if (rule.asyncValidator) {
  17069. res = rule.asyncValidator(rule, data2.value, cb, data2.source, options);
  17070. } else if (rule.validator) {
  17071. res = rule.validator(rule, data2.value, cb, data2.source, options);
  17072. if (res === true) {
  17073. cb();
  17074. } else if (res === false) {
  17075. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  17076. } else if (res instanceof Array) {
  17077. cb(res);
  17078. } else if (res instanceof Error) {
  17079. cb(res.message);
  17080. }
  17081. }
  17082. if (res && res.then) {
  17083. res.then(function() {
  17084. return cb();
  17085. }, function(e) {
  17086. return cb(e);
  17087. });
  17088. }
  17089. }, function(results) {
  17090. complete(results);
  17091. }, source);
  17092. };
  17093. _proto.getType = function getType(rule) {
  17094. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  17095. rule.type = "pattern";
  17096. }
  17097. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  17098. throw new Error(format("Unknown rule type %s", rule.type));
  17099. }
  17100. return rule.type || "string";
  17101. };
  17102. _proto.getValidationMethod = function getValidationMethod(rule) {
  17103. if (typeof rule.validator === "function") {
  17104. return rule.validator;
  17105. }
  17106. var keys2 = Object.keys(rule);
  17107. var messageIndex = keys2.indexOf("message");
  17108. if (messageIndex !== -1) {
  17109. keys2.splice(messageIndex, 1);
  17110. }
  17111. if (keys2.length === 1 && keys2[0] === "required") {
  17112. return validators.required;
  17113. }
  17114. return validators[this.getType(rule)] || void 0;
  17115. };
  17116. return Schema2;
  17117. }();
  17118. Schema.register = function register(type4, validator) {
  17119. if (typeof validator !== "function") {
  17120. throw new Error("Cannot register a validator by type, validator is not a function");
  17121. }
  17122. validators[type4] = validator;
  17123. };
  17124. Schema.warning = warning;
  17125. Schema.messages = messages;
  17126. Schema.validators = validators;
  17127. const formItemValidateStates = [
  17128. "",
  17129. "error",
  17130. "validating",
  17131. "success"
  17132. ];
  17133. const formItemProps = buildProps({
  17134. label: String,
  17135. labelWidth: {
  17136. type: [String, Number],
  17137. default: ""
  17138. },
  17139. prop: {
  17140. type: definePropType([String, Array])
  17141. },
  17142. required: {
  17143. type: Boolean,
  17144. default: void 0
  17145. },
  17146. rules: {
  17147. type: definePropType([Object, Array])
  17148. },
  17149. error: String,
  17150. validateStatus: {
  17151. type: String,
  17152. values: formItemValidateStates
  17153. },
  17154. for: String,
  17155. inlineMessage: {
  17156. type: [String, Boolean],
  17157. default: ""
  17158. },
  17159. showMessage: {
  17160. type: Boolean,
  17161. default: true
  17162. },
  17163. size: {
  17164. type: String,
  17165. values: componentSizes
  17166. }
  17167. });
  17168. const COMPONENT_NAME$2 = "ElLabelWrap";
  17169. var FormLabelWrap = defineComponent({
  17170. name: COMPONENT_NAME$2,
  17171. props: {
  17172. isAutoWidth: Boolean,
  17173. updateAll: Boolean
  17174. },
  17175. setup(props, {
  17176. slots
  17177. }) {
  17178. const formContext = inject(formContextKey, void 0);
  17179. const formItemContext = inject(formItemContextKey);
  17180. if (!formItemContext)
  17181. throwError(COMPONENT_NAME$2, "usage: <el-form-item><label-wrap /></el-form-item>");
  17182. const ns = useNamespace("form");
  17183. const el = ref();
  17184. const computedWidth = ref(0);
  17185. const getLabelWidth = () => {
  17186. var _a2;
  17187. if ((_a2 = el.value) == null ? void 0 : _a2.firstElementChild) {
  17188. const width = window.getComputedStyle(el.value.firstElementChild).width;
  17189. return Math.ceil(Number.parseFloat(width));
  17190. } else {
  17191. return 0;
  17192. }
  17193. };
  17194. const updateLabelWidth = (action = "update") => {
  17195. nextTick(() => {
  17196. if (slots.default && props.isAutoWidth) {
  17197. if (action === "update") {
  17198. computedWidth.value = getLabelWidth();
  17199. } else if (action === "remove") {
  17200. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  17201. }
  17202. }
  17203. });
  17204. };
  17205. const updateLabelWidthFn = () => updateLabelWidth("update");
  17206. onMounted(() => {
  17207. updateLabelWidthFn();
  17208. });
  17209. onBeforeUnmount(() => {
  17210. updateLabelWidth("remove");
  17211. });
  17212. onUpdated(() => updateLabelWidthFn());
  17213. watch(computedWidth, (val, oldVal) => {
  17214. if (props.updateAll) {
  17215. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  17216. }
  17217. });
  17218. useResizeObserver(computed(() => {
  17219. var _a2, _b2;
  17220. return (_b2 = (_a2 = el.value) == null ? void 0 : _a2.firstElementChild) != null ? _b2 : null;
  17221. }), updateLabelWidthFn);
  17222. return () => {
  17223. var _a2, _b2;
  17224. if (!slots)
  17225. return null;
  17226. const {
  17227. isAutoWidth
  17228. } = props;
  17229. if (isAutoWidth) {
  17230. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  17231. const style = {};
  17232. if (autoLabelWidth && autoLabelWidth !== "auto") {
  17233. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  17234. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  17235. if (marginWidth) {
  17236. style[marginPosition] = `${marginWidth}px`;
  17237. }
  17238. }
  17239. return createVNode("div", {
  17240. "ref": el,
  17241. "class": [ns.be("item", "label-wrap")],
  17242. "style": style
  17243. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
  17244. } else {
  17245. return createVNode(Fragment, {
  17246. "ref": el
  17247. }, [(_b2 = slots.default) == null ? void 0 : _b2.call(slots)]);
  17248. }
  17249. };
  17250. }
  17251. });
  17252. const _hoisted_1$j = ["for"];
  17253. const __default__$8 = {
  17254. name: "ElFormItem"
  17255. };
  17256. const _sfc_main$t = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
  17257. props: formItemProps,
  17258. setup(__props, { expose }) {
  17259. const props = __props;
  17260. const slots = useSlots();
  17261. const formContext = inject(formContextKey, void 0);
  17262. const parentFormItemContext = inject(formItemContextKey, void 0);
  17263. const _size = useSize(void 0, { formItem: false });
  17264. const ns = useNamespace("form-item");
  17265. const validateState = ref("");
  17266. const validateStateDebounced = refDebounced(validateState, 100);
  17267. const validateMessage = ref("");
  17268. const formItemRef = ref();
  17269. let initialValue = void 0;
  17270. let isResettingField = false;
  17271. const labelStyle = computed(() => {
  17272. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  17273. return {};
  17274. }
  17275. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17276. if (labelWidth)
  17277. return { width: labelWidth };
  17278. return {};
  17279. });
  17280. const contentStyle = computed(() => {
  17281. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  17282. return {};
  17283. }
  17284. if (!props.label && !props.labelWidth && isNested) {
  17285. return {};
  17286. }
  17287. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17288. if (!props.label && !slots.label) {
  17289. return { marginLeft: labelWidth };
  17290. }
  17291. return {};
  17292. });
  17293. const formItemClasses = computed(() => [
  17294. ns.b(),
  17295. ns.m(_size.value),
  17296. ns.is("error", validateState.value === "error"),
  17297. ns.is("validating", validateState.value === "validating"),
  17298. ns.is("success", validateState.value === "success"),
  17299. ns.is("required", isRequired.value || props.required),
  17300. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  17301. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  17302. ]);
  17303. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  17304. const validateClasses = computed(() => [
  17305. ns.e("error"),
  17306. { [ns.em("error", "inline")]: _inlineMessage.value }
  17307. ]);
  17308. const propString = computed(() => {
  17309. if (!props.prop)
  17310. return "";
  17311. return isString(props.prop) ? props.prop : props.prop.join(".");
  17312. });
  17313. const labelFor = computed(() => props.for || propString.value);
  17314. const isNested = !!parentFormItemContext;
  17315. const fieldValue = computed(() => {
  17316. const model = formContext == null ? void 0 : formContext.model;
  17317. if (!model || !props.prop) {
  17318. return;
  17319. }
  17320. return getProp(model, props.prop).value;
  17321. });
  17322. const _rules = computed(() => {
  17323. const rules2 = props.rules ? castArray$1(props.rules) : [];
  17324. const formRules = formContext == null ? void 0 : formContext.rules;
  17325. if (formRules && props.prop) {
  17326. const _rules2 = getProp(formRules, props.prop).value;
  17327. if (_rules2) {
  17328. rules2.push(...castArray$1(_rules2));
  17329. }
  17330. }
  17331. if (props.required !== void 0) {
  17332. rules2.push({ required: !!props.required });
  17333. }
  17334. return rules2;
  17335. });
  17336. const validateEnabled = computed(() => _rules.value.length > 0);
  17337. const getFilteredRule = (trigger) => {
  17338. const rules2 = _rules.value;
  17339. return rules2.filter((rule) => {
  17340. if (!rule.trigger || !trigger)
  17341. return true;
  17342. if (Array.isArray(rule.trigger)) {
  17343. return rule.trigger.includes(trigger);
  17344. } else {
  17345. return rule.trigger === trigger;
  17346. }
  17347. }).map((_a2) => {
  17348. var _b2 = _a2, { trigger: trigger2 } = _b2, rule = __objRest(_b2, ["trigger"]);
  17349. return rule;
  17350. });
  17351. };
  17352. const isRequired = computed(() => _rules.value.some((rule) => rule.required === true));
  17353. const shouldShowError = computed(() => {
  17354. var _a2;
  17355. return validateStateDebounced.value === "error" && props.showMessage && ((_a2 = formContext == null ? void 0 : formContext.showMessage) != null ? _a2 : true);
  17356. });
  17357. const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  17358. const setValidationState = (state) => {
  17359. validateState.value = state;
  17360. };
  17361. const onValidationFailed = (error) => {
  17362. var _a2, _b2;
  17363. const { errors, fields } = error;
  17364. if (!errors || !fields) {
  17365. console.error(error);
  17366. }
  17367. setValidationState("error");
  17368. validateMessage.value = errors ? (_b2 = (_a2 = errors == null ? void 0 : errors[0]) == null ? void 0 : _a2.message) != null ? _b2 : `${props.prop} is required` : "";
  17369. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  17370. };
  17371. const onValidationSucceeded = () => {
  17372. setValidationState("success");
  17373. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  17374. };
  17375. const doValidate = async (rules2) => {
  17376. const modelName = propString.value;
  17377. const validator = new Schema({
  17378. [modelName]: rules2
  17379. });
  17380. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  17381. onValidationSucceeded();
  17382. return true;
  17383. }).catch((err) => {
  17384. onValidationFailed(err);
  17385. return Promise.reject(err);
  17386. });
  17387. };
  17388. const validate = async (trigger, callback) => {
  17389. if (isResettingField) {
  17390. isResettingField = false;
  17391. return false;
  17392. }
  17393. const hasCallback = isFunction(callback);
  17394. if (!validateEnabled.value) {
  17395. callback == null ? void 0 : callback(false);
  17396. return false;
  17397. }
  17398. const rules2 = getFilteredRule(trigger);
  17399. if (rules2.length === 0) {
  17400. callback == null ? void 0 : callback(true);
  17401. return true;
  17402. }
  17403. setValidationState("validating");
  17404. return doValidate(rules2).then(() => {
  17405. callback == null ? void 0 : callback(true);
  17406. return true;
  17407. }).catch((err) => {
  17408. const { fields } = err;
  17409. callback == null ? void 0 : callback(false, fields);
  17410. return hasCallback ? false : Promise.reject(fields);
  17411. });
  17412. };
  17413. const clearValidate = () => {
  17414. setValidationState("");
  17415. validateMessage.value = "";
  17416. };
  17417. const resetField = async () => {
  17418. const model = formContext == null ? void 0 : formContext.model;
  17419. if (!model || !props.prop)
  17420. return;
  17421. const computedValue = getProp(model, props.prop);
  17422. if (!isEqual(computedValue.value, initialValue)) {
  17423. isResettingField = true;
  17424. }
  17425. computedValue.value = initialValue;
  17426. await nextTick();
  17427. clearValidate();
  17428. };
  17429. watch(() => props.error, (val) => {
  17430. validateMessage.value = val || "";
  17431. setValidationState(val ? "error" : "");
  17432. }, { immediate: true });
  17433. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  17434. const context = reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  17435. $el: formItemRef,
  17436. size: _size,
  17437. validateState,
  17438. resetField,
  17439. clearValidate,
  17440. validate
  17441. }));
  17442. provide(formItemContextKey, context);
  17443. onMounted(() => {
  17444. if (props.prop) {
  17445. formContext == null ? void 0 : formContext.addField(context);
  17446. initialValue = clone(fieldValue.value);
  17447. }
  17448. });
  17449. onBeforeUnmount(() => {
  17450. formContext == null ? void 0 : formContext.removeField(context);
  17451. });
  17452. expose({
  17453. size: _size,
  17454. validateMessage,
  17455. validateState,
  17456. validate,
  17457. clearValidate,
  17458. resetField
  17459. });
  17460. return (_ctx, _cache) => {
  17461. var _a2;
  17462. return openBlock(), createElementBlock("div", {
  17463. ref_key: "formItemRef",
  17464. ref: formItemRef,
  17465. class: normalizeClass(unref(formItemClasses))
  17466. }, [
  17467. createVNode(unref(FormLabelWrap), {
  17468. "is-auto-width": unref(labelStyle).width === "auto",
  17469. "update-all": ((_a2 = unref(formContext)) == null ? void 0 : _a2.labelWidth) === "auto"
  17470. }, {
  17471. default: withCtx(() => [
  17472. _ctx.label || _ctx.$slots.label ? (openBlock(), createElementBlock("label", {
  17473. key: 0,
  17474. for: unref(labelFor),
  17475. class: normalizeClass(unref(ns).e("label")),
  17476. style: normalizeStyle(unref(labelStyle))
  17477. }, [
  17478. renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
  17479. createTextVNode(toDisplayString(unref(currentLabel)), 1)
  17480. ])
  17481. ], 14, _hoisted_1$j)) : createCommentVNode("v-if", true)
  17482. ]),
  17483. _: 3
  17484. }, 8, ["is-auto-width", "update-all"]),
  17485. createElementVNode("div", {
  17486. class: normalizeClass(unref(ns).e("content")),
  17487. style: normalizeStyle(unref(contentStyle))
  17488. }, [
  17489. renderSlot(_ctx.$slots, "default"),
  17490. createVNode(Transition, {
  17491. name: `${unref(ns).namespace.value}-zoom-in-top`
  17492. }, {
  17493. default: withCtx(() => [
  17494. unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
  17495. key: 0,
  17496. error: validateMessage.value
  17497. }, () => [
  17498. createElementVNode("div", {
  17499. class: normalizeClass(unref(validateClasses))
  17500. }, toDisplayString(validateMessage.value), 3)
  17501. ]) : createCommentVNode("v-if", true)
  17502. ]),
  17503. _: 3
  17504. }, 8, ["name"])
  17505. ], 6)
  17506. ], 2);
  17507. };
  17508. }
  17509. }));
  17510. var FormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form-item.vue"]]);
  17511. const ElForm = withInstall(Form, {
  17512. FormItem
  17513. });
  17514. const ElFormItem = withNoopInstall(FormItem);
  17515. const imageViewerProps = buildProps({
  17516. urlList: {
  17517. type: definePropType(Array),
  17518. default: () => mutable([])
  17519. },
  17520. zIndex: {
  17521. type: Number
  17522. },
  17523. initialIndex: {
  17524. type: Number,
  17525. default: 0
  17526. },
  17527. infinite: {
  17528. type: Boolean,
  17529. default: true
  17530. },
  17531. hideOnClickModal: {
  17532. type: Boolean,
  17533. default: false
  17534. },
  17535. teleported: {
  17536. type: Boolean,
  17537. default: false
  17538. }
  17539. });
  17540. const imageViewerEmits = {
  17541. close: () => true,
  17542. switch: (index) => typeof index === "number"
  17543. };
  17544. const _hoisted_1$i = ["src"];
  17545. const __default__$7 = {
  17546. name: "ElImageViewer"
  17547. };
  17548. const _sfc_main$s = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
  17549. props: imageViewerProps,
  17550. emits: imageViewerEmits,
  17551. setup(__props, { emit }) {
  17552. const props = __props;
  17553. const Mode = {
  17554. CONTAIN: {
  17555. name: "contain",
  17556. icon: markRaw(fullScreen)
  17557. },
  17558. ORIGINAL: {
  17559. name: "original",
  17560. icon: markRaw(scaleToOriginal)
  17561. }
  17562. };
  17563. const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
  17564. const { t } = useLocale();
  17565. const ns = useNamespace("image-viewer");
  17566. const { nextZIndex } = useZIndex();
  17567. const wrapper = ref();
  17568. const imgRefs = ref([]);
  17569. const scopeEventListener = effectScope();
  17570. const loading2 = ref(true);
  17571. const index = ref(props.initialIndex);
  17572. const mode = ref(Mode.CONTAIN);
  17573. const transform = ref({
  17574. scale: 1,
  17575. deg: 0,
  17576. offsetX: 0,
  17577. offsetY: 0,
  17578. enableTransition: false
  17579. });
  17580. const isSingle = computed(() => {
  17581. const { urlList } = props;
  17582. return urlList.length <= 1;
  17583. });
  17584. const isFirst = computed(() => {
  17585. return index.value === 0;
  17586. });
  17587. const isLast = computed(() => {
  17588. return index.value === props.urlList.length - 1;
  17589. });
  17590. const currentImg = computed(() => {
  17591. return props.urlList[index.value];
  17592. });
  17593. const imgStyle = computed(() => {
  17594. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  17595. let translateX = offsetX / scale;
  17596. let translateY = offsetY / scale;
  17597. switch (deg % 360) {
  17598. case 90:
  17599. case -270:
  17600. [translateX, translateY] = [translateY, -translateX];
  17601. break;
  17602. case 180:
  17603. case -180:
  17604. [translateX, translateY] = [-translateX, -translateY];
  17605. break;
  17606. case 270:
  17607. case -90:
  17608. [translateX, translateY] = [-translateY, translateX];
  17609. break;
  17610. }
  17611. const style = {
  17612. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  17613. transition: enableTransition ? "transform .3s" : ""
  17614. };
  17615. if (mode.value.name === Mode.CONTAIN.name) {
  17616. style.maxWidth = style.maxHeight = "100%";
  17617. }
  17618. return style;
  17619. });
  17620. const computedZIndex = computed(() => {
  17621. return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  17622. });
  17623. function hide2() {
  17624. unregisterEventListener();
  17625. emit("close");
  17626. }
  17627. function registerEventListener() {
  17628. const keydownHandler = throttle((e) => {
  17629. switch (e.code) {
  17630. case EVENT_CODE.esc:
  17631. hide2();
  17632. break;
  17633. case EVENT_CODE.space:
  17634. toggleMode();
  17635. break;
  17636. case EVENT_CODE.left:
  17637. prev();
  17638. break;
  17639. case EVENT_CODE.up:
  17640. handleActions("zoomIn");
  17641. break;
  17642. case EVENT_CODE.right:
  17643. next();
  17644. break;
  17645. case EVENT_CODE.down:
  17646. handleActions("zoomOut");
  17647. break;
  17648. }
  17649. });
  17650. const mousewheelHandler = throttle((e) => {
  17651. const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
  17652. if (delta > 0) {
  17653. handleActions("zoomIn", {
  17654. zoomRate: 1.2,
  17655. enableTransition: false
  17656. });
  17657. } else {
  17658. handleActions("zoomOut", {
  17659. zoomRate: 1.2,
  17660. enableTransition: false
  17661. });
  17662. }
  17663. });
  17664. scopeEventListener.run(() => {
  17665. useEventListener(document, "keydown", keydownHandler);
  17666. useEventListener(document, mousewheelEventName, mousewheelHandler);
  17667. });
  17668. }
  17669. function unregisterEventListener() {
  17670. scopeEventListener.stop();
  17671. }
  17672. function handleImgLoad() {
  17673. loading2.value = false;
  17674. }
  17675. function handleImgError(e) {
  17676. loading2.value = false;
  17677. e.target.alt = t("el.image.error");
  17678. }
  17679. function handleMouseDown(e) {
  17680. if (loading2.value || e.button !== 0 || !wrapper.value)
  17681. return;
  17682. transform.value.enableTransition = false;
  17683. const { offsetX, offsetY } = transform.value;
  17684. const startX = e.pageX;
  17685. const startY = e.pageY;
  17686. const dragHandler = throttle((ev) => {
  17687. transform.value = __spreadProps(__spreadValues({}, transform.value), {
  17688. offsetX: offsetX + ev.pageX - startX,
  17689. offsetY: offsetY + ev.pageY - startY
  17690. });
  17691. });
  17692. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  17693. useEventListener(document, "mouseup", () => {
  17694. removeMousemove();
  17695. });
  17696. e.preventDefault();
  17697. }
  17698. function reset() {
  17699. transform.value = {
  17700. scale: 1,
  17701. deg: 0,
  17702. offsetX: 0,
  17703. offsetY: 0,
  17704. enableTransition: false
  17705. };
  17706. }
  17707. function toggleMode() {
  17708. if (loading2.value)
  17709. return;
  17710. const modeNames = Object.keys(Mode);
  17711. const modeValues = Object.values(Mode);
  17712. const currentMode = mode.value.name;
  17713. const index2 = modeValues.findIndex((i) => i.name === currentMode);
  17714. const nextIndex = (index2 + 1) % modeNames.length;
  17715. mode.value = Mode[modeNames[nextIndex]];
  17716. reset();
  17717. }
  17718. function prev() {
  17719. if (isFirst.value && !props.infinite)
  17720. return;
  17721. const len = props.urlList.length;
  17722. index.value = (index.value - 1 + len) % len;
  17723. }
  17724. function next() {
  17725. if (isLast.value && !props.infinite)
  17726. return;
  17727. const len = props.urlList.length;
  17728. index.value = (index.value + 1) % len;
  17729. }
  17730. function handleActions(action, options = {}) {
  17731. if (loading2.value)
  17732. return;
  17733. const { zoomRate, rotateDeg, enableTransition } = __spreadValues({
  17734. zoomRate: 1.4,
  17735. rotateDeg: 90,
  17736. enableTransition: true
  17737. }, options);
  17738. switch (action) {
  17739. case "zoomOut":
  17740. if (transform.value.scale > 0.2) {
  17741. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  17742. }
  17743. break;
  17744. case "zoomIn":
  17745. if (transform.value.scale < 7) {
  17746. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  17747. }
  17748. break;
  17749. case "clockwise":
  17750. transform.value.deg += rotateDeg;
  17751. break;
  17752. case "anticlockwise":
  17753. transform.value.deg -= rotateDeg;
  17754. break;
  17755. }
  17756. transform.value.enableTransition = enableTransition;
  17757. }
  17758. watch(currentImg, () => {
  17759. nextTick(() => {
  17760. const $img = imgRefs.value[0];
  17761. if (!($img == null ? void 0 : $img.complete)) {
  17762. loading2.value = true;
  17763. }
  17764. });
  17765. });
  17766. watch(index, (val) => {
  17767. reset();
  17768. emit("switch", val);
  17769. });
  17770. onMounted(() => {
  17771. var _a2, _b2;
  17772. registerEventListener();
  17773. (_b2 = (_a2 = wrapper.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  17774. });
  17775. return (_ctx, _cache) => {
  17776. return openBlock(), createBlock(Teleport, {
  17777. to: "body",
  17778. disabled: !_ctx.teleported
  17779. }, [
  17780. createVNode(Transition, {
  17781. name: "viewer-fade",
  17782. appear: ""
  17783. }, {
  17784. default: withCtx(() => [
  17785. createElementVNode("div", {
  17786. ref_key: "wrapper",
  17787. ref: wrapper,
  17788. tabindex: -1,
  17789. class: normalizeClass(unref(ns).e("wrapper")),
  17790. style: normalizeStyle({ zIndex: unref(computedZIndex) })
  17791. }, [
  17792. createElementVNode("div", {
  17793. class: normalizeClass(unref(ns).e("mask")),
  17794. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.hideOnClickModal && hide2(), ["self"]))
  17795. }, null, 2),
  17796. createCommentVNode(" CLOSE "),
  17797. createElementVNode("span", {
  17798. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  17799. onClick: hide2
  17800. }, [
  17801. createVNode(unref(ElIcon), null, {
  17802. default: withCtx(() => [
  17803. createVNode(unref(close))
  17804. ]),
  17805. _: 1
  17806. })
  17807. ], 2),
  17808. createCommentVNode(" ARROW "),
  17809. !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  17810. createElementVNode("span", {
  17811. class: normalizeClass([
  17812. unref(ns).e("btn"),
  17813. unref(ns).e("prev"),
  17814. unref(ns).is("disabled", !_ctx.infinite && unref(isFirst))
  17815. ]),
  17816. onClick: prev
  17817. }, [
  17818. createVNode(unref(ElIcon), null, {
  17819. default: withCtx(() => [
  17820. createVNode(unref(arrowLeft))
  17821. ]),
  17822. _: 1
  17823. })
  17824. ], 2),
  17825. createElementVNode("span", {
  17826. class: normalizeClass([
  17827. unref(ns).e("btn"),
  17828. unref(ns).e("next"),
  17829. unref(ns).is("disabled", !_ctx.infinite && unref(isLast))
  17830. ]),
  17831. onClick: next
  17832. }, [
  17833. createVNode(unref(ElIcon), null, {
  17834. default: withCtx(() => [
  17835. createVNode(unref(arrowRight))
  17836. ]),
  17837. _: 1
  17838. })
  17839. ], 2)
  17840. ], 64)) : createCommentVNode("v-if", true),
  17841. createCommentVNode(" ACTIONS "),
  17842. createElementVNode("div", {
  17843. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
  17844. }, [
  17845. createElementVNode("div", {
  17846. class: normalizeClass(unref(ns).e("actions__inner"))
  17847. }, [
  17848. createVNode(unref(ElIcon), {
  17849. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  17850. }, {
  17851. default: withCtx(() => [
  17852. createVNode(unref(zoomOut))
  17853. ]),
  17854. _: 1
  17855. }),
  17856. createVNode(unref(ElIcon), {
  17857. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  17858. }, {
  17859. default: withCtx(() => [
  17860. createVNode(unref(zoomIn))
  17861. ]),
  17862. _: 1
  17863. }),
  17864. createElementVNode("i", {
  17865. class: normalizeClass(unref(ns).e("actions__divider"))
  17866. }, null, 2),
  17867. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  17868. default: withCtx(() => [
  17869. (openBlock(), createBlock(resolveDynamicComponent(mode.value.icon)))
  17870. ]),
  17871. _: 1
  17872. }),
  17873. createElementVNode("i", {
  17874. class: normalizeClass(unref(ns).e("actions__divider"))
  17875. }, null, 2),
  17876. createVNode(unref(ElIcon), {
  17877. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  17878. }, {
  17879. default: withCtx(() => [
  17880. createVNode(unref(refreshLeft))
  17881. ]),
  17882. _: 1
  17883. }),
  17884. createVNode(unref(ElIcon), {
  17885. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  17886. }, {
  17887. default: withCtx(() => [
  17888. createVNode(unref(refreshRight))
  17889. ]),
  17890. _: 1
  17891. })
  17892. ], 2)
  17893. ], 2),
  17894. createCommentVNode(" CANVAS "),
  17895. createElementVNode("div", {
  17896. class: normalizeClass(unref(ns).e("canvas"))
  17897. }, [
  17898. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url2, i) => {
  17899. return withDirectives((openBlock(), createElementBlock("img", {
  17900. ref_for: true,
  17901. ref: (el) => imgRefs.value[i] = el,
  17902. key: url2,
  17903. src: url2,
  17904. style: normalizeStyle(unref(imgStyle)),
  17905. class: normalizeClass(unref(ns).e("img")),
  17906. onLoad: handleImgLoad,
  17907. onError: handleImgError,
  17908. onMousedown: handleMouseDown
  17909. }, null, 46, _hoisted_1$i)), [
  17910. [vShow, i === index.value]
  17911. ]);
  17912. }), 128))
  17913. ], 2),
  17914. renderSlot(_ctx.$slots, "default")
  17915. ], 6)
  17916. ]),
  17917. _: 3
  17918. })
  17919. ], 8, ["disabled"]);
  17920. };
  17921. }
  17922. }));
  17923. var ImageViewer = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image-viewer/src/image-viewer.vue"]]);
  17924. const ElImageViewer = withInstall(ImageViewer);
  17925. const imageProps = buildProps({
  17926. appendToBody: {
  17927. type: Boolean,
  17928. default: void 0
  17929. },
  17930. hideOnClickModal: {
  17931. type: Boolean,
  17932. default: false
  17933. },
  17934. src: {
  17935. type: String,
  17936. default: ""
  17937. },
  17938. fit: {
  17939. type: String,
  17940. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  17941. default: ""
  17942. },
  17943. lazy: {
  17944. type: Boolean,
  17945. default: false
  17946. },
  17947. scrollContainer: {
  17948. type: definePropType([String, Object])
  17949. },
  17950. previewSrcList: {
  17951. type: definePropType(Array),
  17952. default: () => mutable([])
  17953. },
  17954. previewTeleported: {
  17955. type: Boolean,
  17956. default: false
  17957. },
  17958. zIndex: {
  17959. type: Number
  17960. },
  17961. initialIndex: {
  17962. type: Number,
  17963. default: 0
  17964. },
  17965. infinite: {
  17966. type: Boolean,
  17967. default: true
  17968. }
  17969. });
  17970. const imageEmits = {
  17971. error: (evt) => evt instanceof Event,
  17972. switch: (val) => isNumber(val),
  17973. close: () => true
  17974. };
  17975. const _hoisted_1$h = ["src"];
  17976. const _hoisted_2$f = { key: 0 };
  17977. const __default__$6 = {
  17978. name: "ElImage"
  17979. };
  17980. const _sfc_main$r = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
  17981. props: imageProps,
  17982. emits: imageEmits,
  17983. setup(__props, { emit }) {
  17984. const props = __props;
  17985. let prevOverflow = "";
  17986. useDeprecated({
  17987. scope: "el-image",
  17988. from: "append-to-body",
  17989. replacement: "preview-teleported",
  17990. version: "2.2.0",
  17991. ref: "https://element-plus.org/en-US/component/image.html#image-attributess"
  17992. }, computed(() => isBoolean(props.appendToBody)));
  17993. const { t } = useLocale();
  17994. const ns = useNamespace("image");
  17995. const attrs = useAttrs();
  17996. const hasLoadError = ref(false);
  17997. const loading2 = ref(true);
  17998. const imgWidth = ref(0);
  17999. const imgHeight = ref(0);
  18000. const showViewer = ref(false);
  18001. const container = ref();
  18002. const _scrollContainer = ref();
  18003. let stopScrollListener;
  18004. let stopWheelListener;
  18005. const containerStyle = computed(() => attrs.value.style);
  18006. const imageStyle = computed(() => {
  18007. const { fit } = props;
  18008. if (isClient$1 && fit) {
  18009. return { objectFit: fit };
  18010. }
  18011. return {};
  18012. });
  18013. const preview = computed(() => {
  18014. const { previewSrcList } = props;
  18015. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  18016. });
  18017. const teleported = computed(() => {
  18018. return props.appendToBody || props.previewTeleported;
  18019. });
  18020. const imageIndex = computed(() => {
  18021. const { previewSrcList, initialIndex } = props;
  18022. let previewIndex = initialIndex;
  18023. if (initialIndex > previewSrcList.length - 1) {
  18024. previewIndex = 0;
  18025. }
  18026. return previewIndex;
  18027. });
  18028. const loadImage = () => {
  18029. if (!isClient$1)
  18030. return;
  18031. loading2.value = true;
  18032. hasLoadError.value = false;
  18033. const img = new Image();
  18034. const currentImageSrc = props.src;
  18035. img.addEventListener("load", (e) => {
  18036. if (currentImageSrc !== props.src) {
  18037. return;
  18038. }
  18039. handleLoad(e, img);
  18040. });
  18041. img.addEventListener("error", (e) => {
  18042. if (currentImageSrc !== props.src) {
  18043. return;
  18044. }
  18045. handleError(e);
  18046. });
  18047. Object.entries(attrs.value).forEach(([key, value]) => {
  18048. if (key.toLowerCase() === "onload")
  18049. return;
  18050. img.setAttribute(key, value);
  18051. });
  18052. img.src = currentImageSrc;
  18053. };
  18054. function handleLoad(e, img) {
  18055. imgWidth.value = img.width;
  18056. imgHeight.value = img.height;
  18057. loading2.value = false;
  18058. hasLoadError.value = false;
  18059. }
  18060. function handleError(event) {
  18061. loading2.value = false;
  18062. hasLoadError.value = true;
  18063. emit("error", event);
  18064. }
  18065. function handleLazyLoad() {
  18066. if (isInContainer(container.value, _scrollContainer.value)) {
  18067. loadImage();
  18068. removeLazyLoadListener();
  18069. }
  18070. }
  18071. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200);
  18072. async function addLazyLoadListener() {
  18073. var _a2;
  18074. if (!isClient$1)
  18075. return;
  18076. await nextTick();
  18077. const { scrollContainer } = props;
  18078. if (isElement$1(scrollContainer)) {
  18079. _scrollContainer.value = scrollContainer;
  18080. } else if (isString(scrollContainer) && scrollContainer !== "") {
  18081. _scrollContainer.value = (_a2 = document.querySelector(scrollContainer)) != null ? _a2 : void 0;
  18082. } else if (container.value) {
  18083. _scrollContainer.value = getScrollContainer(container.value);
  18084. }
  18085. if (_scrollContainer.value) {
  18086. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  18087. setTimeout(() => handleLazyLoad(), 100);
  18088. }
  18089. }
  18090. function removeLazyLoadListener() {
  18091. if (!isClient$1 || !_scrollContainer.value || !lazyLoadHandler)
  18092. return;
  18093. stopScrollListener();
  18094. _scrollContainer.value = void 0;
  18095. }
  18096. function wheelHandler(e) {
  18097. if (!e.ctrlKey)
  18098. return;
  18099. if (e.deltaY < 0) {
  18100. e.preventDefault();
  18101. return false;
  18102. } else if (e.deltaY > 0) {
  18103. e.preventDefault();
  18104. return false;
  18105. }
  18106. }
  18107. function clickHandler() {
  18108. if (!preview.value)
  18109. return;
  18110. stopWheelListener = useEventListener("wheel", wheelHandler, {
  18111. passive: false
  18112. });
  18113. prevOverflow = document.body.style.overflow;
  18114. document.body.style.overflow = "hidden";
  18115. showViewer.value = true;
  18116. }
  18117. function closeViewer() {
  18118. stopWheelListener == null ? void 0 : stopWheelListener();
  18119. document.body.style.overflow = prevOverflow;
  18120. showViewer.value = false;
  18121. emit("close");
  18122. }
  18123. function switchViewer(val) {
  18124. emit("switch", val);
  18125. }
  18126. watch(() => props.src, () => {
  18127. if (props.lazy) {
  18128. loading2.value = true;
  18129. hasLoadError.value = false;
  18130. removeLazyLoadListener();
  18131. addLazyLoadListener();
  18132. } else {
  18133. loadImage();
  18134. }
  18135. });
  18136. onMounted(() => {
  18137. if (props.lazy) {
  18138. addLazyLoadListener();
  18139. } else {
  18140. loadImage();
  18141. }
  18142. });
  18143. return (_ctx, _cache) => {
  18144. return openBlock(), createElementBlock("div", {
  18145. ref_key: "container",
  18146. ref: container,
  18147. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  18148. style: normalizeStyle(unref(containerStyle))
  18149. }, [
  18150. loading2.value ? renderSlot(_ctx.$slots, "placeholder", { key: 0 }, () => [
  18151. createElementVNode("div", {
  18152. class: normalizeClass(unref(ns).e("placeholder"))
  18153. }, null, 2)
  18154. ]) : hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 1 }, () => [
  18155. createElementVNode("div", {
  18156. class: normalizeClass(unref(ns).e("error"))
  18157. }, toDisplayString(unref(t)("el.image.error")), 3)
  18158. ]) : (openBlock(), createElementBlock("img", mergeProps({ key: 2 }, unref(attrs), {
  18159. src: _ctx.src,
  18160. style: unref(imageStyle),
  18161. class: [unref(ns).e("inner"), unref(preview) ? unref(ns).e("preview") : ""],
  18162. onClick: clickHandler
  18163. }), null, 16, _hoisted_1$h)),
  18164. unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  18165. showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  18166. key: 0,
  18167. "z-index": _ctx.zIndex,
  18168. "initial-index": unref(imageIndex),
  18169. infinite: _ctx.infinite,
  18170. "url-list": _ctx.previewSrcList,
  18171. "hide-on-click-modal": _ctx.hideOnClickModal,
  18172. teleported: unref(teleported),
  18173. onClose: closeViewer,
  18174. onSwitch: switchViewer
  18175. }, {
  18176. default: withCtx(() => [
  18177. _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
  18178. renderSlot(_ctx.$slots, "viewer")
  18179. ])) : createCommentVNode("v-if", true)
  18180. ]),
  18181. _: 3
  18182. }, 8, ["z-index", "initial-index", "infinite", "url-list", "hide-on-click-modal", "teleported"])) : createCommentVNode("v-if", true)
  18183. ], 2112)) : createCommentVNode("v-if", true)
  18184. ], 6);
  18185. };
  18186. }
  18187. }));
  18188. var Image$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image/src/image.vue"]]);
  18189. const ElImage = withInstall(Image$1);
  18190. const inputNumberProps = buildProps({
  18191. step: {
  18192. type: Number,
  18193. default: 1
  18194. },
  18195. stepStrictly: {
  18196. type: Boolean,
  18197. default: false
  18198. },
  18199. max: {
  18200. type: Number,
  18201. default: Number.POSITIVE_INFINITY
  18202. },
  18203. min: {
  18204. type: Number,
  18205. default: Number.NEGATIVE_INFINITY
  18206. },
  18207. modelValue: {
  18208. type: Number
  18209. },
  18210. disabled: {
  18211. type: Boolean,
  18212. default: false
  18213. },
  18214. size: {
  18215. type: String,
  18216. values: componentSizes
  18217. },
  18218. controls: {
  18219. type: Boolean,
  18220. default: true
  18221. },
  18222. controlsPosition: {
  18223. type: String,
  18224. default: "",
  18225. values: ["", "right"]
  18226. },
  18227. name: String,
  18228. label: String,
  18229. placeholder: String,
  18230. precision: {
  18231. type: Number,
  18232. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  18233. }
  18234. });
  18235. const inputNumberEmits = {
  18236. change: (prev, cur) => prev !== cur,
  18237. blur: (e) => e instanceof FocusEvent,
  18238. focus: (e) => e instanceof FocusEvent,
  18239. input: (val) => isNumber(val),
  18240. "update:modelValue": (val) => isNumber(val) || val === void 0
  18241. };
  18242. const _sfc_main$q = defineComponent({
  18243. name: "ElInputNumber",
  18244. components: {
  18245. ElInput,
  18246. ElIcon,
  18247. ArrowUp: arrowUp,
  18248. ArrowDown: arrowDown,
  18249. Plus: plus,
  18250. Minus: minus
  18251. },
  18252. directives: {
  18253. RepeatClick
  18254. },
  18255. props: inputNumberProps,
  18256. emits: inputNumberEmits,
  18257. setup(props, { emit }) {
  18258. const input = ref();
  18259. const data2 = reactive({
  18260. currentValue: props.modelValue,
  18261. userInput: null
  18262. });
  18263. const { formItem } = useFormItem();
  18264. const ns = useNamespace("input-number");
  18265. const minDisabled = computed(() => ensurePrecision(props.modelValue, -1) < props.min);
  18266. const maxDisabled = computed(() => ensurePrecision(props.modelValue) > props.max);
  18267. const numPrecision = computed(() => {
  18268. const stepPrecision = getPrecision(props.step);
  18269. if (!isUndefined(props.precision)) {
  18270. if (stepPrecision > props.precision)
  18271. ;
  18272. return props.precision;
  18273. } else {
  18274. return Math.max(getPrecision(props.modelValue), stepPrecision);
  18275. }
  18276. });
  18277. const controlsAtRight = computed(() => {
  18278. return props.controls && props.controlsPosition === "right";
  18279. });
  18280. const inputNumberSize = useSize();
  18281. const inputNumberDisabled = useDisabled$1();
  18282. const displayValue = computed(() => {
  18283. if (data2.userInput !== null) {
  18284. return data2.userInput;
  18285. }
  18286. let currentValue = data2.currentValue;
  18287. if (isNumber(currentValue)) {
  18288. if (Number.isNaN(currentValue))
  18289. return "";
  18290. if (!isUndefined(props.precision)) {
  18291. currentValue = currentValue.toFixed(props.precision);
  18292. }
  18293. }
  18294. return currentValue;
  18295. });
  18296. const toPrecision = (num, pre) => {
  18297. if (isUndefined(pre))
  18298. pre = numPrecision.value;
  18299. return Number.parseFloat(`${Math.round(num * 10 ** pre) / 10 ** pre}`);
  18300. };
  18301. const getPrecision = (value) => {
  18302. if (isUndefined(value))
  18303. return 0;
  18304. const valueString = value.toString();
  18305. const dotPosition = valueString.indexOf(".");
  18306. let precision = 0;
  18307. if (dotPosition !== -1) {
  18308. precision = valueString.length - dotPosition - 1;
  18309. }
  18310. return precision;
  18311. };
  18312. const ensurePrecision = (val, coefficient = 1) => {
  18313. if (!isNumber(val))
  18314. return data2.currentValue;
  18315. val = isNumber(val) ? val : Number.NaN;
  18316. return toPrecision(val + props.step * coefficient);
  18317. };
  18318. const increase = () => {
  18319. if (inputNumberDisabled.value || maxDisabled.value)
  18320. return;
  18321. const value = props.modelValue || 0;
  18322. const newVal = ensurePrecision(value);
  18323. setCurrentValue(newVal);
  18324. };
  18325. const decrease = () => {
  18326. if (inputNumberDisabled.value || minDisabled.value)
  18327. return;
  18328. const value = props.modelValue || 0;
  18329. const newVal = ensurePrecision(value, -1);
  18330. setCurrentValue(newVal);
  18331. };
  18332. const verifyValue = (value, update) => {
  18333. const { max: max2, min: min2, step, precision, stepStrictly } = props;
  18334. let newVal = Number(value);
  18335. if (value === null) {
  18336. newVal = Number.NaN;
  18337. }
  18338. if (!Number.isNaN(newVal)) {
  18339. if (stepStrictly) {
  18340. newVal = Math.round(newVal / step) * step;
  18341. }
  18342. if (!isUndefined(precision)) {
  18343. newVal = toPrecision(newVal, precision);
  18344. }
  18345. if (newVal > max2 || newVal < min2) {
  18346. newVal = newVal > max2 ? max2 : min2;
  18347. update && emit("update:modelValue", newVal);
  18348. }
  18349. }
  18350. return newVal;
  18351. };
  18352. const setCurrentValue = (value) => {
  18353. var _a2;
  18354. const oldVal = data2.currentValue;
  18355. let newVal = verifyValue(value);
  18356. if (oldVal === newVal)
  18357. return;
  18358. if (Number.isNaN(newVal)) {
  18359. newVal = void 0;
  18360. }
  18361. data2.userInput = null;
  18362. emit("update:modelValue", newVal);
  18363. emit("input", newVal);
  18364. emit("change", newVal, oldVal);
  18365. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  18366. data2.currentValue = newVal;
  18367. };
  18368. const handleInput = (value) => {
  18369. return data2.userInput = value;
  18370. };
  18371. const handleInputChange = (value) => {
  18372. const newVal = value !== "" ? Number(value) : "";
  18373. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  18374. setCurrentValue(newVal);
  18375. }
  18376. data2.userInput = null;
  18377. };
  18378. const focus = () => {
  18379. var _a2, _b2;
  18380. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  18381. };
  18382. const blur = () => {
  18383. var _a2, _b2;
  18384. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b2.call(_a2);
  18385. };
  18386. const handleFocus = (event) => {
  18387. emit("focus", event);
  18388. };
  18389. const handleBlur = (event) => {
  18390. var _a2;
  18391. emit("blur", event);
  18392. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  18393. };
  18394. watch(() => props.modelValue, (value) => {
  18395. const newVal = verifyValue(value, true);
  18396. data2.currentValue = newVal;
  18397. data2.userInput = null;
  18398. }, { immediate: true });
  18399. onMounted(() => {
  18400. var _a2;
  18401. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18402. innerInput.setAttribute("role", "spinbutton");
  18403. innerInput.setAttribute("aria-valuemax", String(props.max));
  18404. innerInput.setAttribute("aria-valuemin", String(props.min));
  18405. innerInput.setAttribute("aria-valuenow", String(data2.currentValue));
  18406. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  18407. if (!isNumber(props.modelValue)) {
  18408. let val = Number(props.modelValue);
  18409. if (Number.isNaN(val)) {
  18410. val = void 0;
  18411. }
  18412. emit("update:modelValue", val);
  18413. }
  18414. });
  18415. onUpdated(() => {
  18416. var _a2;
  18417. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18418. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", data2.currentValue);
  18419. });
  18420. return {
  18421. input,
  18422. displayValue,
  18423. handleInput,
  18424. handleInputChange,
  18425. controlsAtRight,
  18426. decrease,
  18427. increase,
  18428. inputNumberSize,
  18429. inputNumberDisabled,
  18430. maxDisabled,
  18431. minDisabled,
  18432. focus,
  18433. blur,
  18434. handleFocus,
  18435. handleBlur,
  18436. ns
  18437. };
  18438. }
  18439. });
  18440. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  18441. const _component_arrow_down = resolveComponent("arrow-down");
  18442. const _component_minus = resolveComponent("minus");
  18443. const _component_el_icon = resolveComponent("el-icon");
  18444. const _component_arrow_up = resolveComponent("arrow-up");
  18445. const _component_plus = resolveComponent("plus");
  18446. const _component_el_input = resolveComponent("el-input");
  18447. const _directive_repeat_click = resolveDirective("repeat-click");
  18448. return openBlock(), createElementBlock("div", {
  18449. class: normalizeClass([
  18450. _ctx.ns.b(),
  18451. _ctx.ns.m(_ctx.inputNumberSize),
  18452. _ctx.ns.is("disabled", _ctx.inputNumberDisabled),
  18453. _ctx.ns.is("without-controls", !_ctx.controls),
  18454. _ctx.ns.is("controls-right", _ctx.controlsAtRight)
  18455. ]),
  18456. onDragstart: _cache[2] || (_cache[2] = withModifiers(() => {
  18457. }, ["prevent"]))
  18458. }, [
  18459. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18460. key: 0,
  18461. role: "button",
  18462. class: normalizeClass([_ctx.ns.e("decrease"), _ctx.ns.is("disabled", _ctx.minDisabled)]),
  18463. onKeydown: _cache[0] || (_cache[0] = withKeys((...args) => _ctx.decrease && _ctx.decrease(...args), ["enter"]))
  18464. }, [
  18465. createVNode(_component_el_icon, null, {
  18466. default: withCtx(() => [
  18467. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_down, { key: 0 })) : (openBlock(), createBlock(_component_minus, { key: 1 }))
  18468. ]),
  18469. _: 1
  18470. })
  18471. ], 34)), [
  18472. [_directive_repeat_click, _ctx.decrease]
  18473. ]) : createCommentVNode("v-if", true),
  18474. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18475. key: 1,
  18476. role: "button",
  18477. class: normalizeClass([_ctx.ns.e("increase"), _ctx.ns.is("disabled", _ctx.maxDisabled)]),
  18478. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.increase && _ctx.increase(...args), ["enter"]))
  18479. }, [
  18480. createVNode(_component_el_icon, null, {
  18481. default: withCtx(() => [
  18482. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_plus, { key: 1 }))
  18483. ]),
  18484. _: 1
  18485. })
  18486. ], 34)), [
  18487. [_directive_repeat_click, _ctx.increase]
  18488. ]) : createCommentVNode("v-if", true),
  18489. createVNode(_component_el_input, {
  18490. ref: "input",
  18491. type: "number",
  18492. step: _ctx.step,
  18493. "model-value": _ctx.displayValue,
  18494. placeholder: _ctx.placeholder,
  18495. disabled: _ctx.inputNumberDisabled,
  18496. size: _ctx.inputNumberSize,
  18497. max: _ctx.max,
  18498. min: _ctx.min,
  18499. name: _ctx.name,
  18500. label: _ctx.label,
  18501. "validate-event": false,
  18502. onKeydown: [
  18503. withKeys(withModifiers(_ctx.increase, ["prevent"]), ["up"]),
  18504. withKeys(withModifiers(_ctx.decrease, ["prevent"]), ["down"])
  18505. ],
  18506. onBlur: _ctx.handleBlur,
  18507. onFocus: _ctx.handleFocus,
  18508. onInput: _ctx.handleInput,
  18509. onChange: _ctx.handleInputChange
  18510. }, null, 8, ["step", "model-value", "placeholder", "disabled", "size", "max", "min", "name", "label", "onKeydown", "onBlur", "onFocus", "onInput", "onChange"])
  18511. ], 34);
  18512. }
  18513. var InputNumber = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["render", _sfc_render$d], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);
  18514. const ElInputNumber = withInstall(InputNumber);
  18515. const selectGroupKey = "ElSelectGroup";
  18516. const selectKey = "ElSelect";
  18517. function useOption(props, states) {
  18518. const select = inject(selectKey);
  18519. const selectGroup = inject(selectGroupKey, { disabled: false });
  18520. const isObject2 = computed(() => {
  18521. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  18522. });
  18523. const itemSelected = computed(() => {
  18524. if (!select.props.multiple) {
  18525. return isEqual2(props.value, select.props.modelValue);
  18526. } else {
  18527. return contains2(select.props.modelValue, props.value);
  18528. }
  18529. });
  18530. const limitReached = computed(() => {
  18531. if (select.props.multiple) {
  18532. const modelValue = select.props.modelValue || [];
  18533. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  18534. } else {
  18535. return false;
  18536. }
  18537. });
  18538. const currentLabel = computed(() => {
  18539. return props.label || (isObject2.value ? "" : props.value);
  18540. });
  18541. const currentValue = computed(() => {
  18542. return props.value || props.label || "";
  18543. });
  18544. const isDisabled = computed(() => {
  18545. return props.disabled || states.groupDisabled || limitReached.value;
  18546. });
  18547. const instance = getCurrentInstance();
  18548. const contains2 = (arr = [], target) => {
  18549. if (!isObject2.value) {
  18550. return arr && arr.includes(target);
  18551. } else {
  18552. const valueKey = select.props.valueKey;
  18553. return arr && arr.some((item) => {
  18554. return get(item, valueKey) === get(target, valueKey);
  18555. });
  18556. }
  18557. };
  18558. const isEqual2 = (a2, b2) => {
  18559. if (!isObject2.value) {
  18560. return a2 === b2;
  18561. } else {
  18562. const { valueKey } = select.props;
  18563. return get(a2, valueKey) === get(b2, valueKey);
  18564. }
  18565. };
  18566. const hoverItem = () => {
  18567. if (!props.disabled && !selectGroup.disabled) {
  18568. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  18569. }
  18570. };
  18571. watch(() => currentLabel.value, () => {
  18572. if (!props.created && !select.props.remote)
  18573. select.setSelected();
  18574. });
  18575. watch(() => props.value, (val, oldVal) => {
  18576. const { remote, valueKey } = select.props;
  18577. if (!props.created && !remote) {
  18578. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  18579. return;
  18580. }
  18581. select.setSelected();
  18582. }
  18583. });
  18584. watch(() => selectGroup.disabled, () => {
  18585. states.groupDisabled = selectGroup.disabled;
  18586. }, { immediate: true });
  18587. const { queryChange } = toRaw(select);
  18588. watch(queryChange, (changes) => {
  18589. const { query } = unref(changes);
  18590. const regexp4 = new RegExp(escapeStringRegexp(query), "i");
  18591. states.visible = regexp4.test(currentLabel.value) || props.created;
  18592. if (!states.visible) {
  18593. select.filteredOptionsCount--;
  18594. }
  18595. });
  18596. return {
  18597. select,
  18598. currentLabel,
  18599. currentValue,
  18600. itemSelected,
  18601. isDisabled,
  18602. hoverItem
  18603. };
  18604. }
  18605. const _sfc_main$p = defineComponent({
  18606. name: "ElOption",
  18607. componentName: "ElOption",
  18608. props: {
  18609. value: {
  18610. required: true,
  18611. type: [String, Number, Boolean, Object]
  18612. },
  18613. label: [String, Number],
  18614. created: Boolean,
  18615. disabled: {
  18616. type: Boolean,
  18617. default: false
  18618. }
  18619. },
  18620. setup(props) {
  18621. const ns = useNamespace("select");
  18622. const states = reactive({
  18623. index: -1,
  18624. groupDisabled: false,
  18625. visible: true,
  18626. hitState: false,
  18627. hover: false
  18628. });
  18629. const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption(props, states);
  18630. const { visible, hover } = toRefs(states);
  18631. const vm = getCurrentInstance().proxy;
  18632. const key = vm.value;
  18633. select.onOptionCreate(vm);
  18634. onBeforeUnmount(() => {
  18635. const { selected } = select;
  18636. const selectedOptions = select.props.multiple ? selected : [selected];
  18637. const doesSelected = selectedOptions.some((item) => {
  18638. return item.value === vm.value;
  18639. });
  18640. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  18641. nextTick(() => {
  18642. select.cachedOptions.delete(key);
  18643. });
  18644. }
  18645. select.onOptionDestroy(key, vm);
  18646. });
  18647. function selectOptionClick() {
  18648. if (props.disabled !== true && states.groupDisabled !== true) {
  18649. select.handleOptionSelect(vm, true);
  18650. }
  18651. }
  18652. return {
  18653. ns,
  18654. currentLabel,
  18655. itemSelected,
  18656. isDisabled,
  18657. select,
  18658. hoverItem,
  18659. visible,
  18660. hover,
  18661. selectOptionClick,
  18662. states
  18663. };
  18664. }
  18665. });
  18666. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  18667. return withDirectives((openBlock(), createElementBlock("li", {
  18668. class: normalizeClass([
  18669. _ctx.ns.be("dropdown", "item"),
  18670. _ctx.ns.is("disabled", _ctx.isDisabled),
  18671. {
  18672. selected: _ctx.itemSelected,
  18673. hover: _ctx.hover
  18674. }
  18675. ]),
  18676. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  18677. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  18678. }, [
  18679. renderSlot(_ctx.$slots, "default", {}, () => [
  18680. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  18681. ])
  18682. ], 34)), [
  18683. [vShow, _ctx.visible]
  18684. ]);
  18685. }
  18686. var Option = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["render", _sfc_render$c], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);
  18687. const _sfc_main$o = defineComponent({
  18688. name: "ElSelectDropdown",
  18689. componentName: "ElSelectDropdown",
  18690. setup() {
  18691. const select = inject(selectKey);
  18692. const ns = useNamespace("select");
  18693. const popperClass = computed(() => select.props.popperClass);
  18694. const isMultiple = computed(() => select.props.multiple);
  18695. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  18696. const minWidth = ref("");
  18697. function updateMinWidth() {
  18698. var _a2;
  18699. minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.getBoundingClientRect().width}px`;
  18700. }
  18701. onMounted(() => {
  18702. updateMinWidth();
  18703. addResizeListener(select.selectWrapper, updateMinWidth);
  18704. });
  18705. onBeforeUnmount(() => {
  18706. removeResizeListener(select.selectWrapper, updateMinWidth);
  18707. });
  18708. return {
  18709. ns,
  18710. minWidth,
  18711. popperClass,
  18712. isMultiple,
  18713. isFitInputWidth
  18714. };
  18715. }
  18716. });
  18717. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  18718. return openBlock(), createElementBlock("div", {
  18719. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  18720. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  18721. }, [
  18722. renderSlot(_ctx.$slots, "default")
  18723. ], 6);
  18724. }
  18725. var ElSelectMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["render", _sfc_render$b], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);
  18726. function useSelectStates(props) {
  18727. const { t } = useLocale();
  18728. return reactive({
  18729. options: /* @__PURE__ */ new Map(),
  18730. cachedOptions: /* @__PURE__ */ new Map(),
  18731. createdLabel: null,
  18732. createdSelected: false,
  18733. selected: props.multiple ? [] : {},
  18734. inputLength: 20,
  18735. inputWidth: 0,
  18736. initialInputHeight: 0,
  18737. optionsCount: 0,
  18738. filteredOptionsCount: 0,
  18739. visible: false,
  18740. softFocus: false,
  18741. selectedLabel: "",
  18742. hoverIndex: -1,
  18743. query: "",
  18744. previousQuery: null,
  18745. inputHovering: false,
  18746. cachedPlaceHolder: "",
  18747. currentPlaceholder: t("el.select.placeholder"),
  18748. menuVisibleOnFocus: false,
  18749. isOnComposition: false,
  18750. isSilentBlur: false,
  18751. prefixWidth: 11,
  18752. tagInMultiLine: false
  18753. });
  18754. }
  18755. const useSelect = (props, states, ctx) => {
  18756. const { t } = useLocale();
  18757. const ns = useNamespace("select");
  18758. const reference2 = ref(null);
  18759. const input = ref(null);
  18760. const tooltipRef = ref(null);
  18761. const tags = ref(null);
  18762. const selectWrapper = ref(null);
  18763. const scrollbar = ref(null);
  18764. const hoverOption = ref(-1);
  18765. const queryChange = shallowRef({ query: "" });
  18766. const groupQueryChange = shallowRef("");
  18767. const elForm2 = inject(formContextKey, {});
  18768. const elFormItem2 = inject(formItemContextKey, {});
  18769. const readonly2 = computed(() => !props.filterable || props.multiple || !states.visible);
  18770. const selectDisabled = computed(() => props.disabled || elForm2.disabled);
  18771. const showClose = computed(() => {
  18772. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  18773. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  18774. return criteria;
  18775. });
  18776. const iconComponent = computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
  18777. const iconReverse = computed(() => ns.is("reverse", iconComponent.value && states.visible));
  18778. const debounce$1$1 = computed(() => props.remote ? 300 : 0);
  18779. const emptyText = computed(() => {
  18780. if (props.loading) {
  18781. return props.loadingText || t("el.select.loading");
  18782. } else {
  18783. if (props.remote && states.query === "" && states.options.size === 0)
  18784. return false;
  18785. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  18786. return props.noMatchText || t("el.select.noMatch");
  18787. }
  18788. if (states.options.size === 0) {
  18789. return props.noDataText || t("el.select.noData");
  18790. }
  18791. }
  18792. return null;
  18793. });
  18794. const optionsArray = computed(() => Array.from(states.options.values()));
  18795. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  18796. const showNewOption = computed(() => {
  18797. const hasExistingOption = optionsArray.value.filter((option) => {
  18798. return !option.created;
  18799. }).some((option) => {
  18800. return option.currentLabel === states.query;
  18801. });
  18802. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  18803. });
  18804. const selectSize = useSize();
  18805. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  18806. const dropMenuVisible = computed({
  18807. get() {
  18808. return states.visible && emptyText.value !== false;
  18809. },
  18810. set(val) {
  18811. states.visible = val;
  18812. }
  18813. });
  18814. watch(() => selectDisabled.value, () => {
  18815. nextTick(() => {
  18816. resetInputHeight();
  18817. });
  18818. });
  18819. watch(() => props.placeholder, (val) => {
  18820. states.cachedPlaceHolder = states.currentPlaceholder = val;
  18821. });
  18822. watch(() => props.modelValue, (val, oldVal) => {
  18823. var _a2;
  18824. if (props.multiple) {
  18825. resetInputHeight();
  18826. if (val && val.length > 0 || input.value && states.query !== "") {
  18827. states.currentPlaceholder = "";
  18828. } else {
  18829. states.currentPlaceholder = states.cachedPlaceHolder;
  18830. }
  18831. if (props.filterable && !props.reserveKeyword) {
  18832. states.query = "";
  18833. handleQueryChange(states.query);
  18834. }
  18835. }
  18836. setSelected();
  18837. if (props.filterable && !props.multiple) {
  18838. states.inputLength = 20;
  18839. }
  18840. if (!isEqual(val, oldVal)) {
  18841. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  18842. }
  18843. }, {
  18844. flush: "post",
  18845. deep: true
  18846. });
  18847. watch(() => states.visible, (val) => {
  18848. var _a2, _b2, _c;
  18849. if (!val) {
  18850. input.value && input.value.blur();
  18851. states.query = "";
  18852. states.previousQuery = null;
  18853. states.selectedLabel = "";
  18854. states.inputLength = 20;
  18855. states.menuVisibleOnFocus = false;
  18856. resetHoverIndex();
  18857. nextTick(() => {
  18858. if (input.value && input.value.value === "" && states.selected.length === 0) {
  18859. states.currentPlaceholder = states.cachedPlaceHolder;
  18860. }
  18861. });
  18862. if (!props.multiple) {
  18863. if (states.selected) {
  18864. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  18865. states.selectedLabel = states.createdLabel;
  18866. } else {
  18867. states.selectedLabel = states.selected.currentLabel;
  18868. }
  18869. if (props.filterable)
  18870. states.query = states.selectedLabel;
  18871. }
  18872. if (props.filterable) {
  18873. states.currentPlaceholder = states.cachedPlaceHolder;
  18874. }
  18875. }
  18876. } else {
  18877. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  18878. if (props.filterable) {
  18879. states.filteredOptionsCount = states.optionsCount;
  18880. states.query = props.remote ? "" : states.selectedLabel;
  18881. if (props.multiple) {
  18882. (_c = input.value) == null ? void 0 : _c.focus();
  18883. } else {
  18884. if (states.selectedLabel) {
  18885. states.currentPlaceholder = `${states.selectedLabel}`;
  18886. states.selectedLabel = "";
  18887. }
  18888. }
  18889. handleQueryChange(states.query);
  18890. if (!props.multiple && !props.remote) {
  18891. queryChange.value.query = "";
  18892. triggerRef(queryChange);
  18893. triggerRef(groupQueryChange);
  18894. }
  18895. }
  18896. }
  18897. ctx.emit("visible-change", val);
  18898. });
  18899. watch(() => states.options.entries(), () => {
  18900. var _a2, _b2, _c;
  18901. if (!isClient$1)
  18902. return;
  18903. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  18904. if (props.multiple) {
  18905. resetInputHeight();
  18906. }
  18907. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  18908. if (!Array.from(inputs).includes(document.activeElement)) {
  18909. setSelected();
  18910. }
  18911. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  18912. checkDefaultFirstOption();
  18913. }
  18914. }, {
  18915. flush: "post"
  18916. });
  18917. watch(() => states.hoverIndex, (val) => {
  18918. if (typeof val === "number" && val > -1) {
  18919. hoverOption.value = optionsArray.value[val] || {};
  18920. }
  18921. optionsArray.value.forEach((option) => {
  18922. option.hover = hoverOption.value === option;
  18923. });
  18924. });
  18925. const resetInputHeight = () => {
  18926. if (props.collapseTags && !props.filterable)
  18927. return;
  18928. nextTick(() => {
  18929. var _a2, _b2;
  18930. if (!reference2.value)
  18931. return;
  18932. const input2 = reference2.value.$el.querySelector("input");
  18933. const _tags = tags.value;
  18934. const sizeInMap = states.initialInputHeight || getComponentSize(selectSize.value || elForm2.size);
  18935. input2.style.height = states.selected.length === 0 ? `${sizeInMap}px` : `${Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)}px`;
  18936. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  18937. if (states.visible && emptyText.value !== false) {
  18938. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  18939. }
  18940. });
  18941. };
  18942. const handleQueryChange = (val) => {
  18943. if (states.previousQuery === val || states.isOnComposition)
  18944. return;
  18945. if (states.previousQuery === null && (typeof props.filterMethod === "function" || typeof props.remoteMethod === "function")) {
  18946. states.previousQuery = val;
  18947. return;
  18948. }
  18949. states.previousQuery = val;
  18950. nextTick(() => {
  18951. var _a2, _b2;
  18952. if (states.visible)
  18953. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  18954. });
  18955. states.hoverIndex = -1;
  18956. if (props.multiple && props.filterable) {
  18957. nextTick(() => {
  18958. const length = input.value.value.length * 15 + 20;
  18959. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  18960. managePlaceholder();
  18961. resetInputHeight();
  18962. });
  18963. }
  18964. if (props.remote && typeof props.remoteMethod === "function") {
  18965. states.hoverIndex = -1;
  18966. props.remoteMethod(val);
  18967. } else if (typeof props.filterMethod === "function") {
  18968. props.filterMethod(val);
  18969. triggerRef(groupQueryChange);
  18970. } else {
  18971. states.filteredOptionsCount = states.optionsCount;
  18972. queryChange.value.query = val;
  18973. triggerRef(queryChange);
  18974. triggerRef(groupQueryChange);
  18975. }
  18976. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  18977. checkDefaultFirstOption();
  18978. }
  18979. };
  18980. const managePlaceholder = () => {
  18981. if (states.currentPlaceholder !== "") {
  18982. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  18983. }
  18984. };
  18985. const checkDefaultFirstOption = () => {
  18986. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  18987. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  18988. const firstOriginOption = optionsInDropdown[0];
  18989. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  18990. };
  18991. const setSelected = () => {
  18992. var _a2;
  18993. if (!props.multiple) {
  18994. const option = getOption(props.modelValue);
  18995. if ((_a2 = option.props) == null ? void 0 : _a2.created) {
  18996. states.createdLabel = option.props.value;
  18997. states.createdSelected = true;
  18998. } else {
  18999. states.createdSelected = false;
  19000. }
  19001. states.selectedLabel = option.currentLabel;
  19002. states.selected = option;
  19003. if (props.filterable)
  19004. states.query = states.selectedLabel;
  19005. return;
  19006. } else {
  19007. states.selectedLabel = "";
  19008. }
  19009. const result = [];
  19010. if (Array.isArray(props.modelValue)) {
  19011. props.modelValue.forEach((value) => {
  19012. result.push(getOption(value));
  19013. });
  19014. }
  19015. states.selected = result;
  19016. nextTick(() => {
  19017. resetInputHeight();
  19018. });
  19019. };
  19020. const getOption = (value) => {
  19021. let option;
  19022. const isObjectValue = toRawType(value).toLowerCase() === "object";
  19023. const isNull = toRawType(value).toLowerCase() === "null";
  19024. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  19025. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  19026. const cachedOption = cachedOptionsArray.value[i];
  19027. const isEqualValue = isObjectValue ? get(cachedOption, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  19028. if (isEqualValue) {
  19029. option = {
  19030. value,
  19031. currentLabel: cachedOption.currentLabel,
  19032. isDisabled: cachedOption.isDisabled
  19033. };
  19034. break;
  19035. }
  19036. }
  19037. if (option)
  19038. return option;
  19039. const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  19040. const newOption = {
  19041. value,
  19042. currentLabel: label
  19043. };
  19044. if (props.multiple) {
  19045. newOption.hitState = false;
  19046. }
  19047. return newOption;
  19048. };
  19049. const resetHoverIndex = () => {
  19050. setTimeout(() => {
  19051. const valueKey = props.valueKey;
  19052. if (!props.multiple) {
  19053. states.hoverIndex = optionsArray.value.findIndex((item) => {
  19054. return getValueKey(item) === getValueKey(states.selected);
  19055. });
  19056. } else {
  19057. if (states.selected.length > 0) {
  19058. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  19059. return optionsArray.value.findIndex((item) => {
  19060. return get(item, valueKey) === get(selected, valueKey);
  19061. });
  19062. }));
  19063. } else {
  19064. states.hoverIndex = -1;
  19065. }
  19066. }
  19067. }, 300);
  19068. };
  19069. const handleResize = () => {
  19070. var _a2, _b2;
  19071. resetInputWidth();
  19072. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19073. if (props.multiple && !props.filterable)
  19074. resetInputHeight();
  19075. };
  19076. const resetInputWidth = () => {
  19077. var _a2;
  19078. states.inputWidth = (_a2 = reference2.value) == null ? void 0 : _a2.$el.getBoundingClientRect().width;
  19079. };
  19080. const onInputChange = () => {
  19081. if (props.filterable && states.query !== states.selectedLabel) {
  19082. states.query = states.selectedLabel;
  19083. handleQueryChange(states.query);
  19084. }
  19085. };
  19086. const debouncedOnInputChange = debounce$1(() => {
  19087. onInputChange();
  19088. }, debounce$1$1.value);
  19089. const debouncedQueryChange = debounce$1((e) => {
  19090. handleQueryChange(e.target.value);
  19091. }, debounce$1$1.value);
  19092. const emitChange = (val) => {
  19093. if (!isEqual(props.modelValue, val)) {
  19094. ctx.emit(CHANGE_EVENT, val);
  19095. }
  19096. };
  19097. const deletePrevTag = (e) => {
  19098. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  19099. const value = props.modelValue.slice();
  19100. value.pop();
  19101. ctx.emit(UPDATE_MODEL_EVENT, value);
  19102. emitChange(value);
  19103. }
  19104. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  19105. states.currentPlaceholder = states.cachedPlaceHolder;
  19106. }
  19107. };
  19108. const deleteTag = (event, tag) => {
  19109. const index = states.selected.indexOf(tag);
  19110. if (index > -1 && !selectDisabled.value) {
  19111. const value = props.modelValue.slice();
  19112. value.splice(index, 1);
  19113. ctx.emit(UPDATE_MODEL_EVENT, value);
  19114. emitChange(value);
  19115. ctx.emit("remove-tag", tag.value);
  19116. }
  19117. event.stopPropagation();
  19118. };
  19119. const deleteSelected = (event) => {
  19120. event.stopPropagation();
  19121. const value = props.multiple ? [] : "";
  19122. if (typeof value !== "string") {
  19123. for (const item of states.selected) {
  19124. if (item.isDisabled)
  19125. value.push(item.value);
  19126. }
  19127. }
  19128. ctx.emit(UPDATE_MODEL_EVENT, value);
  19129. emitChange(value);
  19130. states.visible = false;
  19131. ctx.emit("clear");
  19132. };
  19133. const handleOptionSelect = (option, byClick) => {
  19134. var _a2;
  19135. if (props.multiple) {
  19136. const value = (props.modelValue || []).slice();
  19137. const optionIndex = getValueIndex(value, option.value);
  19138. if (optionIndex > -1) {
  19139. value.splice(optionIndex, 1);
  19140. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  19141. value.push(option.value);
  19142. }
  19143. ctx.emit(UPDATE_MODEL_EVENT, value);
  19144. emitChange(value);
  19145. if (option.created) {
  19146. states.query = "";
  19147. handleQueryChange("");
  19148. states.inputLength = 20;
  19149. }
  19150. if (props.filterable)
  19151. (_a2 = input.value) == null ? void 0 : _a2.focus();
  19152. } else {
  19153. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  19154. emitChange(option.value);
  19155. states.visible = false;
  19156. }
  19157. states.isSilentBlur = byClick;
  19158. setSoftFocus();
  19159. if (states.visible)
  19160. return;
  19161. nextTick(() => {
  19162. scrollToOption(option);
  19163. });
  19164. };
  19165. const getValueIndex = (arr = [], value) => {
  19166. if (!isObject$1(value))
  19167. return arr.indexOf(value);
  19168. const valueKey = props.valueKey;
  19169. let index = -1;
  19170. arr.some((item, i) => {
  19171. if (get(item, valueKey) === get(value, valueKey)) {
  19172. index = i;
  19173. return true;
  19174. }
  19175. return false;
  19176. });
  19177. return index;
  19178. };
  19179. const setSoftFocus = () => {
  19180. states.softFocus = true;
  19181. const _input = input.value || reference2.value;
  19182. if (_input) {
  19183. _input == null ? void 0 : _input.focus();
  19184. }
  19185. };
  19186. const scrollToOption = (option) => {
  19187. var _a2, _b2, _c, _d, _e;
  19188. const targetOption = Array.isArray(option) ? option[0] : option;
  19189. let target = null;
  19190. if (targetOption == null ? void 0 : targetOption.value) {
  19191. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  19192. if (options.length > 0) {
  19193. target = options[0].$el;
  19194. }
  19195. }
  19196. if (tooltipRef.value && target) {
  19197. 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")}`);
  19198. if (menu) {
  19199. scrollIntoView(menu, target);
  19200. }
  19201. }
  19202. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  19203. };
  19204. const onOptionCreate = (vm) => {
  19205. states.optionsCount++;
  19206. states.filteredOptionsCount++;
  19207. states.options.set(vm.value, vm);
  19208. states.cachedOptions.set(vm.value, vm);
  19209. };
  19210. const onOptionDestroy = (key, vm) => {
  19211. if (states.options.get(key) === vm) {
  19212. states.optionsCount--;
  19213. states.filteredOptionsCount--;
  19214. states.options.delete(key);
  19215. }
  19216. };
  19217. const resetInputState = (e) => {
  19218. if (e.code !== EVENT_CODE.backspace)
  19219. toggleLastOptionHitState(false);
  19220. states.inputLength = input.value.value.length * 15 + 20;
  19221. resetInputHeight();
  19222. };
  19223. const toggleLastOptionHitState = (hit) => {
  19224. if (!Array.isArray(states.selected))
  19225. return;
  19226. const option = states.selected[states.selected.length - 1];
  19227. if (!option)
  19228. return;
  19229. if (hit === true || hit === false) {
  19230. option.hitState = hit;
  19231. return hit;
  19232. }
  19233. option.hitState = !option.hitState;
  19234. return option.hitState;
  19235. };
  19236. const handleComposition = (event) => {
  19237. const text = event.target.value;
  19238. if (event.type === "compositionend") {
  19239. states.isOnComposition = false;
  19240. nextTick(() => handleQueryChange(text));
  19241. } else {
  19242. const lastCharacter = text[text.length - 1] || "";
  19243. states.isOnComposition = !isKorean(lastCharacter);
  19244. }
  19245. };
  19246. const handleMenuEnter = () => {
  19247. nextTick(() => scrollToOption(states.selected));
  19248. };
  19249. const handleFocus = (event) => {
  19250. if (!states.softFocus) {
  19251. if (props.automaticDropdown || props.filterable) {
  19252. if (props.filterable && !states.visible) {
  19253. states.menuVisibleOnFocus = true;
  19254. }
  19255. states.visible = true;
  19256. }
  19257. ctx.emit("focus", event);
  19258. } else {
  19259. states.softFocus = false;
  19260. }
  19261. };
  19262. const blur = () => {
  19263. var _a2;
  19264. states.visible = false;
  19265. (_a2 = reference2.value) == null ? void 0 : _a2.blur();
  19266. };
  19267. const handleBlur = (event) => {
  19268. nextTick(() => {
  19269. if (states.isSilentBlur) {
  19270. states.isSilentBlur = false;
  19271. } else {
  19272. ctx.emit("blur", event);
  19273. }
  19274. });
  19275. states.softFocus = false;
  19276. };
  19277. const handleClearClick = (event) => {
  19278. deleteSelected(event);
  19279. };
  19280. const handleClose = () => {
  19281. states.visible = false;
  19282. };
  19283. const toggleMenu = () => {
  19284. var _a2;
  19285. if (props.automaticDropdown)
  19286. return;
  19287. if (!selectDisabled.value) {
  19288. if (states.menuVisibleOnFocus) {
  19289. states.menuVisibleOnFocus = false;
  19290. } else {
  19291. states.visible = !states.visible;
  19292. }
  19293. if (states.visible) {
  19294. (_a2 = input.value || reference2.value) == null ? void 0 : _a2.focus();
  19295. }
  19296. }
  19297. };
  19298. const selectOption = () => {
  19299. if (!states.visible) {
  19300. toggleMenu();
  19301. } else {
  19302. if (optionsArray.value[states.hoverIndex]) {
  19303. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  19304. }
  19305. }
  19306. };
  19307. const getValueKey = (item) => {
  19308. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  19309. };
  19310. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  19311. const navigateOptions = (direction) => {
  19312. if (!states.visible) {
  19313. states.visible = true;
  19314. return;
  19315. }
  19316. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  19317. return;
  19318. if (states.isOnComposition)
  19319. return;
  19320. if (!optionsAllDisabled.value) {
  19321. if (direction === "next") {
  19322. states.hoverIndex++;
  19323. if (states.hoverIndex === states.options.size) {
  19324. states.hoverIndex = 0;
  19325. }
  19326. } else if (direction === "prev") {
  19327. states.hoverIndex--;
  19328. if (states.hoverIndex < 0) {
  19329. states.hoverIndex = states.options.size - 1;
  19330. }
  19331. }
  19332. const option = optionsArray.value[states.hoverIndex];
  19333. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  19334. navigateOptions(direction);
  19335. }
  19336. nextTick(() => scrollToOption(hoverOption.value));
  19337. }
  19338. };
  19339. return {
  19340. optionsArray,
  19341. selectSize,
  19342. handleResize,
  19343. debouncedOnInputChange,
  19344. debouncedQueryChange,
  19345. deletePrevTag,
  19346. deleteTag,
  19347. deleteSelected,
  19348. handleOptionSelect,
  19349. scrollToOption,
  19350. readonly: readonly2,
  19351. resetInputHeight,
  19352. showClose,
  19353. iconComponent,
  19354. iconReverse,
  19355. showNewOption,
  19356. collapseTagSize,
  19357. setSelected,
  19358. managePlaceholder,
  19359. selectDisabled,
  19360. emptyText,
  19361. toggleLastOptionHitState,
  19362. resetInputState,
  19363. handleComposition,
  19364. onOptionCreate,
  19365. onOptionDestroy,
  19366. handleMenuEnter,
  19367. handleFocus,
  19368. blur,
  19369. handleBlur,
  19370. handleClearClick,
  19371. handleClose,
  19372. toggleMenu,
  19373. selectOption,
  19374. getValueKey,
  19375. navigateOptions,
  19376. dropMenuVisible,
  19377. queryChange,
  19378. groupQueryChange,
  19379. reference: reference2,
  19380. input,
  19381. tooltipRef,
  19382. tags,
  19383. selectWrapper,
  19384. scrollbar
  19385. };
  19386. };
  19387. const COMPONENT_NAME$1 = "ElSelect";
  19388. const _sfc_main$n = defineComponent({
  19389. name: COMPONENT_NAME$1,
  19390. componentName: COMPONENT_NAME$1,
  19391. components: {
  19392. ElInput,
  19393. ElSelectMenu,
  19394. ElOption: Option,
  19395. ElTag,
  19396. ElScrollbar,
  19397. ElTooltip,
  19398. ElIcon
  19399. },
  19400. directives: { ClickOutside },
  19401. props: {
  19402. name: String,
  19403. id: String,
  19404. modelValue: {
  19405. type: [Array, String, Number, Boolean, Object],
  19406. default: void 0
  19407. },
  19408. autocomplete: {
  19409. type: String,
  19410. default: "off"
  19411. },
  19412. automaticDropdown: Boolean,
  19413. size: {
  19414. type: String,
  19415. validator: isValidComponentSize
  19416. },
  19417. effect: {
  19418. type: String,
  19419. default: "light"
  19420. },
  19421. disabled: Boolean,
  19422. clearable: Boolean,
  19423. filterable: Boolean,
  19424. allowCreate: Boolean,
  19425. loading: Boolean,
  19426. popperClass: {
  19427. type: String,
  19428. default: ""
  19429. },
  19430. remote: Boolean,
  19431. loadingText: String,
  19432. noMatchText: String,
  19433. noDataText: String,
  19434. remoteMethod: Function,
  19435. filterMethod: Function,
  19436. multiple: Boolean,
  19437. multipleLimit: {
  19438. type: Number,
  19439. default: 0
  19440. },
  19441. placeholder: {
  19442. type: String
  19443. },
  19444. defaultFirstOption: Boolean,
  19445. reserveKeyword: {
  19446. type: Boolean,
  19447. default: true
  19448. },
  19449. valueKey: {
  19450. type: String,
  19451. default: "value"
  19452. },
  19453. collapseTags: Boolean,
  19454. collapseTagsTooltip: {
  19455. type: Boolean,
  19456. default: false
  19457. },
  19458. popperAppendToBody: {
  19459. type: Boolean,
  19460. default: void 0
  19461. },
  19462. teleported: useTooltipContentProps.teleported,
  19463. persistent: {
  19464. type: Boolean,
  19465. default: true
  19466. },
  19467. clearIcon: {
  19468. type: [String, Object],
  19469. default: circleClose
  19470. },
  19471. fitInputWidth: {
  19472. type: Boolean,
  19473. default: false
  19474. },
  19475. suffixIcon: {
  19476. type: [String, Object],
  19477. default: arrowUp
  19478. },
  19479. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  19480. },
  19481. emits: [
  19482. UPDATE_MODEL_EVENT,
  19483. CHANGE_EVENT,
  19484. "remove-tag",
  19485. "clear",
  19486. "visible-change",
  19487. "focus",
  19488. "blur"
  19489. ],
  19490. setup(props, ctx) {
  19491. const nsSelect = useNamespace("select");
  19492. const nsInput = useNamespace("input");
  19493. const { t } = useLocale();
  19494. const states = useSelectStates(props);
  19495. const {
  19496. optionsArray,
  19497. selectSize,
  19498. readonly: readonly2,
  19499. handleResize,
  19500. collapseTagSize,
  19501. debouncedOnInputChange,
  19502. debouncedQueryChange,
  19503. deletePrevTag,
  19504. deleteTag,
  19505. deleteSelected,
  19506. handleOptionSelect,
  19507. scrollToOption,
  19508. setSelected,
  19509. resetInputHeight,
  19510. managePlaceholder,
  19511. showClose,
  19512. selectDisabled,
  19513. iconComponent,
  19514. iconReverse,
  19515. showNewOption,
  19516. emptyText,
  19517. toggleLastOptionHitState,
  19518. resetInputState,
  19519. handleComposition,
  19520. onOptionCreate,
  19521. onOptionDestroy,
  19522. handleMenuEnter,
  19523. handleFocus,
  19524. blur,
  19525. handleBlur,
  19526. handleClearClick,
  19527. handleClose,
  19528. toggleMenu,
  19529. selectOption,
  19530. getValueKey,
  19531. navigateOptions,
  19532. dropMenuVisible,
  19533. reference: reference2,
  19534. input,
  19535. tooltipRef,
  19536. tags,
  19537. selectWrapper,
  19538. scrollbar,
  19539. queryChange,
  19540. groupQueryChange
  19541. } = useSelect(props, states, ctx);
  19542. const { focus } = useFocus(reference2);
  19543. const {
  19544. inputWidth,
  19545. selected,
  19546. inputLength,
  19547. filteredOptionsCount,
  19548. visible,
  19549. softFocus,
  19550. selectedLabel,
  19551. hoverIndex,
  19552. query,
  19553. inputHovering,
  19554. currentPlaceholder,
  19555. menuVisibleOnFocus,
  19556. isOnComposition,
  19557. isSilentBlur,
  19558. options,
  19559. cachedOptions,
  19560. optionsCount,
  19561. prefixWidth,
  19562. tagInMultiLine
  19563. } = toRefs(states);
  19564. const wrapperKls = computed(() => {
  19565. const classList = [nsSelect.b()];
  19566. const _selectSize = unref(selectSize);
  19567. if (_selectSize) {
  19568. classList.push(nsSelect.m(_selectSize));
  19569. }
  19570. if (props.disabled) {
  19571. classList.push(nsSelect.m("disabled"));
  19572. }
  19573. return classList;
  19574. });
  19575. const selectTagsStyle = computed(() => ({
  19576. maxWidth: `${unref(inputWidth) - 32}px`,
  19577. width: "100%"
  19578. }));
  19579. provide(selectKey, reactive({
  19580. props,
  19581. options,
  19582. optionsArray,
  19583. cachedOptions,
  19584. optionsCount,
  19585. filteredOptionsCount,
  19586. hoverIndex,
  19587. handleOptionSelect,
  19588. onOptionCreate,
  19589. onOptionDestroy,
  19590. selectWrapper,
  19591. selected,
  19592. setSelected,
  19593. queryChange,
  19594. groupQueryChange
  19595. }));
  19596. onMounted(() => {
  19597. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || t("el.select.placeholder");
  19598. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  19599. currentPlaceholder.value = "";
  19600. }
  19601. addResizeListener(selectWrapper.value, handleResize);
  19602. if (reference2.value && reference2.value.$el) {
  19603. const input2 = reference2.value.input;
  19604. states.initialInputHeight = input2.getBoundingClientRect().height || getComponentSize(selectSize.value);
  19605. }
  19606. if (props.remote && props.multiple) {
  19607. resetInputHeight();
  19608. }
  19609. nextTick(() => {
  19610. if (!reference2.value)
  19611. return;
  19612. if (reference2.value.$el) {
  19613. inputWidth.value = reference2.value.$el.getBoundingClientRect().width;
  19614. }
  19615. if (ctx.slots.prefix) {
  19616. const inputChildNodes = reference2.value.$el.childNodes;
  19617. const input2 = Array.from(inputChildNodes).find((item) => item.tagName === "INPUT");
  19618. const prefix = reference2.value.$el.querySelector(`.${nsInput.e("prefix")}`);
  19619. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  19620. if (states.prefixWidth) {
  19621. input2.style.paddingLeft = `${Math.max(states.prefixWidth, 30)}px`;
  19622. }
  19623. }
  19624. });
  19625. setSelected();
  19626. });
  19627. onBeforeUnmount(() => {
  19628. removeResizeListener(selectWrapper.value, handleResize);
  19629. });
  19630. if (props.multiple && !Array.isArray(props.modelValue)) {
  19631. ctx.emit(UPDATE_MODEL_EVENT, []);
  19632. }
  19633. if (!props.multiple && Array.isArray(props.modelValue)) {
  19634. ctx.emit(UPDATE_MODEL_EVENT, "");
  19635. }
  19636. const popperPaneRef = computed(() => {
  19637. var _a2, _b2;
  19638. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  19639. });
  19640. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$1, "popperAppendToBody");
  19641. return {
  19642. tagInMultiLine,
  19643. prefixWidth,
  19644. selectSize,
  19645. readonly: readonly2,
  19646. handleResize,
  19647. collapseTagSize,
  19648. debouncedOnInputChange,
  19649. debouncedQueryChange,
  19650. deletePrevTag,
  19651. deleteTag,
  19652. deleteSelected,
  19653. handleOptionSelect,
  19654. scrollToOption,
  19655. inputWidth,
  19656. selected,
  19657. inputLength,
  19658. filteredOptionsCount,
  19659. visible,
  19660. softFocus,
  19661. selectedLabel,
  19662. hoverIndex,
  19663. query,
  19664. inputHovering,
  19665. currentPlaceholder,
  19666. menuVisibleOnFocus,
  19667. isOnComposition,
  19668. isSilentBlur,
  19669. options,
  19670. resetInputHeight,
  19671. managePlaceholder,
  19672. showClose,
  19673. selectDisabled,
  19674. iconComponent,
  19675. iconReverse,
  19676. showNewOption,
  19677. emptyText,
  19678. toggleLastOptionHitState,
  19679. resetInputState,
  19680. handleComposition,
  19681. handleMenuEnter,
  19682. handleFocus,
  19683. blur,
  19684. handleBlur,
  19685. handleClearClick,
  19686. handleClose,
  19687. toggleMenu,
  19688. selectOption,
  19689. getValueKey,
  19690. navigateOptions,
  19691. dropMenuVisible,
  19692. focus,
  19693. reference: reference2,
  19694. input,
  19695. tooltipRef,
  19696. popperPaneRef,
  19697. tags,
  19698. selectWrapper,
  19699. scrollbar,
  19700. wrapperKls,
  19701. selectTagsStyle,
  19702. compatTeleported,
  19703. nsSelect
  19704. };
  19705. }
  19706. });
  19707. const _hoisted_1$g = { class: "select-trigger" };
  19708. const _hoisted_2$e = ["disabled", "autocomplete"];
  19709. const _hoisted_3$9 = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  19710. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  19711. const _component_el_tag = resolveComponent("el-tag");
  19712. const _component_el_tooltip = resolveComponent("el-tooltip");
  19713. const _component_el_icon = resolveComponent("el-icon");
  19714. const _component_el_input = resolveComponent("el-input");
  19715. const _component_el_option = resolveComponent("el-option");
  19716. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  19717. const _component_el_select_menu = resolveComponent("el-select-menu");
  19718. const _directive_click_outside = resolveDirective("click-outside");
  19719. return withDirectives((openBlock(), createElementBlock("div", {
  19720. ref: "selectWrapper",
  19721. class: normalizeClass(_ctx.wrapperKls),
  19722. onClick: _cache[24] || (_cache[24] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  19723. }, [
  19724. createVNode(_component_el_tooltip, {
  19725. ref: "tooltipRef",
  19726. visible: _ctx.dropMenuVisible,
  19727. "onUpdate:visible": _cache[23] || (_cache[23] = ($event) => _ctx.dropMenuVisible = $event),
  19728. placement: "bottom-start",
  19729. teleported: _ctx.compatTeleported,
  19730. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  19731. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  19732. effect: _ctx.effect,
  19733. pure: "",
  19734. trigger: "click",
  19735. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  19736. "stop-popper-mouse-event": false,
  19737. "gpu-acceleration": false,
  19738. persistent: _ctx.persistent,
  19739. onShow: _ctx.handleMenuEnter
  19740. }, {
  19741. default: withCtx(() => [
  19742. createElementVNode("div", _hoisted_1$g, [
  19743. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  19744. key: 0,
  19745. ref: "tags",
  19746. class: normalizeClass(_ctx.nsSelect.e("tags")),
  19747. style: normalizeStyle(_ctx.selectTagsStyle)
  19748. }, [
  19749. _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createElementBlock("span", {
  19750. key: 0,
  19751. class: normalizeClass([
  19752. _ctx.nsSelect.b("tags-wrapper"),
  19753. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  19754. ])
  19755. }, [
  19756. createVNode(_component_el_tag, {
  19757. closable: !_ctx.selectDisabled && !_ctx.selected[0].isDisabled,
  19758. size: _ctx.collapseTagSize,
  19759. hit: _ctx.selected[0].hitState,
  19760. type: _ctx.tagType,
  19761. "disable-transitions": "",
  19762. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.selected[0]))
  19763. }, {
  19764. default: withCtx(() => [
  19765. createElementVNode("span", {
  19766. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  19767. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 123 + "px" })
  19768. }, toDisplayString(_ctx.selected[0].currentLabel), 7)
  19769. ]),
  19770. _: 1
  19771. }, 8, ["closable", "size", "hit", "type"]),
  19772. _ctx.selected.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
  19773. key: 0,
  19774. closable: false,
  19775. size: _ctx.collapseTagSize,
  19776. type: _ctx.tagType,
  19777. "disable-transitions": ""
  19778. }, {
  19779. default: withCtx(() => [
  19780. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  19781. key: 0,
  19782. disabled: _ctx.dropMenuVisible,
  19783. "fallback-placements": ["bottom", "top", "right", "left"],
  19784. effect: _ctx.effect,
  19785. placement: "bottom",
  19786. teleported: false
  19787. }, {
  19788. default: withCtx(() => [
  19789. createElementVNode("span", {
  19790. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  19791. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3)
  19792. ]),
  19793. content: withCtx(() => [
  19794. createElementVNode("div", {
  19795. class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  19796. }, [
  19797. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item, idx) => {
  19798. return openBlock(), createElementBlock("div", {
  19799. key: idx,
  19800. class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  19801. }, [
  19802. (openBlock(), createBlock(_component_el_tag, {
  19803. key: _ctx.getValueKey(item),
  19804. class: "in-tooltip",
  19805. closable: !_ctx.selectDisabled && !item.isDisabled,
  19806. size: _ctx.collapseTagSize,
  19807. hit: item.hitState,
  19808. type: _ctx.tagType,
  19809. "disable-transitions": "",
  19810. style: { margin: "2px" },
  19811. onClose: ($event) => _ctx.deleteTag($event, item)
  19812. }, {
  19813. default: withCtx(() => [
  19814. createElementVNode("span", {
  19815. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  19816. style: normalizeStyle({
  19817. maxWidth: _ctx.inputWidth - 75 + "px"
  19818. })
  19819. }, toDisplayString(item.currentLabel), 7)
  19820. ]),
  19821. _: 2
  19822. }, 1032, ["closable", "size", "hit", "type", "onClose"]))
  19823. ], 2);
  19824. }), 128))
  19825. ], 2)
  19826. ]),
  19827. _: 1
  19828. }, 8, ["disabled", "effect"])) : (openBlock(), createElementBlock("span", {
  19829. key: 1,
  19830. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  19831. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3))
  19832. ]),
  19833. _: 1
  19834. }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
  19835. ], 2)) : createCommentVNode("v-if", true),
  19836. createCommentVNode(" <div> "),
  19837. !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
  19838. key: 1,
  19839. onAfterLeave: _ctx.resetInputHeight
  19840. }, {
  19841. default: withCtx(() => [
  19842. createElementVNode("span", {
  19843. class: normalizeClass([
  19844. _ctx.nsSelect.b("tags-wrapper"),
  19845. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  19846. ])
  19847. }, [
  19848. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
  19849. return openBlock(), createBlock(_component_el_tag, {
  19850. key: _ctx.getValueKey(item),
  19851. closable: !_ctx.selectDisabled && !item.isDisabled,
  19852. size: _ctx.collapseTagSize,
  19853. hit: item.hitState,
  19854. type: _ctx.tagType,
  19855. "disable-transitions": "",
  19856. onClose: ($event) => _ctx.deleteTag($event, item)
  19857. }, {
  19858. default: withCtx(() => [
  19859. createElementVNode("span", {
  19860. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  19861. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  19862. }, toDisplayString(item.currentLabel), 7)
  19863. ]),
  19864. _: 2
  19865. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  19866. }), 128))
  19867. ], 2)
  19868. ]),
  19869. _: 1
  19870. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  19871. createCommentVNode(" </div> "),
  19872. _ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
  19873. key: 2,
  19874. ref: "input",
  19875. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.query = $event),
  19876. type: "text",
  19877. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  19878. disabled: _ctx.selectDisabled,
  19879. autocomplete: _ctx.autocomplete,
  19880. style: normalizeStyle({
  19881. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  19882. flexGrow: 1,
  19883. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  19884. maxWidth: `${_ctx.inputWidth - 42}px`
  19885. }),
  19886. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  19887. onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  19888. onKeyup: _cache[4] || (_cache[4] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  19889. onKeydown: [
  19890. _cache[5] || (_cache[5] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  19891. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  19892. _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  19893. _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  19894. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  19895. _cache[10] || (_cache[10] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  19896. _cache[11] || (_cache[11] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  19897. ],
  19898. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  19899. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  19900. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  19901. onInput: _cache[15] || (_cache[15] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  19902. }, null, 46, _hoisted_2$e)), [
  19903. [vModelText, _ctx.query]
  19904. ]) : createCommentVNode("v-if", true)
  19905. ], 6)) : createCommentVNode("v-if", true),
  19906. createVNode(_component_el_input, {
  19907. id: _ctx.id,
  19908. ref: "reference",
  19909. modelValue: _ctx.selectedLabel,
  19910. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.selectedLabel = $event),
  19911. type: "text",
  19912. placeholder: _ctx.currentPlaceholder,
  19913. name: _ctx.name,
  19914. autocomplete: _ctx.autocomplete,
  19915. size: _ctx.selectSize,
  19916. disabled: _ctx.selectDisabled,
  19917. readonly: _ctx.readonly,
  19918. "validate-event": false,
  19919. class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  19920. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  19921. onFocus: _ctx.handleFocus,
  19922. onBlur: _ctx.handleBlur,
  19923. onInput: _ctx.debouncedOnInputChange,
  19924. onPaste: _ctx.debouncedOnInputChange,
  19925. onCompositionstart: _ctx.handleComposition,
  19926. onCompositionupdate: _ctx.handleComposition,
  19927. onCompositionend: _ctx.handleComposition,
  19928. onKeydown: [
  19929. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  19930. _cache[18] || (_cache[18] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  19931. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  19932. _cache[19] || (_cache[19] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  19933. _cache[20] || (_cache[20] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  19934. ],
  19935. onMouseenter: _cache[21] || (_cache[21] = ($event) => _ctx.inputHovering = true),
  19936. onMouseleave: _cache[22] || (_cache[22] = ($event) => _ctx.inputHovering = false)
  19937. }, createSlots({
  19938. suffix: withCtx(() => [
  19939. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  19940. key: 0,
  19941. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  19942. }, {
  19943. default: withCtx(() => [
  19944. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  19945. ]),
  19946. _: 1
  19947. }, 8, ["class"])) : createCommentVNode("v-if", true),
  19948. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  19949. key: 1,
  19950. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  19951. onClick: _ctx.handleClearClick
  19952. }, {
  19953. default: withCtx(() => [
  19954. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  19955. ]),
  19956. _: 1
  19957. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  19958. ]),
  19959. _: 2
  19960. }, [
  19961. _ctx.$slots.prefix ? {
  19962. name: "prefix",
  19963. fn: withCtx(() => [
  19964. createElementVNode("div", _hoisted_3$9, [
  19965. renderSlot(_ctx.$slots, "prefix")
  19966. ])
  19967. ])
  19968. } : void 0
  19969. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  19970. ])
  19971. ]),
  19972. content: withCtx(() => [
  19973. createVNode(_component_el_select_menu, null, {
  19974. default: withCtx(() => [
  19975. withDirectives(createVNode(_component_el_scrollbar, {
  19976. ref: "scrollbar",
  19977. tag: "ul",
  19978. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  19979. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  19980. class: normalizeClass([
  19981. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  19982. ])
  19983. }, {
  19984. default: withCtx(() => [
  19985. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  19986. key: 0,
  19987. value: _ctx.query,
  19988. created: true
  19989. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  19990. renderSlot(_ctx.$slots, "default")
  19991. ]),
  19992. _: 3
  19993. }, 8, ["wrap-class", "view-class", "class"]), [
  19994. [vShow, _ctx.options.size > 0 && !_ctx.loading]
  19995. ]),
  19996. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  19997. _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
  19998. key: 1,
  19999. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  20000. }, toDisplayString(_ctx.emptyText), 3))
  20001. ], 2112)) : createCommentVNode("v-if", true)
  20002. ]),
  20003. _: 3
  20004. })
  20005. ]),
  20006. _: 3
  20007. }, 8, ["visible", "teleported", "popper-class", "effect", "transition", "persistent", "onShow"])
  20008. ], 2)), [
  20009. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  20010. ]);
  20011. }
  20012. var Select = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["render", _sfc_render$a], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);
  20013. const _sfc_main$m = defineComponent({
  20014. name: "ElOptionGroup",
  20015. componentName: "ElOptionGroup",
  20016. props: {
  20017. label: String,
  20018. disabled: {
  20019. type: Boolean,
  20020. default: false
  20021. }
  20022. },
  20023. setup(props) {
  20024. const ns = useNamespace("select");
  20025. const visible = ref(true);
  20026. const instance = getCurrentInstance();
  20027. const children = ref([]);
  20028. provide(selectGroupKey, reactive(__spreadValues({}, toRefs(props))));
  20029. const select = inject(selectKey);
  20030. onMounted(() => {
  20031. children.value = flattedChildren(instance.subTree);
  20032. });
  20033. const flattedChildren = (node) => {
  20034. const children2 = [];
  20035. if (Array.isArray(node.children)) {
  20036. node.children.forEach((child) => {
  20037. var _a2;
  20038. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  20039. children2.push(child.component.proxy);
  20040. } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
  20041. children2.push(...flattedChildren(child));
  20042. }
  20043. });
  20044. }
  20045. return children2;
  20046. };
  20047. const { groupQueryChange } = toRaw(select);
  20048. watch(groupQueryChange, () => {
  20049. visible.value = children.value.some((option) => option.visible === true);
  20050. });
  20051. return {
  20052. visible,
  20053. ns
  20054. };
  20055. }
  20056. });
  20057. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  20058. return withDirectives((openBlock(), createElementBlock("ul", {
  20059. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  20060. }, [
  20061. createElementVNode("li", {
  20062. class: normalizeClass(_ctx.ns.be("group", "title"))
  20063. }, toDisplayString(_ctx.label), 3),
  20064. createElementVNode("li", null, [
  20065. createElementVNode("ul", {
  20066. class: normalizeClass(_ctx.ns.b("group"))
  20067. }, [
  20068. renderSlot(_ctx.$slots, "default")
  20069. ], 2)
  20070. ])
  20071. ], 2)), [
  20072. [vShow, _ctx.visible]
  20073. ]);
  20074. }
  20075. var OptionGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["render", _sfc_render$9], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);
  20076. const ElSelect = withInstall(Select, {
  20077. Option,
  20078. OptionGroup
  20079. });
  20080. const ElOption = withNoopInstall(Option);
  20081. withNoopInstall(OptionGroup);
  20082. const progressProps = buildProps({
  20083. type: {
  20084. type: String,
  20085. default: "line",
  20086. values: ["line", "circle", "dashboard"]
  20087. },
  20088. percentage: {
  20089. type: Number,
  20090. default: 0,
  20091. validator: (val) => val >= 0 && val <= 100
  20092. },
  20093. status: {
  20094. type: String,
  20095. default: "",
  20096. values: ["", "success", "exception", "warning"]
  20097. },
  20098. indeterminate: {
  20099. type: Boolean,
  20100. default: false
  20101. },
  20102. duration: {
  20103. type: Number,
  20104. default: 3
  20105. },
  20106. strokeWidth: {
  20107. type: Number,
  20108. default: 6
  20109. },
  20110. strokeLinecap: {
  20111. type: definePropType(String),
  20112. default: "round"
  20113. },
  20114. textInside: {
  20115. type: Boolean,
  20116. default: false
  20117. },
  20118. width: {
  20119. type: Number,
  20120. default: 126
  20121. },
  20122. showText: {
  20123. type: Boolean,
  20124. default: true
  20125. },
  20126. color: {
  20127. type: definePropType([
  20128. String,
  20129. Array,
  20130. Function
  20131. ]),
  20132. default: ""
  20133. },
  20134. format: {
  20135. type: definePropType(Function),
  20136. default: (percentage) => `${percentage}%`
  20137. }
  20138. });
  20139. const _sfc_main$l = defineComponent({
  20140. name: "ElProgress",
  20141. components: {
  20142. ElIcon,
  20143. CircleCheck: circleCheck,
  20144. CircleClose: circleClose,
  20145. Check: check,
  20146. Close: close,
  20147. WarningFilled: warningFilled
  20148. },
  20149. props: progressProps,
  20150. setup(props) {
  20151. const ns = useNamespace("progress");
  20152. const barStyle = computed(() => ({
  20153. width: `${props.percentage}%`,
  20154. animationDuration: `${props.duration}s`,
  20155. backgroundColor: getCurrentColor(props.percentage)
  20156. }));
  20157. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  20158. const radius = computed(() => {
  20159. if (props.type === "circle" || props.type === "dashboard") {
  20160. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  20161. } else {
  20162. return 0;
  20163. }
  20164. });
  20165. const trackPath = computed(() => {
  20166. const r = radius.value;
  20167. const isDashboard = props.type === "dashboard";
  20168. return `
  20169. M 50 50
  20170. m 0 ${isDashboard ? "" : "-"}${r}
  20171. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  20172. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  20173. `;
  20174. });
  20175. const perimeter = computed(() => 2 * Math.PI * radius.value);
  20176. const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
  20177. const strokeDashoffset = computed(() => {
  20178. const offset2 = -1 * perimeter.value * (1 - rate.value) / 2;
  20179. return `${offset2}px`;
  20180. });
  20181. const trailPathStyle = computed(() => ({
  20182. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  20183. strokeDashoffset: strokeDashoffset.value
  20184. }));
  20185. const circlePathStyle = computed(() => ({
  20186. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  20187. strokeDashoffset: strokeDashoffset.value,
  20188. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"
  20189. }));
  20190. const stroke = computed(() => {
  20191. let ret;
  20192. if (props.color) {
  20193. ret = getCurrentColor(props.percentage);
  20194. } else {
  20195. switch (props.status) {
  20196. case "success":
  20197. ret = "#13ce66";
  20198. break;
  20199. case "exception":
  20200. ret = "#ff4949";
  20201. break;
  20202. case "warning":
  20203. ret = "#e6a23c";
  20204. break;
  20205. default:
  20206. ret = "#20a0ff";
  20207. }
  20208. }
  20209. return ret;
  20210. });
  20211. const statusIcon = computed(() => {
  20212. if (props.status === "warning") {
  20213. return warningFilled;
  20214. }
  20215. if (props.type === "line") {
  20216. return props.status === "success" ? circleCheck : circleClose;
  20217. } else {
  20218. return props.status === "success" ? check : close;
  20219. }
  20220. });
  20221. const progressTextSize = computed(() => {
  20222. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  20223. });
  20224. const content2 = computed(() => props.format(props.percentage));
  20225. const getCurrentColor = (percentage) => {
  20226. var _a2;
  20227. const { color } = props;
  20228. if (typeof color === "function") {
  20229. return color(percentage);
  20230. } else if (typeof color === "string") {
  20231. return color;
  20232. } else {
  20233. const span = 100 / color.length;
  20234. const seriesColors = color.map((seriesColor, index) => {
  20235. if (typeof seriesColor === "string") {
  20236. return {
  20237. color: seriesColor,
  20238. percentage: (index + 1) * span
  20239. };
  20240. }
  20241. return seriesColor;
  20242. });
  20243. const colors = seriesColors.sort((a2, b2) => a2.percentage - b2.percentage);
  20244. for (const color2 of colors) {
  20245. if (color2.percentage > percentage)
  20246. return color2.color;
  20247. }
  20248. return (_a2 = colors[colors.length - 1]) == null ? void 0 : _a2.color;
  20249. }
  20250. };
  20251. const slotData = computed(() => {
  20252. return {
  20253. percentage: props.percentage
  20254. };
  20255. });
  20256. return {
  20257. ns,
  20258. barStyle,
  20259. relativeStrokeWidth,
  20260. radius,
  20261. trackPath,
  20262. perimeter,
  20263. rate,
  20264. strokeDashoffset,
  20265. trailPathStyle,
  20266. circlePathStyle,
  20267. stroke,
  20268. statusIcon,
  20269. progressTextSize,
  20270. content: content2,
  20271. slotData
  20272. };
  20273. }
  20274. });
  20275. const _hoisted_1$f = ["aria-valuenow"];
  20276. const _hoisted_2$d = { viewBox: "0 0 100 100" };
  20277. const _hoisted_3$8 = ["d", "stroke-width"];
  20278. const _hoisted_4$7 = ["d", "stroke", "stroke-linecap", "stroke-width"];
  20279. const _hoisted_5$7 = { key: 0 };
  20280. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  20281. const _component_el_icon = resolveComponent("el-icon");
  20282. return openBlock(), createElementBlock("div", {
  20283. class: normalizeClass([
  20284. _ctx.ns.b(),
  20285. _ctx.ns.m(_ctx.type),
  20286. _ctx.ns.is(_ctx.status),
  20287. {
  20288. [_ctx.ns.m("without-text")]: !_ctx.showText,
  20289. [_ctx.ns.m("text-inside")]: _ctx.textInside
  20290. }
  20291. ]),
  20292. role: "progressbar",
  20293. "aria-valuenow": _ctx.percentage,
  20294. "aria-valuemin": "0",
  20295. "aria-valuemax": "100"
  20296. }, [
  20297. _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
  20298. key: 0,
  20299. class: normalizeClass(_ctx.ns.b("bar"))
  20300. }, [
  20301. createElementVNode("div", {
  20302. class: normalizeClass(_ctx.ns.be("bar", "outer")),
  20303. style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  20304. }, [
  20305. createElementVNode("div", {
  20306. class: normalizeClass([
  20307. _ctx.ns.be("bar", "inner"),
  20308. { [_ctx.ns.bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }
  20309. ]),
  20310. style: normalizeStyle(_ctx.barStyle)
  20311. }, [
  20312. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
  20313. key: 0,
  20314. class: normalizeClass(_ctx.ns.be("bar", "innerText"))
  20315. }, [
  20316. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20317. createElementVNode("span", null, toDisplayString(_ctx.content), 1)
  20318. ])
  20319. ], 2)) : createCommentVNode("v-if", true)
  20320. ], 6)
  20321. ], 6)
  20322. ], 2)) : (openBlock(), createElementBlock("div", {
  20323. key: 1,
  20324. class: normalizeClass(_ctx.ns.b("circle")),
  20325. style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  20326. }, [
  20327. (openBlock(), createElementBlock("svg", _hoisted_2$d, [
  20328. createElementVNode("path", {
  20329. class: normalizeClass(_ctx.ns.be("circle", "track")),
  20330. d: _ctx.trackPath,
  20331. stroke: "var(--el-fill-color-light, #e5e9f2)",
  20332. "stroke-width": _ctx.relativeStrokeWidth,
  20333. fill: "none",
  20334. style: normalizeStyle(_ctx.trailPathStyle)
  20335. }, null, 14, _hoisted_3$8),
  20336. createElementVNode("path", {
  20337. class: normalizeClass(_ctx.ns.be("circle", "path")),
  20338. d: _ctx.trackPath,
  20339. stroke: _ctx.stroke,
  20340. fill: "none",
  20341. "stroke-linecap": _ctx.strokeLinecap,
  20342. "stroke-width": _ctx.percentage ? _ctx.relativeStrokeWidth : 0,
  20343. style: normalizeStyle(_ctx.circlePathStyle)
  20344. }, null, 14, _hoisted_4$7)
  20345. ]))
  20346. ], 6)),
  20347. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
  20348. key: 2,
  20349. class: normalizeClass(_ctx.ns.e("text")),
  20350. style: normalizeStyle({ fontSize: `${_ctx.progressTextSize}px` })
  20351. }, [
  20352. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20353. !_ctx.status ? (openBlock(), createElementBlock("span", _hoisted_5$7, toDisplayString(_ctx.content), 1)) : (openBlock(), createBlock(_component_el_icon, { key: 1 }, {
  20354. default: withCtx(() => [
  20355. (openBlock(), createBlock(resolveDynamicComponent(_ctx.statusIcon)))
  20356. ]),
  20357. _: 1
  20358. }))
  20359. ])
  20360. ], 6)) : createCommentVNode("v-if", true)
  20361. ], 10, _hoisted_1$f);
  20362. }
  20363. var Progress = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$8], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/progress/src/progress.vue"]]);
  20364. const ElProgress = withInstall(Progress);
  20365. const rateProps = buildProps({
  20366. modelValue: {
  20367. type: Number,
  20368. default: 0
  20369. },
  20370. lowThreshold: {
  20371. type: Number,
  20372. default: 2
  20373. },
  20374. highThreshold: {
  20375. type: Number,
  20376. default: 4
  20377. },
  20378. max: {
  20379. type: Number,
  20380. default: 5
  20381. },
  20382. colors: {
  20383. type: definePropType([Array, Object]),
  20384. default: () => mutable(["", "", ""])
  20385. },
  20386. voidColor: {
  20387. type: String,
  20388. default: ""
  20389. },
  20390. disabledVoidColor: {
  20391. type: String,
  20392. default: ""
  20393. },
  20394. icons: {
  20395. type: definePropType([Array, Object]),
  20396. default: () => [starFilled, starFilled, starFilled]
  20397. },
  20398. voidIcon: {
  20399. type: iconPropType,
  20400. default: () => star
  20401. },
  20402. disabledVoidIcon: {
  20403. type: iconPropType,
  20404. default: () => starFilled
  20405. },
  20406. disabled: {
  20407. type: Boolean,
  20408. default: false
  20409. },
  20410. allowHalf: {
  20411. type: Boolean,
  20412. default: false
  20413. },
  20414. showText: {
  20415. type: Boolean,
  20416. default: false
  20417. },
  20418. showScore: {
  20419. type: Boolean,
  20420. default: false
  20421. },
  20422. textColor: {
  20423. type: String,
  20424. default: ""
  20425. },
  20426. texts: {
  20427. type: definePropType(Array),
  20428. default: () => mutable([
  20429. "Extremely bad",
  20430. "Disappointed",
  20431. "Fair",
  20432. "Satisfied",
  20433. "Surprise"
  20434. ])
  20435. },
  20436. scoreTemplate: {
  20437. type: String,
  20438. default: "{value}"
  20439. },
  20440. size: {
  20441. type: String,
  20442. validator: isValidComponentSize
  20443. }
  20444. });
  20445. const rateEmits = {
  20446. change: (value) => typeof value === "number",
  20447. [UPDATE_MODEL_EVENT]: (value) => typeof value === "number"
  20448. };
  20449. const _hoisted_1$e = ["aria-valuenow", "aria-valuetext", "aria-valuemax"];
  20450. const _hoisted_2$c = ["onMousemove", "onClick"];
  20451. const __default__$5 = {
  20452. name: "ElRate"
  20453. };
  20454. const _sfc_main$k = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
  20455. props: rateProps,
  20456. emits: rateEmits,
  20457. setup(__props, { expose, emit }) {
  20458. const props = __props;
  20459. function getValueFromMap(value, map) {
  20460. const isExcludedObject = (val) => isObject$1(val);
  20461. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  20462. const val = map[key];
  20463. const excluded = isExcludedObject(val) ? val.excluded : false;
  20464. return excluded ? value < key : value <= key;
  20465. }).sort((a2, b2) => a2 - b2);
  20466. const matchedValue = map[matchedKeys[0]];
  20467. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  20468. }
  20469. const formContext = inject(formContextKey, void 0);
  20470. const rateSize = useSize();
  20471. const ns = useNamespace("rate");
  20472. const currentValue = ref(props.modelValue);
  20473. const hoverIndex = ref(-1);
  20474. const pointerAtLeftHalf = ref(true);
  20475. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  20476. const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  20477. const rateStyles = computed(() => {
  20478. return {
  20479. "--el-rate-void-color": props.voidColor,
  20480. "--el-rate-disabled-void-color": props.disabledVoidColor,
  20481. "--el-rate-fill-color": activeColor.value
  20482. };
  20483. });
  20484. const text = computed(() => {
  20485. let result = "";
  20486. if (props.showScore) {
  20487. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  20488. } else if (props.showText) {
  20489. result = props.texts[Math.ceil(currentValue.value) - 1];
  20490. }
  20491. return result;
  20492. });
  20493. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  20494. const colorMap = computed(() => isArray(props.colors) ? {
  20495. [props.lowThreshold]: props.colors[0],
  20496. [props.highThreshold]: { value: props.colors[1], excluded: true },
  20497. [props.max]: props.colors[2]
  20498. } : props.colors);
  20499. const activeColor = computed(() => {
  20500. const color = getValueFromMap(currentValue.value, colorMap.value);
  20501. return isObject$1(color) ? "" : color;
  20502. });
  20503. const decimalStyle = computed(() => {
  20504. let width = "";
  20505. if (rateDisabled.value) {
  20506. width = `${valueDecimal.value}%`;
  20507. } else if (props.allowHalf) {
  20508. width = "50%";
  20509. }
  20510. return {
  20511. color: activeColor.value,
  20512. width
  20513. };
  20514. });
  20515. const componentMap = computed(() => isArray(props.icons) ? {
  20516. [props.lowThreshold]: props.icons[0],
  20517. [props.highThreshold]: {
  20518. value: props.icons[1],
  20519. excluded: true
  20520. },
  20521. [props.max]: props.icons[2]
  20522. } : props.icons);
  20523. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  20524. const voidComponent = computed(() => rateDisabled.value ? props.disabledVoidIcon : props.voidIcon);
  20525. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  20526. const iconComponents = computed(() => {
  20527. const result = Array.from({ length: props.max });
  20528. const threshold = currentValue.value;
  20529. result.fill(activeComponent.value, 0, threshold);
  20530. result.fill(voidComponent.value, threshold, props.max);
  20531. return result;
  20532. });
  20533. function showDecimalIcon(item) {
  20534. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  20535. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  20536. return showWhenDisabled || showWhenAllowHalf;
  20537. }
  20538. function selectValue(value) {
  20539. if (rateDisabled.value) {
  20540. return;
  20541. }
  20542. if (props.allowHalf && pointerAtLeftHalf.value) {
  20543. emit(UPDATE_MODEL_EVENT, currentValue.value);
  20544. if (props.modelValue !== currentValue.value) {
  20545. emit("change", currentValue.value);
  20546. }
  20547. } else {
  20548. emit(UPDATE_MODEL_EVENT, value);
  20549. if (props.modelValue !== value) {
  20550. emit("change", value);
  20551. }
  20552. }
  20553. }
  20554. function handleKey(e) {
  20555. if (rateDisabled.value) {
  20556. return;
  20557. }
  20558. let _currentValue = currentValue.value;
  20559. const code = e.code;
  20560. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  20561. if (props.allowHalf) {
  20562. _currentValue += 0.5;
  20563. } else {
  20564. _currentValue += 1;
  20565. }
  20566. e.stopPropagation();
  20567. e.preventDefault();
  20568. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  20569. if (props.allowHalf) {
  20570. _currentValue -= 0.5;
  20571. } else {
  20572. _currentValue -= 1;
  20573. }
  20574. e.stopPropagation();
  20575. e.preventDefault();
  20576. }
  20577. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  20578. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  20579. emit(UPDATE_MODEL_EVENT, _currentValue);
  20580. emit("change", _currentValue);
  20581. return _currentValue;
  20582. }
  20583. function setCurrentValue(value, event) {
  20584. if (rateDisabled.value) {
  20585. return;
  20586. }
  20587. if (props.allowHalf) {
  20588. let target = event.target;
  20589. if (hasClass(target, ns.e("item"))) {
  20590. target = target.querySelector(`.${ns.e("icon")}`);
  20591. }
  20592. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  20593. target = target.parentNode;
  20594. }
  20595. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  20596. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  20597. } else {
  20598. currentValue.value = value;
  20599. }
  20600. hoverIndex.value = value;
  20601. }
  20602. function resetCurrentValue() {
  20603. if (rateDisabled.value) {
  20604. return;
  20605. }
  20606. if (props.allowHalf) {
  20607. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20608. }
  20609. currentValue.value = props.modelValue;
  20610. hoverIndex.value = -1;
  20611. }
  20612. watch(() => props.modelValue, (val) => {
  20613. currentValue.value = val;
  20614. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20615. });
  20616. if (!props.modelValue) {
  20617. emit(UPDATE_MODEL_EVENT, 0);
  20618. }
  20619. expose({
  20620. setCurrentValue,
  20621. resetCurrentValue
  20622. });
  20623. return (_ctx, _cache) => {
  20624. return openBlock(), createElementBlock("div", {
  20625. class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
  20626. role: "slider",
  20627. "aria-valuenow": currentValue.value,
  20628. "aria-valuetext": unref(text),
  20629. "aria-valuemin": "0",
  20630. "aria-valuemax": _ctx.max,
  20631. tabindex: "0",
  20632. style: normalizeStyle(unref(rateStyles)),
  20633. onKeydown: handleKey
  20634. }, [
  20635. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
  20636. return openBlock(), createElementBlock("span", {
  20637. key,
  20638. class: normalizeClass(unref(ns).e("item")),
  20639. onMousemove: ($event) => setCurrentValue(item, $event),
  20640. onMouseleave: resetCurrentValue,
  20641. onClick: ($event) => selectValue(item)
  20642. }, [
  20643. createVNode(unref(ElIcon), {
  20644. class: normalizeClass([
  20645. unref(ns).e("icon"),
  20646. { hover: hoverIndex.value === item },
  20647. unref(ns).is("active", item <= currentValue.value)
  20648. ])
  20649. }, {
  20650. default: withCtx(() => [
  20651. !showDecimalIcon(item) ? (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponents)[item - 1]), { key: 0 })) : createCommentVNode("v-if", true),
  20652. showDecimalIcon(item) ? (openBlock(), createBlock(unref(ElIcon), {
  20653. key: 1,
  20654. style: normalizeStyle(unref(decimalStyle)),
  20655. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  20656. }, {
  20657. default: withCtx(() => [
  20658. (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
  20659. ]),
  20660. _: 1
  20661. }, 8, ["style", "class"])) : createCommentVNode("v-if", true)
  20662. ]),
  20663. _: 2
  20664. }, 1032, ["class"])
  20665. ], 42, _hoisted_2$c);
  20666. }), 128)),
  20667. _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
  20668. key: 0,
  20669. class: normalizeClass(unref(ns).e("text"))
  20670. }, toDisplayString(unref(text)), 3)) : createCommentVNode("v-if", true)
  20671. ], 46, _hoisted_1$e);
  20672. };
  20673. }
  20674. }));
  20675. var Rate = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/rate/src/rate.vue"]]);
  20676. const ElRate = withInstall(Rate);
  20677. const useTooltip = (props, formatTooltip, showTooltip) => {
  20678. const tooltip = ref(null);
  20679. const tooltipVisible = ref(false);
  20680. const enableFormat = computed(() => {
  20681. return formatTooltip.value instanceof Function;
  20682. });
  20683. const formatValue = computed(() => {
  20684. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  20685. });
  20686. const displayTooltip = debounce$1(() => {
  20687. showTooltip.value && (tooltipVisible.value = true);
  20688. }, 50);
  20689. const hideTooltip = debounce$1(() => {
  20690. showTooltip.value && (tooltipVisible.value = false);
  20691. }, 50);
  20692. return {
  20693. tooltip,
  20694. tooltipVisible,
  20695. formatValue,
  20696. displayTooltip,
  20697. hideTooltip
  20698. };
  20699. };
  20700. const useSliderButton = (props, initData, emit) => {
  20701. const {
  20702. disabled,
  20703. min: min2,
  20704. max: max2,
  20705. step,
  20706. showTooltip,
  20707. precision,
  20708. sliderSize,
  20709. formatTooltip,
  20710. emitChange,
  20711. resetSize,
  20712. updateDragging
  20713. } = inject("SliderProvider");
  20714. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  20715. const currentPosition = computed(() => {
  20716. return `${(props.modelValue - min2.value) / (max2.value - min2.value) * 100}%`;
  20717. });
  20718. const wrapperStyle = computed(() => {
  20719. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  20720. });
  20721. const handleMouseEnter = () => {
  20722. initData.hovering = true;
  20723. displayTooltip();
  20724. };
  20725. const handleMouseLeave = () => {
  20726. initData.hovering = false;
  20727. if (!initData.dragging) {
  20728. hideTooltip();
  20729. }
  20730. };
  20731. const onButtonDown = (event) => {
  20732. if (disabled.value)
  20733. return;
  20734. event.preventDefault();
  20735. onDragStart(event);
  20736. on(window, "mousemove", onDragging);
  20737. on(window, "touchmove", onDragging);
  20738. on(window, "mouseup", onDragEnd);
  20739. on(window, "touchend", onDragEnd);
  20740. on(window, "contextmenu", onDragEnd);
  20741. };
  20742. const onLeftKeyDown = () => {
  20743. if (disabled.value)
  20744. return;
  20745. initData.newPosition = Number.parseFloat(currentPosition.value) - step.value / (max2.value - min2.value) * 100;
  20746. setPosition(initData.newPosition);
  20747. emitChange();
  20748. };
  20749. const onRightKeyDown = () => {
  20750. if (disabled.value)
  20751. return;
  20752. initData.newPosition = Number.parseFloat(currentPosition.value) + step.value / (max2.value - min2.value) * 100;
  20753. setPosition(initData.newPosition);
  20754. emitChange();
  20755. };
  20756. const getClientXY = (event) => {
  20757. let clientX;
  20758. let clientY;
  20759. if (event.type.startsWith("touch")) {
  20760. clientY = event.touches[0].clientY;
  20761. clientX = event.touches[0].clientX;
  20762. } else {
  20763. clientY = event.clientY;
  20764. clientX = event.clientX;
  20765. }
  20766. return {
  20767. clientX,
  20768. clientY
  20769. };
  20770. };
  20771. const onDragStart = (event) => {
  20772. initData.dragging = true;
  20773. initData.isClick = true;
  20774. const { clientX, clientY } = getClientXY(event);
  20775. if (props.vertical) {
  20776. initData.startY = clientY;
  20777. } else {
  20778. initData.startX = clientX;
  20779. }
  20780. initData.startPosition = Number.parseFloat(currentPosition.value);
  20781. initData.newPosition = initData.startPosition;
  20782. };
  20783. const onDragging = (event) => {
  20784. if (initData.dragging) {
  20785. initData.isClick = false;
  20786. displayTooltip();
  20787. resetSize();
  20788. let diff;
  20789. const { clientX, clientY } = getClientXY(event);
  20790. if (props.vertical) {
  20791. initData.currentY = clientY;
  20792. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  20793. } else {
  20794. initData.currentX = clientX;
  20795. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  20796. }
  20797. initData.newPosition = initData.startPosition + diff;
  20798. setPosition(initData.newPosition);
  20799. }
  20800. };
  20801. const onDragEnd = () => {
  20802. if (initData.dragging) {
  20803. setTimeout(() => {
  20804. initData.dragging = false;
  20805. if (!initData.hovering) {
  20806. hideTooltip();
  20807. }
  20808. if (!initData.isClick) {
  20809. setPosition(initData.newPosition);
  20810. emitChange();
  20811. }
  20812. }, 0);
  20813. off(window, "mousemove", onDragging);
  20814. off(window, "touchmove", onDragging);
  20815. off(window, "mouseup", onDragEnd);
  20816. off(window, "touchend", onDragEnd);
  20817. off(window, "contextmenu", onDragEnd);
  20818. }
  20819. };
  20820. const setPosition = async (newPosition) => {
  20821. if (newPosition === null || Number.isNaN(+newPosition))
  20822. return;
  20823. if (newPosition < 0) {
  20824. newPosition = 0;
  20825. } else if (newPosition > 100) {
  20826. newPosition = 100;
  20827. }
  20828. const lengthPerStep = 100 / ((max2.value - min2.value) / step.value);
  20829. const steps = Math.round(newPosition / lengthPerStep);
  20830. let value = steps * lengthPerStep * (max2.value - min2.value) * 0.01 + min2.value;
  20831. value = Number.parseFloat(value.toFixed(precision.value));
  20832. emit(UPDATE_MODEL_EVENT, value);
  20833. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  20834. initData.oldValue = props.modelValue;
  20835. }
  20836. await nextTick();
  20837. initData.dragging && displayTooltip();
  20838. tooltip.value.updatePopper();
  20839. };
  20840. watch(() => initData.dragging, (val) => {
  20841. updateDragging(val);
  20842. });
  20843. return {
  20844. tooltip,
  20845. tooltipVisible,
  20846. showTooltip,
  20847. wrapperStyle,
  20848. formatValue,
  20849. handleMouseEnter,
  20850. handleMouseLeave,
  20851. onButtonDown,
  20852. onLeftKeyDown,
  20853. onRightKeyDown,
  20854. setPosition
  20855. };
  20856. };
  20857. const _sfc_main$j = defineComponent({
  20858. name: "ElSliderButton",
  20859. components: {
  20860. ElTooltip
  20861. },
  20862. props: {
  20863. modelValue: {
  20864. type: Number,
  20865. default: 0
  20866. },
  20867. vertical: {
  20868. type: Boolean,
  20869. default: false
  20870. },
  20871. tooltipClass: {
  20872. type: String,
  20873. default: ""
  20874. }
  20875. },
  20876. emits: [UPDATE_MODEL_EVENT],
  20877. setup(props, { emit }) {
  20878. const ns = useNamespace("slider");
  20879. const initData = reactive({
  20880. hovering: false,
  20881. dragging: false,
  20882. isClick: false,
  20883. startX: 0,
  20884. currentX: 0,
  20885. startY: 0,
  20886. currentY: 0,
  20887. startPosition: 0,
  20888. newPosition: 0,
  20889. oldValue: props.modelValue
  20890. });
  20891. const {
  20892. tooltip,
  20893. showTooltip,
  20894. tooltipVisible,
  20895. wrapperStyle,
  20896. formatValue,
  20897. handleMouseEnter,
  20898. handleMouseLeave,
  20899. onButtonDown,
  20900. onLeftKeyDown,
  20901. onRightKeyDown,
  20902. setPosition
  20903. } = useSliderButton(props, initData, emit);
  20904. const { hovering, dragging } = toRefs(initData);
  20905. return {
  20906. ns,
  20907. tooltip,
  20908. tooltipVisible,
  20909. showTooltip,
  20910. wrapperStyle,
  20911. formatValue,
  20912. handleMouseEnter,
  20913. handleMouseLeave,
  20914. onButtonDown,
  20915. onLeftKeyDown,
  20916. onRightKeyDown,
  20917. setPosition,
  20918. hovering,
  20919. dragging
  20920. };
  20921. }
  20922. });
  20923. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  20924. const _component_el_tooltip = resolveComponent("el-tooltip");
  20925. return openBlock(), createElementBlock("div", {
  20926. ref: "button",
  20927. class: normalizeClass([_ctx.ns.e("button-wrapper"), { hover: _ctx.hovering, dragging: _ctx.dragging }]),
  20928. style: normalizeStyle(_ctx.wrapperStyle),
  20929. tabindex: "0",
  20930. onMouseenter: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  20931. onMouseleave: _cache[2] || (_cache[2] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  20932. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  20933. onTouchstart: _cache[4] || (_cache[4] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  20934. onFocus: _cache[5] || (_cache[5] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  20935. onBlur: _cache[6] || (_cache[6] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  20936. onKeydown: [
  20937. _cache[7] || (_cache[7] = withKeys((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["left"])),
  20938. _cache[8] || (_cache[8] = withKeys((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["right"])),
  20939. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["prevent"]), ["down"])),
  20940. _cache[10] || (_cache[10] = withKeys(withModifiers((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["prevent"]), ["up"]))
  20941. ]
  20942. }, [
  20943. createVNode(_component_el_tooltip, {
  20944. ref: "tooltip",
  20945. visible: _ctx.tooltipVisible,
  20946. "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.tooltipVisible = $event),
  20947. placement: "top",
  20948. "stop-popper-mouse-event": false,
  20949. "popper-class": _ctx.tooltipClass,
  20950. disabled: !_ctx.showTooltip,
  20951. persistent: ""
  20952. }, {
  20953. content: withCtx(() => [
  20954. createElementVNode("span", null, toDisplayString(_ctx.formatValue), 1)
  20955. ]),
  20956. default: withCtx(() => [
  20957. createElementVNode("div", {
  20958. class: normalizeClass([_ctx.ns.e("button"), { hover: _ctx.hovering, dragging: _ctx.dragging }])
  20959. }, null, 2)
  20960. ]),
  20961. _: 1
  20962. }, 8, ["visible", "popper-class", "disabled"])
  20963. ], 38);
  20964. }
  20965. var SliderButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["render", _sfc_render$7], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/button.vue"]]);
  20966. const _sfc_main$i = defineComponent({
  20967. name: "ElMarker",
  20968. props: {
  20969. mark: {
  20970. type: [String, Object],
  20971. default: () => void 0
  20972. }
  20973. },
  20974. setup(props) {
  20975. const ns = useNamespace("slider");
  20976. const label = computed(() => {
  20977. return typeof props.mark === "string" ? props.mark : props.mark.label;
  20978. });
  20979. return {
  20980. ns,
  20981. label
  20982. };
  20983. },
  20984. render() {
  20985. var _a2;
  20986. return h$1("div", {
  20987. class: this.ns.e("marks-text"),
  20988. style: (_a2 = this.mark) == null ? void 0 : _a2.style
  20989. }, this.label);
  20990. }
  20991. });
  20992. var SliderMarker = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/marker.vue"]]);
  20993. const useMarks = (props) => {
  20994. return computed(() => {
  20995. if (!props.marks) {
  20996. return [];
  20997. }
  20998. const marksKeys = Object.keys(props.marks);
  20999. return marksKeys.map(parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  21000. point,
  21001. position: (point - props.min) * 100 / (props.max - props.min),
  21002. mark: props.marks[point]
  21003. }));
  21004. });
  21005. };
  21006. const useSlide = (props, initData, emit) => {
  21007. const elForm2 = inject(formContextKey, {});
  21008. const elFormItem2 = inject(formItemContextKey, {});
  21009. const slider = shallowRef(null);
  21010. const firstButton = ref(null);
  21011. const secondButton = ref(null);
  21012. const buttonRefs = {
  21013. firstButton,
  21014. secondButton
  21015. };
  21016. const sliderDisabled = computed(() => {
  21017. return props.disabled || elForm2.disabled || false;
  21018. });
  21019. const minValue = computed(() => {
  21020. return Math.min(initData.firstValue, initData.secondValue);
  21021. });
  21022. const maxValue = computed(() => {
  21023. return Math.max(initData.firstValue, initData.secondValue);
  21024. });
  21025. const barSize = computed(() => {
  21026. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  21027. });
  21028. const barStart = computed(() => {
  21029. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  21030. });
  21031. const runwayStyle = computed(() => {
  21032. return props.vertical ? { height: props.height } : {};
  21033. });
  21034. const barStyle = computed(() => {
  21035. return props.vertical ? {
  21036. height: barSize.value,
  21037. bottom: barStart.value
  21038. } : {
  21039. width: barSize.value,
  21040. left: barStart.value
  21041. };
  21042. });
  21043. const resetSize = () => {
  21044. if (slider.value) {
  21045. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  21046. }
  21047. };
  21048. const setPosition = (percent) => {
  21049. const targetValue = props.min + percent * (props.max - props.min) / 100;
  21050. if (!props.range) {
  21051. firstButton.value.setPosition(percent);
  21052. return;
  21053. }
  21054. let buttonRefName;
  21055. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  21056. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  21057. } else {
  21058. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  21059. }
  21060. buttonRefs[buttonRefName].value.setPosition(percent);
  21061. };
  21062. const setFirstValue = (firstValue) => {
  21063. initData.firstValue = firstValue;
  21064. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  21065. };
  21066. const setSecondValue = (secondValue) => {
  21067. initData.secondValue = secondValue;
  21068. if (props.range) {
  21069. _emit([minValue.value, maxValue.value]);
  21070. }
  21071. };
  21072. const _emit = (val) => {
  21073. emit(UPDATE_MODEL_EVENT, val);
  21074. emit(INPUT_EVENT, val);
  21075. };
  21076. const emitChange = async () => {
  21077. await nextTick();
  21078. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  21079. };
  21080. const onSliderClick = (event) => {
  21081. if (sliderDisabled.value || initData.dragging)
  21082. return;
  21083. resetSize();
  21084. if (props.vertical) {
  21085. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  21086. setPosition((sliderOffsetBottom - event.clientY) / initData.sliderSize * 100);
  21087. } else {
  21088. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  21089. setPosition((event.clientX - sliderOffsetLeft) / initData.sliderSize * 100);
  21090. }
  21091. emitChange();
  21092. };
  21093. return {
  21094. elFormItem: elFormItem2,
  21095. slider,
  21096. firstButton,
  21097. secondButton,
  21098. sliderDisabled,
  21099. minValue,
  21100. maxValue,
  21101. runwayStyle,
  21102. barStyle,
  21103. resetSize,
  21104. setPosition,
  21105. emitChange,
  21106. onSliderClick,
  21107. setFirstValue,
  21108. setSecondValue
  21109. };
  21110. };
  21111. const useStops = (props, initData, minValue, maxValue) => {
  21112. const stops = computed(() => {
  21113. if (!props.showStops || props.min > props.max)
  21114. return [];
  21115. if (props.step === 0) {
  21116. return [];
  21117. }
  21118. const stopCount = (props.max - props.min) / props.step;
  21119. const stepWidth = 100 * props.step / (props.max - props.min);
  21120. const result = Array.from({ length: stopCount - 1 }).map((_2, index) => (index + 1) * stepWidth);
  21121. if (props.range) {
  21122. return result.filter((step) => {
  21123. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  21124. });
  21125. } else {
  21126. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  21127. }
  21128. });
  21129. const getStopStyle = (position) => {
  21130. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  21131. };
  21132. return {
  21133. stops,
  21134. getStopStyle
  21135. };
  21136. };
  21137. const _sfc_main$h = defineComponent({
  21138. name: "ElSlider",
  21139. components: {
  21140. ElInputNumber,
  21141. SliderButton,
  21142. SliderMarker
  21143. },
  21144. props: {
  21145. modelValue: {
  21146. type: [Number, Array],
  21147. default: 0
  21148. },
  21149. min: {
  21150. type: Number,
  21151. default: 0
  21152. },
  21153. max: {
  21154. type: Number,
  21155. default: 100
  21156. },
  21157. step: {
  21158. type: Number,
  21159. default: 1
  21160. },
  21161. showInput: {
  21162. type: Boolean,
  21163. default: false
  21164. },
  21165. showInputControls: {
  21166. type: Boolean,
  21167. default: true
  21168. },
  21169. size: {
  21170. type: String,
  21171. validator: isValidComponentSize
  21172. },
  21173. inputSize: {
  21174. type: String,
  21175. validator: isValidComponentSize
  21176. },
  21177. showStops: {
  21178. type: Boolean,
  21179. default: false
  21180. },
  21181. showTooltip: {
  21182. type: Boolean,
  21183. default: true
  21184. },
  21185. formatTooltip: {
  21186. type: Function,
  21187. default: void 0
  21188. },
  21189. disabled: {
  21190. type: Boolean,
  21191. default: false
  21192. },
  21193. range: {
  21194. type: Boolean,
  21195. default: false
  21196. },
  21197. vertical: {
  21198. type: Boolean,
  21199. default: false
  21200. },
  21201. height: {
  21202. type: String,
  21203. default: ""
  21204. },
  21205. debounce: {
  21206. type: Number,
  21207. default: 300
  21208. },
  21209. label: {
  21210. type: String,
  21211. default: void 0
  21212. },
  21213. tooltipClass: {
  21214. type: String,
  21215. default: void 0
  21216. },
  21217. marks: Object
  21218. },
  21219. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT],
  21220. setup(props, { emit }) {
  21221. const ns = useNamespace("slider");
  21222. const initData = reactive({
  21223. firstValue: 0,
  21224. secondValue: 0,
  21225. oldValue: 0,
  21226. dragging: false,
  21227. sliderSize: 1
  21228. });
  21229. const {
  21230. elFormItem: elFormItem2,
  21231. slider,
  21232. firstButton,
  21233. secondButton,
  21234. sliderDisabled,
  21235. minValue,
  21236. maxValue,
  21237. runwayStyle,
  21238. barStyle,
  21239. resetSize,
  21240. emitChange,
  21241. onSliderClick,
  21242. setFirstValue,
  21243. setSecondValue
  21244. } = useSlide(props, initData, emit);
  21245. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  21246. const sliderWrapperSize = useSize();
  21247. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  21248. const sliderKls = computed(() => [
  21249. ns.b(),
  21250. ns.m(sliderWrapperSize.value),
  21251. ns.is("vertical", props.vertical),
  21252. { [ns.m("with-input")]: props.showInput }
  21253. ]);
  21254. const markList = useMarks(props);
  21255. useWatch(props, initData, minValue, maxValue, emit, elFormItem2);
  21256. const precision = computed(() => {
  21257. const precisions = [props.min, props.max, props.step].map((item) => {
  21258. const decimal = `${item}`.split(".")[1];
  21259. return decimal ? decimal.length : 0;
  21260. });
  21261. return Math.max.apply(null, precisions);
  21262. });
  21263. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  21264. const { firstValue, secondValue, oldValue, dragging, sliderSize } = toRefs(initData);
  21265. const updateDragging = (val) => {
  21266. initData.dragging = val;
  21267. };
  21268. provide("SliderProvider", __spreadProps(__spreadValues({}, toRefs(props)), {
  21269. sliderSize,
  21270. disabled: sliderDisabled,
  21271. precision,
  21272. emitChange,
  21273. resetSize,
  21274. updateDragging
  21275. }));
  21276. return {
  21277. ns,
  21278. firstValue,
  21279. secondValue,
  21280. oldValue,
  21281. dragging,
  21282. sliderSize,
  21283. slider,
  21284. firstButton,
  21285. secondButton,
  21286. sliderDisabled,
  21287. runwayStyle,
  21288. barStyle,
  21289. emitChange,
  21290. onSliderClick,
  21291. getStopStyle,
  21292. setFirstValue,
  21293. setSecondValue,
  21294. stops,
  21295. markList,
  21296. sliderWrapper,
  21297. sliderWrapperSize,
  21298. sliderInputSize,
  21299. sliderKls
  21300. };
  21301. }
  21302. });
  21303. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem2) => {
  21304. const _emit = (val) => {
  21305. emit(UPDATE_MODEL_EVENT, val);
  21306. emit(INPUT_EVENT, val);
  21307. };
  21308. const valueChanged = () => {
  21309. if (props.range) {
  21310. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  21311. } else {
  21312. return props.modelValue !== initData.oldValue;
  21313. }
  21314. };
  21315. const setValues = () => {
  21316. var _a2, _b2;
  21317. if (props.min > props.max) {
  21318. throwError("Slider", "min should not be greater than max.");
  21319. return;
  21320. }
  21321. const val = props.modelValue;
  21322. if (props.range && Array.isArray(val)) {
  21323. if (val[1] < props.min) {
  21324. _emit([props.min, props.min]);
  21325. } else if (val[0] > props.max) {
  21326. _emit([props.max, props.max]);
  21327. } else if (val[0] < props.min) {
  21328. _emit([props.min, val[1]]);
  21329. } else if (val[1] > props.max) {
  21330. _emit([val[0], props.max]);
  21331. } else {
  21332. initData.firstValue = val[0];
  21333. initData.secondValue = val[1];
  21334. if (valueChanged()) {
  21335. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  21336. initData.oldValue = val.slice();
  21337. }
  21338. }
  21339. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  21340. if (val < props.min) {
  21341. _emit(props.min);
  21342. } else if (val > props.max) {
  21343. _emit(props.max);
  21344. } else {
  21345. initData.firstValue = val;
  21346. if (valueChanged()) {
  21347. (_b2 = elFormItem2.validate) == null ? void 0 : _b2.call(elFormItem2, "change").catch((err) => debugWarn());
  21348. initData.oldValue = val;
  21349. }
  21350. }
  21351. }
  21352. };
  21353. setValues();
  21354. watch(() => initData.dragging, (val) => {
  21355. if (!val) {
  21356. setValues();
  21357. }
  21358. });
  21359. watch(() => props.modelValue, (val, oldVal) => {
  21360. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  21361. return;
  21362. }
  21363. setValues();
  21364. }, {
  21365. deep: true
  21366. });
  21367. watch(() => [props.min, props.max], () => {
  21368. setValues();
  21369. });
  21370. };
  21371. const useLifecycle = (props, initData, resetSize) => {
  21372. const sliderWrapper = ref(null);
  21373. onMounted(async () => {
  21374. let valuetext;
  21375. if (props.range) {
  21376. if (Array.isArray(props.modelValue)) {
  21377. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  21378. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  21379. } else {
  21380. initData.firstValue = props.min;
  21381. initData.secondValue = props.max;
  21382. }
  21383. initData.oldValue = [initData.firstValue, initData.secondValue];
  21384. valuetext = `${initData.firstValue}-${initData.secondValue}`;
  21385. } else {
  21386. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  21387. initData.firstValue = props.min;
  21388. } else {
  21389. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  21390. }
  21391. initData.oldValue = initData.firstValue;
  21392. valuetext = initData.firstValue;
  21393. }
  21394. sliderWrapper.value.setAttribute("aria-valuetext", valuetext);
  21395. sliderWrapper.value.setAttribute("aria-label", props.label ? props.label : `slider between ${props.min} and ${props.max}`);
  21396. on(window, "resize", resetSize);
  21397. await nextTick();
  21398. resetSize();
  21399. });
  21400. onBeforeUnmount(() => {
  21401. off(window, "resize", resetSize);
  21402. });
  21403. return {
  21404. sliderWrapper
  21405. };
  21406. };
  21407. const _hoisted_1$d = ["aria-valuemin", "aria-valuemax", "aria-orientation", "aria-disabled"];
  21408. const _hoisted_2$b = { key: 1 };
  21409. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  21410. const _component_slider_button = resolveComponent("slider-button");
  21411. const _component_slider_marker = resolveComponent("slider-marker");
  21412. const _component_el_input_number = resolveComponent("el-input-number");
  21413. return openBlock(), createElementBlock("div", {
  21414. ref: "sliderWrapper",
  21415. class: normalizeClass(_ctx.sliderKls),
  21416. role: "slider",
  21417. "aria-valuemin": _ctx.min,
  21418. "aria-valuemax": _ctx.max,
  21419. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  21420. "aria-disabled": _ctx.sliderDisabled
  21421. }, [
  21422. createElementVNode("div", {
  21423. ref: "slider",
  21424. class: normalizeClass([
  21425. _ctx.ns.e("runway"),
  21426. { "show-input": _ctx.showInput && !_ctx.range },
  21427. _ctx.ns.is("disabled", _ctx.sliderDisabled)
  21428. ]),
  21429. style: normalizeStyle(_ctx.runwayStyle),
  21430. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onSliderClick && _ctx.onSliderClick(...args))
  21431. }, [
  21432. createElementVNode("div", {
  21433. class: normalizeClass(_ctx.ns.e("bar")),
  21434. style: normalizeStyle(_ctx.barStyle)
  21435. }, null, 6),
  21436. createVNode(_component_slider_button, {
  21437. ref: "firstButton",
  21438. "model-value": _ctx.firstValue,
  21439. vertical: _ctx.vertical,
  21440. "tooltip-class": _ctx.tooltipClass,
  21441. "onUpdate:modelValue": _ctx.setFirstValue
  21442. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"]),
  21443. _ctx.range ? (openBlock(), createBlock(_component_slider_button, {
  21444. key: 0,
  21445. ref: "secondButton",
  21446. "model-value": _ctx.secondValue,
  21447. vertical: _ctx.vertical,
  21448. "tooltip-class": _ctx.tooltipClass,
  21449. "onUpdate:modelValue": _ctx.setSecondValue
  21450. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
  21451. _ctx.showStops ? (openBlock(), createElementBlock("div", _hoisted_2$b, [
  21452. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.stops, (item, key) => {
  21453. return openBlock(), createElementBlock("div", {
  21454. key,
  21455. class: normalizeClass(_ctx.ns.e("stop")),
  21456. style: normalizeStyle(_ctx.getStopStyle(item))
  21457. }, null, 6);
  21458. }), 128))
  21459. ])) : createCommentVNode("v-if", true),
  21460. _ctx.markList.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  21461. createElementVNode("div", null, [
  21462. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  21463. return openBlock(), createElementBlock("div", {
  21464. key,
  21465. style: normalizeStyle(_ctx.getStopStyle(item.position)),
  21466. class: normalizeClass([_ctx.ns.e("stop"), _ctx.ns.e("marks-stop")])
  21467. }, null, 6);
  21468. }), 128))
  21469. ]),
  21470. createElementVNode("div", {
  21471. class: normalizeClass(_ctx.ns.e("marks"))
  21472. }, [
  21473. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  21474. return openBlock(), createBlock(_component_slider_marker, {
  21475. key,
  21476. mark: item.mark,
  21477. style: normalizeStyle(_ctx.getStopStyle(item.position))
  21478. }, null, 8, ["mark", "style"]);
  21479. }), 128))
  21480. ], 2)
  21481. ], 64)) : createCommentVNode("v-if", true)
  21482. ], 6),
  21483. _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(_component_el_input_number, {
  21484. key: 0,
  21485. ref: "input",
  21486. "model-value": _ctx.firstValue,
  21487. class: normalizeClass(_ctx.ns.e("input")),
  21488. step: _ctx.step,
  21489. disabled: _ctx.sliderDisabled,
  21490. controls: _ctx.showInputControls,
  21491. min: _ctx.min,
  21492. max: _ctx.max,
  21493. debounce: _ctx.debounce,
  21494. size: _ctx.sliderInputSize,
  21495. "onUpdate:modelValue": _ctx.setFirstValue,
  21496. onChange: _ctx.emitChange
  21497. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
  21498. ], 10, _hoisted_1$d);
  21499. }
  21500. var Slider = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["render", _sfc_render$6], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/index.vue"]]);
  21501. Slider.install = (app) => {
  21502. app.component(Slider.name, Slider);
  21503. };
  21504. const _Slider = Slider;
  21505. const ElSlider = _Slider;
  21506. const spaceItem = buildProps({
  21507. prefixCls: {
  21508. type: String,
  21509. default: ""
  21510. }
  21511. });
  21512. const _sfc_main$g = defineComponent({
  21513. props: spaceItem,
  21514. setup(props) {
  21515. const ns = useNamespace("space");
  21516. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  21517. return {
  21518. classes
  21519. };
  21520. }
  21521. });
  21522. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  21523. return openBlock(), createElementBlock("div", {
  21524. class: normalizeClass(_ctx.classes)
  21525. }, [
  21526. renderSlot(_ctx.$slots, "default")
  21527. ], 2);
  21528. }
  21529. var Item = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["render", _sfc_render$5], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/space/src/item.vue"]]);
  21530. const SIZE_MAP = {
  21531. small: 8,
  21532. default: 12,
  21533. large: 16
  21534. };
  21535. function useSpace(props) {
  21536. const ns = useNamespace("space");
  21537. const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
  21538. const horizontalSize = ref(0);
  21539. const verticalSize = ref(0);
  21540. const containerStyle = computed(() => {
  21541. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
  21542. const alignment = {
  21543. alignItems: props.alignment
  21544. };
  21545. return [wrapKls, alignment, props.style];
  21546. });
  21547. const itemStyle = computed(() => {
  21548. const itemBaseStyle = {
  21549. paddingBottom: `${verticalSize.value}px`,
  21550. marginRight: `${horizontalSize.value}px`
  21551. };
  21552. const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  21553. return [itemBaseStyle, fillStyle];
  21554. });
  21555. watchEffect(() => {
  21556. const { size = "small", wrap, direction: dir, fill } = props;
  21557. if (Array.isArray(size)) {
  21558. const [h2 = 0, v2 = 0] = size;
  21559. horizontalSize.value = h2;
  21560. verticalSize.value = v2;
  21561. } else {
  21562. let val;
  21563. if (isNumber(size)) {
  21564. val = size;
  21565. } else {
  21566. val = SIZE_MAP[size] || SIZE_MAP.small;
  21567. }
  21568. if ((wrap || fill) && dir === "horizontal") {
  21569. horizontalSize.value = verticalSize.value = val;
  21570. } else {
  21571. if (dir === "horizontal") {
  21572. horizontalSize.value = val;
  21573. verticalSize.value = 0;
  21574. } else {
  21575. verticalSize.value = val;
  21576. horizontalSize.value = 0;
  21577. }
  21578. }
  21579. }
  21580. });
  21581. return {
  21582. classes,
  21583. containerStyle,
  21584. itemStyle
  21585. };
  21586. }
  21587. const spaceProps = buildProps({
  21588. direction: {
  21589. type: String,
  21590. values: ["horizontal", "vertical"],
  21591. default: "horizontal"
  21592. },
  21593. class: {
  21594. type: definePropType([
  21595. String,
  21596. Object,
  21597. Array
  21598. ]),
  21599. default: ""
  21600. },
  21601. style: {
  21602. type: definePropType([String, Array, Object]),
  21603. default: ""
  21604. },
  21605. alignment: {
  21606. type: definePropType(String),
  21607. default: "center"
  21608. },
  21609. prefixCls: {
  21610. type: String
  21611. },
  21612. spacer: {
  21613. type: definePropType([Object, String, Number, Array]),
  21614. default: null,
  21615. validator: (val) => isVNode(val) || isNumber(val) || isString(val)
  21616. },
  21617. wrap: {
  21618. type: Boolean,
  21619. default: false
  21620. },
  21621. fill: {
  21622. type: Boolean,
  21623. default: false
  21624. },
  21625. fillRatio: {
  21626. type: Number,
  21627. default: 100
  21628. },
  21629. size: {
  21630. type: [String, Array, Number],
  21631. values: componentSizes,
  21632. validator: (val) => {
  21633. return isNumber(val) || isArray(val) && val.length === 2 && val.every((i) => isNumber(i));
  21634. }
  21635. }
  21636. });
  21637. var Space = defineComponent({
  21638. name: "ElSpace",
  21639. props: spaceProps,
  21640. setup(props, { slots }) {
  21641. const { classes, containerStyle, itemStyle } = useSpace(props);
  21642. return () => {
  21643. var _a2;
  21644. const { spacer, prefixCls, direction } = props;
  21645. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  21646. if (((_a2 = children.children) != null ? _a2 : []).length === 0)
  21647. return null;
  21648. if (isArray(children.children)) {
  21649. let extractedChildren = [];
  21650. children.children.forEach((child, loopKey) => {
  21651. if (isFragment(child)) {
  21652. if (isArray(child.children)) {
  21653. child.children.forEach((nested, key) => {
  21654. extractedChildren.push(createVNode(Item, {
  21655. style: itemStyle.value,
  21656. prefixCls,
  21657. key: `nested-${key}`
  21658. }, {
  21659. default: () => [nested]
  21660. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  21661. });
  21662. }
  21663. } else if (isValidElementNode(child)) {
  21664. extractedChildren.push(createVNode(Item, {
  21665. style: itemStyle.value,
  21666. prefixCls,
  21667. key: `LoopKey${loopKey}`
  21668. }, {
  21669. default: () => [child]
  21670. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  21671. }
  21672. });
  21673. if (spacer) {
  21674. const len = extractedChildren.length - 1;
  21675. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  21676. const children2 = [...acc, child];
  21677. if (idx !== len) {
  21678. children2.push(createVNode("span", {
  21679. style: [
  21680. itemStyle.value,
  21681. direction === "vertical" ? "width: 100%" : null
  21682. ],
  21683. key: idx
  21684. }, [
  21685. isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
  21686. ], PatchFlags.STYLE));
  21687. }
  21688. return children2;
  21689. }, []);
  21690. }
  21691. return createVNode("div", {
  21692. class: classes.value,
  21693. style: containerStyle.value
  21694. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  21695. }
  21696. return children.children;
  21697. };
  21698. }
  21699. });
  21700. const ElSpace = withInstall(Space);
  21701. const switchProps = buildProps({
  21702. modelValue: {
  21703. type: [Boolean, String, Number],
  21704. default: false
  21705. },
  21706. value: {
  21707. type: [Boolean, String, Number],
  21708. default: false
  21709. },
  21710. disabled: {
  21711. type: Boolean,
  21712. default: false
  21713. },
  21714. width: {
  21715. type: Number,
  21716. default: 40
  21717. },
  21718. inlinePrompt: {
  21719. type: Boolean,
  21720. default: false
  21721. },
  21722. activeIcon: {
  21723. type: iconPropType,
  21724. default: ""
  21725. },
  21726. inactiveIcon: {
  21727. type: iconPropType,
  21728. default: ""
  21729. },
  21730. activeText: {
  21731. type: String,
  21732. default: ""
  21733. },
  21734. inactiveText: {
  21735. type: String,
  21736. default: ""
  21737. },
  21738. activeColor: {
  21739. type: String,
  21740. default: ""
  21741. },
  21742. inactiveColor: {
  21743. type: String,
  21744. default: ""
  21745. },
  21746. borderColor: {
  21747. type: String,
  21748. default: ""
  21749. },
  21750. activeValue: {
  21751. type: [Boolean, String, Number],
  21752. default: true
  21753. },
  21754. inactiveValue: {
  21755. type: [Boolean, String, Number],
  21756. default: false
  21757. },
  21758. name: {
  21759. type: String,
  21760. default: ""
  21761. },
  21762. validateEvent: {
  21763. type: Boolean,
  21764. default: true
  21765. },
  21766. id: String,
  21767. loading: {
  21768. type: Boolean,
  21769. default: false
  21770. },
  21771. beforeChange: {
  21772. type: definePropType(Function)
  21773. },
  21774. size: {
  21775. type: String,
  21776. validator: isValidComponentSize
  21777. }
  21778. });
  21779. const switchEmits = {
  21780. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  21781. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  21782. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  21783. };
  21784. const COMPONENT_NAME = "ElSwitch";
  21785. const _sfc_main$f = defineComponent({
  21786. name: COMPONENT_NAME,
  21787. components: { ElIcon, Loading: loading },
  21788. props: switchProps,
  21789. emits: switchEmits,
  21790. setup(props, { emit }) {
  21791. const { formItem } = useFormItem();
  21792. const switchDisabled = useDisabled$1(computed(() => props.loading));
  21793. const ns = useNamespace("switch");
  21794. const switchSize = useSize();
  21795. const isModelValue = ref(props.modelValue !== false);
  21796. const input = ref();
  21797. const core = ref();
  21798. const switchKls = computed(() => [
  21799. ns.b(),
  21800. ns.m(switchSize.value),
  21801. ns.is("disabled", switchDisabled.value),
  21802. ns.is("checked", checked.value)
  21803. ]);
  21804. watch(() => props.modelValue, () => {
  21805. isModelValue.value = true;
  21806. });
  21807. watch(() => props.value, () => {
  21808. isModelValue.value = false;
  21809. });
  21810. const actualValue = computed(() => {
  21811. return isModelValue.value ? props.modelValue : props.value;
  21812. });
  21813. const checked = computed(() => actualValue.value === props.activeValue);
  21814. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  21815. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  21816. emit(CHANGE_EVENT, props.inactiveValue);
  21817. emit(INPUT_EVENT, props.inactiveValue);
  21818. }
  21819. watch(checked, () => {
  21820. var _a2;
  21821. input.value.checked = checked.value;
  21822. if (props.activeColor || props.inactiveColor) {
  21823. setBackgroundColor();
  21824. }
  21825. if (props.validateEvent) {
  21826. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  21827. }
  21828. });
  21829. const handleChange2 = () => {
  21830. const val = checked.value ? props.inactiveValue : props.activeValue;
  21831. emit(UPDATE_MODEL_EVENT, val);
  21832. emit(CHANGE_EVENT, val);
  21833. emit(INPUT_EVENT, val);
  21834. nextTick(() => {
  21835. input.value.checked = checked.value;
  21836. });
  21837. };
  21838. const switchValue = () => {
  21839. if (switchDisabled.value)
  21840. return;
  21841. const { beforeChange } = props;
  21842. if (!beforeChange) {
  21843. handleChange2();
  21844. return;
  21845. }
  21846. const shouldChange = beforeChange();
  21847. const isExpectType = [
  21848. isPromise(shouldChange),
  21849. isBoolean(shouldChange)
  21850. ].some((i) => i);
  21851. if (!isExpectType) {
  21852. throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
  21853. }
  21854. if (isPromise(shouldChange)) {
  21855. shouldChange.then((result) => {
  21856. if (result) {
  21857. handleChange2();
  21858. }
  21859. }).catch((e) => {
  21860. });
  21861. } else if (shouldChange) {
  21862. handleChange2();
  21863. }
  21864. };
  21865. const setBackgroundColor = () => {
  21866. const newColor = checked.value ? props.activeColor : props.inactiveColor;
  21867. const coreEl = core.value;
  21868. if (props.borderColor)
  21869. coreEl.style.borderColor = props.borderColor;
  21870. else if (!props.borderColor)
  21871. coreEl.style.borderColor = newColor;
  21872. coreEl.style.backgroundColor = newColor;
  21873. coreEl.children[0].style.color = newColor;
  21874. };
  21875. const focus = () => {
  21876. var _a2, _b2;
  21877. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  21878. };
  21879. onMounted(() => {
  21880. if (props.activeColor || props.inactiveColor || props.borderColor) {
  21881. setBackgroundColor();
  21882. }
  21883. input.value.checked = checked.value;
  21884. });
  21885. return {
  21886. ns,
  21887. input,
  21888. core,
  21889. switchDisabled,
  21890. checked,
  21891. switchKls,
  21892. handleChange: handleChange2,
  21893. switchValue,
  21894. focus
  21895. };
  21896. }
  21897. });
  21898. const _hoisted_1$c = ["aria-checked", "aria-disabled"];
  21899. const _hoisted_2$a = ["id", "name", "true-value", "false-value", "disabled"];
  21900. const _hoisted_3$7 = ["aria-hidden"];
  21901. const _hoisted_4$6 = ["aria-hidden"];
  21902. const _hoisted_5$6 = ["aria-hidden"];
  21903. const _hoisted_6$5 = ["aria-hidden"];
  21904. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  21905. const _component_el_icon = resolveComponent("el-icon");
  21906. const _component_loading = resolveComponent("loading");
  21907. return openBlock(), createElementBlock("div", {
  21908. class: normalizeClass(_ctx.switchKls),
  21909. role: "switch",
  21910. "aria-checked": _ctx.checked,
  21911. "aria-disabled": _ctx.switchDisabled,
  21912. onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["prevent"]))
  21913. }, [
  21914. createElementVNode("input", {
  21915. id: _ctx.id,
  21916. ref: "input",
  21917. class: normalizeClass(_ctx.ns.e("input")),
  21918. type: "checkbox",
  21919. name: _ctx.name,
  21920. "true-value": _ctx.activeValue,
  21921. "false-value": _ctx.inactiveValue,
  21922. disabled: _ctx.switchDisabled,
  21923. onChange: _cache[0] || (_cache[0] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  21924. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["enter"]))
  21925. }, null, 42, _hoisted_2$a),
  21926. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  21927. key: 0,
  21928. class: normalizeClass([
  21929. _ctx.ns.e("label"),
  21930. _ctx.ns.em("label", "left"),
  21931. _ctx.ns.is("active", !_ctx.checked)
  21932. ])
  21933. }, [
  21934. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  21935. default: withCtx(() => [
  21936. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  21937. ]),
  21938. _: 1
  21939. })) : createCommentVNode("v-if", true),
  21940. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  21941. key: 1,
  21942. "aria-hidden": _ctx.checked
  21943. }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$7)) : createCommentVNode("v-if", true)
  21944. ], 2)) : createCommentVNode("v-if", true),
  21945. createElementVNode("span", {
  21946. ref: "core",
  21947. class: normalizeClass(_ctx.ns.e("core")),
  21948. style: normalizeStyle({ width: (_ctx.width || 40) + "px" })
  21949. }, [
  21950. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  21951. key: 0,
  21952. class: normalizeClass(_ctx.ns.e("inner"))
  21953. }, [
  21954. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  21955. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, {
  21956. key: 0,
  21957. class: normalizeClass([_ctx.ns.is("icon"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  21958. }, {
  21959. default: withCtx(() => [
  21960. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  21961. ]),
  21962. _: 1
  21963. }, 8, ["class"])) : createCommentVNode("v-if", true),
  21964. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, {
  21965. key: 1,
  21966. class: normalizeClass([_ctx.ns.is("icon"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  21967. }, {
  21968. default: withCtx(() => [
  21969. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  21970. ]),
  21971. _: 1
  21972. }, 8, ["class"])) : createCommentVNode("v-if", true)
  21973. ], 64)) : _ctx.activeText || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  21974. _ctx.activeText ? (openBlock(), createElementBlock("span", {
  21975. key: 0,
  21976. class: normalizeClass([_ctx.ns.is("text"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  21977. "aria-hidden": !_ctx.checked
  21978. }, toDisplayString(_ctx.activeText.substring(0, 3)), 11, _hoisted_4$6)) : createCommentVNode("v-if", true),
  21979. _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  21980. key: 1,
  21981. class: normalizeClass([_ctx.ns.is("text"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  21982. "aria-hidden": _ctx.checked
  21983. }, toDisplayString(_ctx.inactiveText.substring(0, 3)), 11, _hoisted_5$6)) : createCommentVNode("v-if", true)
  21984. ], 64)) : createCommentVNode("v-if", true)
  21985. ], 2)) : createCommentVNode("v-if", true),
  21986. createElementVNode("div", {
  21987. class: normalizeClass(_ctx.ns.e("action"))
  21988. }, [
  21989. _ctx.loading ? (openBlock(), createBlock(_component_el_icon, {
  21990. key: 0,
  21991. class: normalizeClass(_ctx.ns.is("loading"))
  21992. }, {
  21993. default: withCtx(() => [
  21994. createVNode(_component_loading)
  21995. ]),
  21996. _: 1
  21997. }, 8, ["class"])) : createCommentVNode("v-if", true)
  21998. ], 2)
  21999. ], 6),
  22000. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  22001. key: 1,
  22002. class: normalizeClass([
  22003. _ctx.ns.e("label"),
  22004. _ctx.ns.em("label", "right"),
  22005. _ctx.ns.is("active", _ctx.checked)
  22006. ])
  22007. }, [
  22008. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  22009. default: withCtx(() => [
  22010. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  22011. ]),
  22012. _: 1
  22013. })) : createCommentVNode("v-if", true),
  22014. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  22015. key: 1,
  22016. "aria-hidden": !_ctx.checked
  22017. }, toDisplayString(_ctx.activeText), 9, _hoisted_6$5)) : createCommentVNode("v-if", true)
  22018. ], 2)) : createCommentVNode("v-if", true)
  22019. ], 10, _hoisted_1$c);
  22020. }
  22021. var Switch = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["render", _sfc_render$4], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
  22022. const ElSwitch = withInstall(Switch);
  22023. /*!
  22024. * escape-html
  22025. * Copyright(c) 2012-2013 TJ Holowaychuk
  22026. * Copyright(c) 2015 Andreas Lubbe
  22027. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  22028. * MIT Licensed
  22029. */
  22030. var matchHtmlRegExp = /["'&<>]/;
  22031. var escapeHtml_1 = escapeHtml;
  22032. function escapeHtml(string3) {
  22033. var str = "" + string3;
  22034. var match = matchHtmlRegExp.exec(str);
  22035. if (!match) {
  22036. return str;
  22037. }
  22038. var escape;
  22039. var html = "";
  22040. var index = 0;
  22041. var lastIndex = 0;
  22042. for (index = match.index; index < str.length; index++) {
  22043. switch (str.charCodeAt(index)) {
  22044. case 34:
  22045. escape = "&quot;";
  22046. break;
  22047. case 38:
  22048. escape = "&amp;";
  22049. break;
  22050. case 39:
  22051. escape = "&#39;";
  22052. break;
  22053. case 60:
  22054. escape = "&lt;";
  22055. break;
  22056. case 62:
  22057. escape = "&gt;";
  22058. break;
  22059. default:
  22060. continue;
  22061. }
  22062. if (lastIndex !== index) {
  22063. html += str.substring(lastIndex, index);
  22064. }
  22065. lastIndex = index + 1;
  22066. html += escape;
  22067. }
  22068. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  22069. }
  22070. const getCell = function(event) {
  22071. let cell = event.target;
  22072. while (cell && cell.tagName.toUpperCase() !== "HTML") {
  22073. if (cell.tagName.toUpperCase() === "TD") {
  22074. return cell;
  22075. }
  22076. cell = cell.parentNode;
  22077. }
  22078. return null;
  22079. };
  22080. const isObject = function(obj) {
  22081. return obj !== null && typeof obj === "object";
  22082. };
  22083. const orderBy = function(array4, sortKey, reverse, sortMethod, sortBy) {
  22084. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  22085. return array4;
  22086. }
  22087. if (typeof reverse === "string") {
  22088. reverse = reverse === "descending" ? -1 : 1;
  22089. } else {
  22090. reverse = reverse && reverse < 0 ? -1 : 1;
  22091. }
  22092. const getKey = sortMethod ? null : function(value, index) {
  22093. if (sortBy) {
  22094. if (!Array.isArray(sortBy)) {
  22095. sortBy = [sortBy];
  22096. }
  22097. return sortBy.map((by) => {
  22098. if (typeof by === "string") {
  22099. return get(value, by);
  22100. } else {
  22101. return by(value, index, array4);
  22102. }
  22103. });
  22104. }
  22105. if (sortKey !== "$key") {
  22106. if (isObject(value) && "$value" in value)
  22107. value = value.$value;
  22108. }
  22109. return [isObject(value) ? get(value, sortKey) : value];
  22110. };
  22111. const compare = function(a2, b2) {
  22112. if (sortMethod) {
  22113. return sortMethod(a2.value, b2.value);
  22114. }
  22115. for (let i = 0, len = a2.key.length; i < len; i++) {
  22116. if (a2.key[i] < b2.key[i]) {
  22117. return -1;
  22118. }
  22119. if (a2.key[i] > b2.key[i]) {
  22120. return 1;
  22121. }
  22122. }
  22123. return 0;
  22124. };
  22125. return array4.map((value, index) => {
  22126. return {
  22127. value,
  22128. index,
  22129. key: getKey ? getKey(value, index) : null
  22130. };
  22131. }).sort((a2, b2) => {
  22132. let order2 = compare(a2, b2);
  22133. if (!order2) {
  22134. order2 = a2.index - b2.index;
  22135. }
  22136. return order2 * +reverse;
  22137. }).map((item) => item.value);
  22138. };
  22139. const getColumnById = function(table, columnId) {
  22140. let column = null;
  22141. table.columns.forEach((item) => {
  22142. if (item.id === columnId) {
  22143. column = item;
  22144. }
  22145. });
  22146. return column;
  22147. };
  22148. const getColumnByKey = function(table, columnKey) {
  22149. let column = null;
  22150. for (let i = 0; i < table.columns.length; i++) {
  22151. const item = table.columns[i];
  22152. if (item.columnKey === columnKey) {
  22153. column = item;
  22154. break;
  22155. }
  22156. }
  22157. return column;
  22158. };
  22159. const getColumnByCell = function(table, cell, namespace) {
  22160. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  22161. if (matches) {
  22162. return getColumnById(table, matches[0]);
  22163. }
  22164. return null;
  22165. };
  22166. const getRowIdentity = (row, rowKey) => {
  22167. if (!row)
  22168. throw new Error("Row is required when get row identity");
  22169. if (typeof rowKey === "string") {
  22170. if (!rowKey.includes(".")) {
  22171. return `${row[rowKey]}`;
  22172. }
  22173. const key = rowKey.split(".");
  22174. let current = row;
  22175. for (const element of key) {
  22176. current = current[element];
  22177. }
  22178. return `${current}`;
  22179. } else if (typeof rowKey === "function") {
  22180. return rowKey.call(null, row);
  22181. }
  22182. };
  22183. const getKeysMap = function(array4, rowKey) {
  22184. const arrayMap2 = {};
  22185. (array4 || []).forEach((row, index) => {
  22186. arrayMap2[getRowIdentity(row, rowKey)] = { row, index };
  22187. });
  22188. return arrayMap2;
  22189. };
  22190. function mergeOptions(defaults, config) {
  22191. const options = {};
  22192. let key;
  22193. for (key in defaults) {
  22194. options[key] = defaults[key];
  22195. }
  22196. for (key in config) {
  22197. if (hasOwn(config, key)) {
  22198. const value = config[key];
  22199. if (typeof value !== "undefined") {
  22200. options[key] = value;
  22201. }
  22202. }
  22203. }
  22204. return options;
  22205. }
  22206. function parseWidth(width) {
  22207. if (width === "")
  22208. return width;
  22209. if (width !== void 0) {
  22210. width = Number.parseInt(width, 10);
  22211. if (Number.isNaN(width)) {
  22212. width = "";
  22213. }
  22214. }
  22215. return width;
  22216. }
  22217. function parseMinWidth(minWidth) {
  22218. if (minWidth === "")
  22219. return minWidth;
  22220. if (minWidth !== void 0) {
  22221. minWidth = parseWidth(minWidth);
  22222. if (Number.isNaN(minWidth)) {
  22223. minWidth = 80;
  22224. }
  22225. }
  22226. return minWidth;
  22227. }
  22228. function parseHeight(height) {
  22229. if (typeof height === "number") {
  22230. return height;
  22231. }
  22232. if (typeof height === "string") {
  22233. if (/^\d+(?:px)?$/.test(height)) {
  22234. return Number.parseInt(height, 10);
  22235. } else {
  22236. return height;
  22237. }
  22238. }
  22239. return null;
  22240. }
  22241. function compose(...funcs) {
  22242. if (funcs.length === 0) {
  22243. return (arg) => arg;
  22244. }
  22245. if (funcs.length === 1) {
  22246. return funcs[0];
  22247. }
  22248. return funcs.reduce((a2, b2) => (...args) => a2(b2(...args)));
  22249. }
  22250. function toggleRowStatus(statusArr, row, newVal) {
  22251. let changed = false;
  22252. const index = statusArr.indexOf(row);
  22253. const included = index !== -1;
  22254. const addRow = () => {
  22255. statusArr.push(row);
  22256. changed = true;
  22257. };
  22258. const removeRow = () => {
  22259. statusArr.splice(index, 1);
  22260. changed = true;
  22261. };
  22262. if (typeof newVal === "boolean") {
  22263. if (newVal && !included) {
  22264. addRow();
  22265. } else if (!newVal && included) {
  22266. removeRow();
  22267. }
  22268. } else {
  22269. if (included) {
  22270. removeRow();
  22271. } else {
  22272. addRow();
  22273. }
  22274. }
  22275. return changed;
  22276. }
  22277. function walkTreeNode(root2, cb, childrenKey = "children", lazyKey = "hasChildren") {
  22278. const isNil2 = (array4) => !(Array.isArray(array4) && array4.length);
  22279. function _walker(parent, children, level) {
  22280. cb(parent, children, level);
  22281. children.forEach((item) => {
  22282. if (item[lazyKey]) {
  22283. cb(item, null, level + 1);
  22284. return;
  22285. }
  22286. const children2 = item[childrenKey];
  22287. if (!isNil2(children2)) {
  22288. _walker(item, children2, level + 1);
  22289. }
  22290. });
  22291. }
  22292. root2.forEach((item) => {
  22293. if (item[lazyKey]) {
  22294. cb(item, null, 0);
  22295. return;
  22296. }
  22297. const children = item[childrenKey];
  22298. if (!isNil2(children)) {
  22299. _walker(item, children, 0);
  22300. }
  22301. });
  22302. }
  22303. let removePopper;
  22304. function createTablePopper(trigger, popperContent, popperOptions2, tooltipEffect) {
  22305. const { nextZIndex } = useZIndex();
  22306. function renderContent() {
  22307. const isLight = tooltipEffect === "light";
  22308. const content22 = document.createElement("div");
  22309. content22.className = `el-popper ${isLight ? "is-light" : "is-dark"}`;
  22310. popperContent = escapeHtml_1(popperContent);
  22311. content22.innerHTML = popperContent;
  22312. content22.style.zIndex = String(nextZIndex());
  22313. document.body.appendChild(content22);
  22314. return content22;
  22315. }
  22316. function renderArrow() {
  22317. const arrow22 = document.createElement("div");
  22318. arrow22.className = "el-popper__arrow";
  22319. return arrow22;
  22320. }
  22321. function showPopper() {
  22322. popperInstance && popperInstance.update();
  22323. }
  22324. removePopper = function removePopper2() {
  22325. try {
  22326. popperInstance && popperInstance.destroy();
  22327. content2 && document.body.removeChild(content2);
  22328. off(trigger, "mouseenter", showPopper);
  22329. off(trigger, "mouseleave", removePopper2);
  22330. } catch (e) {
  22331. }
  22332. };
  22333. let popperInstance = null;
  22334. const content2 = renderContent();
  22335. const arrow2 = renderArrow();
  22336. content2.appendChild(arrow2);
  22337. popperInstance = createPopper(trigger, content2, __spreadValues({
  22338. modifiers: [
  22339. {
  22340. name: "offset",
  22341. options: {
  22342. offset: [0, 8]
  22343. }
  22344. },
  22345. {
  22346. name: "arrow",
  22347. options: {
  22348. element: arrow2,
  22349. padding: 10
  22350. }
  22351. }
  22352. ]
  22353. }, popperOptions2));
  22354. on(trigger, "mouseenter", showPopper);
  22355. on(trigger, "mouseleave", removePopper);
  22356. return popperInstance;
  22357. }
  22358. const isFixedColumn = (index, fixed, store, realColumns) => {
  22359. let start2 = 0;
  22360. let after = index;
  22361. if (realColumns) {
  22362. if (realColumns[index].colSpan > 1) {
  22363. return {};
  22364. }
  22365. for (let i = 0; i < index; i++) {
  22366. start2 += realColumns[i].colSpan;
  22367. }
  22368. after = start2 + realColumns[index].colSpan - 1;
  22369. } else {
  22370. start2 = index;
  22371. }
  22372. let fixedLayout;
  22373. const columns = store.states.columns;
  22374. switch (fixed) {
  22375. case "left":
  22376. if (after < store.states.fixedLeafColumnsLength.value) {
  22377. fixedLayout = "left";
  22378. }
  22379. break;
  22380. case "right":
  22381. if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22382. fixedLayout = "right";
  22383. }
  22384. break;
  22385. default:
  22386. if (after < store.states.fixedLeafColumnsLength.value) {
  22387. fixedLayout = "left";
  22388. } else if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22389. fixedLayout = "right";
  22390. }
  22391. }
  22392. return fixedLayout ? {
  22393. direction: fixedLayout,
  22394. start: start2,
  22395. after
  22396. } : {};
  22397. };
  22398. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns) => {
  22399. const classes = [];
  22400. const { direction, start: start2 } = isFixedColumn(index, fixed, store, realColumns);
  22401. if (direction) {
  22402. const isLeft = direction === "left";
  22403. classes.push(`${namespace}-fixed-column--${direction}`);
  22404. if (isLeft && start2 === store.states.fixedLeafColumnsLength.value - 1) {
  22405. classes.push("is-last-column");
  22406. } else if (!isLeft && start2 === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22407. classes.push("is-first-column");
  22408. }
  22409. }
  22410. return classes;
  22411. };
  22412. function getOffset(offset2, column) {
  22413. return offset2 + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  22414. }
  22415. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  22416. const { direction, start: start2 = 0 } = isFixedColumn(index, fixed, store, realColumns);
  22417. if (!direction) {
  22418. return;
  22419. }
  22420. const styles = {};
  22421. const isLeft = direction === "left";
  22422. const columns = store.states.columns.value;
  22423. if (isLeft) {
  22424. styles.left = columns.slice(0, index).reduce(getOffset, 0);
  22425. } else {
  22426. styles.right = columns.slice(start2 + 1).reverse().reduce(getOffset, 0);
  22427. }
  22428. return styles;
  22429. };
  22430. const ensurePosition = (style, key) => {
  22431. if (!style)
  22432. return;
  22433. if (!Number.isNaN(style[key])) {
  22434. style[key] = `${style[key]}px`;
  22435. }
  22436. };
  22437. function useExpand(watcherData) {
  22438. const instance = getCurrentInstance();
  22439. const defaultExpandAll = ref(false);
  22440. const expandRows = ref([]);
  22441. const updateExpandRows = () => {
  22442. const data2 = watcherData.data.value || [];
  22443. const rowKey = watcherData.rowKey.value;
  22444. if (defaultExpandAll.value) {
  22445. expandRows.value = data2.slice();
  22446. } else if (rowKey) {
  22447. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  22448. expandRows.value = data2.reduce((prev, row) => {
  22449. const rowId = getRowIdentity(row, rowKey);
  22450. const rowInfo = expandRowsMap[rowId];
  22451. if (rowInfo) {
  22452. prev.push(row);
  22453. }
  22454. return prev;
  22455. }, []);
  22456. } else {
  22457. expandRows.value = [];
  22458. }
  22459. };
  22460. const toggleRowExpansion = (row, expanded) => {
  22461. const changed = toggleRowStatus(expandRows.value, row, expanded);
  22462. if (changed) {
  22463. instance.emit("expand-change", row, expandRows.value.slice());
  22464. }
  22465. };
  22466. const setExpandRowKeys = (rowKeys) => {
  22467. instance.store.assertRowKey();
  22468. const data2 = watcherData.data.value || [];
  22469. const rowKey = watcherData.rowKey.value;
  22470. const keysMap = getKeysMap(data2, rowKey);
  22471. expandRows.value = rowKeys.reduce((prev, cur) => {
  22472. const info = keysMap[cur];
  22473. if (info) {
  22474. prev.push(info.row);
  22475. }
  22476. return prev;
  22477. }, []);
  22478. };
  22479. const isRowExpanded = (row) => {
  22480. const rowKey = watcherData.rowKey.value;
  22481. if (rowKey) {
  22482. const expandMap = getKeysMap(expandRows.value, rowKey);
  22483. return !!expandMap[getRowIdentity(row, rowKey)];
  22484. }
  22485. return expandRows.value.includes(row);
  22486. };
  22487. return {
  22488. updateExpandRows,
  22489. toggleRowExpansion,
  22490. setExpandRowKeys,
  22491. isRowExpanded,
  22492. states: {
  22493. expandRows,
  22494. defaultExpandAll
  22495. }
  22496. };
  22497. }
  22498. function useCurrent(watcherData) {
  22499. const instance = getCurrentInstance();
  22500. const _currentRowKey = ref(null);
  22501. const currentRow = ref(null);
  22502. const setCurrentRowKey = (key) => {
  22503. instance.store.assertRowKey();
  22504. _currentRowKey.value = key;
  22505. setCurrentRowByKey(key);
  22506. };
  22507. const restoreCurrentRowKey = () => {
  22508. _currentRowKey.value = null;
  22509. };
  22510. const setCurrentRowByKey = (key) => {
  22511. const { data: data2, rowKey } = watcherData;
  22512. let _currentRow = null;
  22513. if (rowKey.value) {
  22514. _currentRow = (unref(data2) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  22515. }
  22516. currentRow.value = _currentRow;
  22517. instance.emit("current-change", currentRow.value, null);
  22518. };
  22519. const updateCurrentRow = (_currentRow) => {
  22520. const oldCurrentRow = currentRow.value;
  22521. if (_currentRow && _currentRow !== oldCurrentRow) {
  22522. currentRow.value = _currentRow;
  22523. instance.emit("current-change", currentRow.value, oldCurrentRow);
  22524. return;
  22525. }
  22526. if (!_currentRow && oldCurrentRow) {
  22527. currentRow.value = null;
  22528. instance.emit("current-change", null, oldCurrentRow);
  22529. }
  22530. };
  22531. const updateCurrentRowData = () => {
  22532. const rowKey = watcherData.rowKey.value;
  22533. const data2 = watcherData.data.value || [];
  22534. const oldCurrentRow = currentRow.value;
  22535. if (!data2.includes(oldCurrentRow) && oldCurrentRow) {
  22536. if (rowKey) {
  22537. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  22538. setCurrentRowByKey(currentRowKey);
  22539. } else {
  22540. currentRow.value = null;
  22541. }
  22542. if (currentRow.value === null) {
  22543. instance.emit("current-change", null, oldCurrentRow);
  22544. }
  22545. } else if (_currentRowKey.value) {
  22546. setCurrentRowByKey(_currentRowKey.value);
  22547. restoreCurrentRowKey();
  22548. }
  22549. };
  22550. return {
  22551. setCurrentRowKey,
  22552. restoreCurrentRowKey,
  22553. setCurrentRowByKey,
  22554. updateCurrentRow,
  22555. updateCurrentRowData,
  22556. states: {
  22557. _currentRowKey,
  22558. currentRow
  22559. }
  22560. };
  22561. }
  22562. function useTree(watcherData) {
  22563. const expandRowKeys = ref([]);
  22564. const treeData = ref({});
  22565. const indent = ref(16);
  22566. const lazy = ref(false);
  22567. const lazyTreeNodeMap = ref({});
  22568. const lazyColumnIdentifier = ref("hasChildren");
  22569. const childrenColumnName = ref("children");
  22570. const instance = getCurrentInstance();
  22571. const normalizedData = computed(() => {
  22572. if (!watcherData.rowKey.value)
  22573. return {};
  22574. const data2 = watcherData.data.value || [];
  22575. return normalize(data2);
  22576. });
  22577. const normalizedLazyNode = computed(() => {
  22578. const rowKey = watcherData.rowKey.value;
  22579. const keys2 = Object.keys(lazyTreeNodeMap.value);
  22580. const res = {};
  22581. if (!keys2.length)
  22582. return res;
  22583. keys2.forEach((key) => {
  22584. if (lazyTreeNodeMap.value[key].length) {
  22585. const item = { children: [] };
  22586. lazyTreeNodeMap.value[key].forEach((row) => {
  22587. const currentRowKey = getRowIdentity(row, rowKey);
  22588. item.children.push(currentRowKey);
  22589. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  22590. res[currentRowKey] = { children: [] };
  22591. }
  22592. });
  22593. res[key] = item;
  22594. }
  22595. });
  22596. return res;
  22597. });
  22598. const normalize = (data2) => {
  22599. const rowKey = watcherData.rowKey.value;
  22600. const res = {};
  22601. walkTreeNode(data2, (parent, children, level) => {
  22602. const parentId = getRowIdentity(parent, rowKey);
  22603. if (Array.isArray(children)) {
  22604. res[parentId] = {
  22605. children: children.map((row) => getRowIdentity(row, rowKey)),
  22606. level
  22607. };
  22608. } else if (lazy.value) {
  22609. res[parentId] = {
  22610. children: [],
  22611. lazy: true,
  22612. level
  22613. };
  22614. }
  22615. }, childrenColumnName.value, lazyColumnIdentifier.value);
  22616. return res;
  22617. };
  22618. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a2) => (_a2 = instance.store) == null ? void 0 : _a2.states.defaultExpandAll.value)()) => {
  22619. var _a2;
  22620. const nested = normalizedData.value;
  22621. const normalizedLazyNode_ = normalizedLazyNode.value;
  22622. const keys2 = Object.keys(nested);
  22623. const newTreeData = {};
  22624. if (keys2.length) {
  22625. const oldTreeData = unref(treeData);
  22626. const rootLazyRowKeys = [];
  22627. const getExpanded = (oldValue, key) => {
  22628. if (ifChangeExpandRowKeys) {
  22629. if (expandRowKeys.value) {
  22630. return ifExpandAll || expandRowKeys.value.includes(key);
  22631. } else {
  22632. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  22633. }
  22634. } else {
  22635. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  22636. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  22637. }
  22638. };
  22639. keys2.forEach((key) => {
  22640. const oldValue = oldTreeData[key];
  22641. const newValue = __spreadValues({}, nested[key]);
  22642. newValue.expanded = getExpanded(oldValue, key);
  22643. if (newValue.lazy) {
  22644. const { loaded = false, loading: loading2 = false } = oldValue || {};
  22645. newValue.loaded = !!loaded;
  22646. newValue.loading = !!loading2;
  22647. rootLazyRowKeys.push(key);
  22648. }
  22649. newTreeData[key] = newValue;
  22650. });
  22651. const lazyKeys = Object.keys(normalizedLazyNode_);
  22652. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  22653. lazyKeys.forEach((key) => {
  22654. const oldValue = oldTreeData[key];
  22655. const lazyNodeChildren = normalizedLazyNode_[key].children;
  22656. if (rootLazyRowKeys.includes(key)) {
  22657. if (newTreeData[key].children.length !== 0) {
  22658. throw new Error("[ElTable]children must be an empty array.");
  22659. }
  22660. newTreeData[key].children = lazyNodeChildren;
  22661. } else {
  22662. const { loaded = false, loading: loading2 = false } = oldValue || {};
  22663. newTreeData[key] = {
  22664. lazy: true,
  22665. loaded: !!loaded,
  22666. loading: !!loading2,
  22667. expanded: getExpanded(oldValue, key),
  22668. children: lazyNodeChildren,
  22669. level: ""
  22670. };
  22671. }
  22672. });
  22673. }
  22674. }
  22675. treeData.value = newTreeData;
  22676. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  22677. };
  22678. watch(() => expandRowKeys.value, () => {
  22679. updateTreeData(true);
  22680. });
  22681. watch(() => normalizedData.value, () => {
  22682. updateTreeData();
  22683. });
  22684. watch(() => normalizedLazyNode.value, () => {
  22685. updateTreeData();
  22686. });
  22687. const updateTreeExpandKeys = (value) => {
  22688. expandRowKeys.value = value;
  22689. updateTreeData();
  22690. };
  22691. const toggleTreeExpansion = (row, expanded) => {
  22692. instance.store.assertRowKey();
  22693. const rowKey = watcherData.rowKey.value;
  22694. const id = getRowIdentity(row, rowKey);
  22695. const data2 = id && treeData.value[id];
  22696. if (id && data2 && "expanded" in data2) {
  22697. const oldExpanded = data2.expanded;
  22698. expanded = typeof expanded === "undefined" ? !data2.expanded : expanded;
  22699. treeData.value[id].expanded = expanded;
  22700. if (oldExpanded !== expanded) {
  22701. instance.emit("expand-change", row, expanded);
  22702. }
  22703. instance.store.updateTableScrollY();
  22704. }
  22705. };
  22706. const loadOrToggle = (row) => {
  22707. instance.store.assertRowKey();
  22708. const rowKey = watcherData.rowKey.value;
  22709. const id = getRowIdentity(row, rowKey);
  22710. const data2 = treeData.value[id];
  22711. if (lazy.value && data2 && "loaded" in data2 && !data2.loaded) {
  22712. loadData(row, id, data2);
  22713. } else {
  22714. toggleTreeExpansion(row, void 0);
  22715. }
  22716. };
  22717. const loadData = (row, key, treeNode) => {
  22718. const { load } = instance.props;
  22719. if (load && !treeData.value[key].loaded) {
  22720. treeData.value[key].loading = true;
  22721. load(row, treeNode, (data2) => {
  22722. if (!Array.isArray(data2)) {
  22723. throw new TypeError("[ElTable] data must be an array");
  22724. }
  22725. treeData.value[key].loading = false;
  22726. treeData.value[key].loaded = true;
  22727. treeData.value[key].expanded = true;
  22728. if (data2.length) {
  22729. lazyTreeNodeMap.value[key] = data2;
  22730. }
  22731. instance.emit("expand-change", row, true);
  22732. });
  22733. }
  22734. };
  22735. return {
  22736. loadData,
  22737. loadOrToggle,
  22738. toggleTreeExpansion,
  22739. updateTreeExpandKeys,
  22740. updateTreeData,
  22741. normalize,
  22742. states: {
  22743. expandRowKeys,
  22744. treeData,
  22745. indent,
  22746. lazy,
  22747. lazyTreeNodeMap,
  22748. lazyColumnIdentifier,
  22749. childrenColumnName
  22750. }
  22751. };
  22752. }
  22753. const sortData = (data2, states) => {
  22754. const sortingColumn = states.sortingColumn;
  22755. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  22756. return data2;
  22757. }
  22758. return orderBy(data2, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  22759. };
  22760. const doFlattenColumns = (columns) => {
  22761. const result = [];
  22762. columns.forEach((column) => {
  22763. if (column.children) {
  22764. result.push.apply(result, doFlattenColumns(column.children));
  22765. } else {
  22766. result.push(column);
  22767. }
  22768. });
  22769. return result;
  22770. };
  22771. function useWatcher$1() {
  22772. var _a2;
  22773. const instance = getCurrentInstance();
  22774. const { size: tableSize } = toRefs((_a2 = instance.proxy) == null ? void 0 : _a2.$props);
  22775. const rowKey = ref(null);
  22776. const data2 = ref([]);
  22777. const _data = ref([]);
  22778. const isComplex = ref(false);
  22779. const _columns = ref([]);
  22780. const originColumns = ref([]);
  22781. const columns = ref([]);
  22782. const fixedColumns = ref([]);
  22783. const rightFixedColumns = ref([]);
  22784. const leafColumns = ref([]);
  22785. const fixedLeafColumns = ref([]);
  22786. const rightFixedLeafColumns = ref([]);
  22787. const leafColumnsLength = ref(0);
  22788. const fixedLeafColumnsLength = ref(0);
  22789. const rightFixedLeafColumnsLength = ref(0);
  22790. const isAllSelected = ref(false);
  22791. const selection = ref([]);
  22792. const reserveSelection = ref(false);
  22793. const selectOnIndeterminate = ref(false);
  22794. const selectable = ref(null);
  22795. const filters = ref({});
  22796. const filteredData = ref(null);
  22797. const sortingColumn = ref(null);
  22798. const sortProp = ref(null);
  22799. const sortOrder = ref(null);
  22800. const hoverRow = ref(null);
  22801. watch(data2, () => instance.state && scheduleLayout(false), {
  22802. deep: true
  22803. });
  22804. const assertRowKey = () => {
  22805. if (!rowKey.value)
  22806. throw new Error("[ElTable] prop row-key is required");
  22807. };
  22808. const updateColumns = () => {
  22809. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  22810. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  22811. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  22812. _columns.value[0].fixed = true;
  22813. fixedColumns.value.unshift(_columns.value[0]);
  22814. }
  22815. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  22816. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  22817. const leafColumns2 = doFlattenColumns(notFixedColumns);
  22818. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  22819. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  22820. leafColumnsLength.value = leafColumns2.length;
  22821. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  22822. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  22823. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  22824. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  22825. };
  22826. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  22827. if (needUpdateColumns) {
  22828. updateColumns();
  22829. }
  22830. if (immediate) {
  22831. instance.state.doLayout();
  22832. } else {
  22833. instance.state.debouncedUpdateLayout();
  22834. }
  22835. };
  22836. const isSelected = (row) => {
  22837. return selection.value.includes(row);
  22838. };
  22839. const clearSelection = () => {
  22840. isAllSelected.value = false;
  22841. const oldSelection = selection.value;
  22842. if (oldSelection.length) {
  22843. selection.value = [];
  22844. instance.emit("selection-change", []);
  22845. }
  22846. };
  22847. const cleanSelection = () => {
  22848. let deleted;
  22849. if (rowKey.value) {
  22850. deleted = [];
  22851. const selectedMap = getKeysMap(selection.value, rowKey.value);
  22852. const dataMap = getKeysMap(data2.value, rowKey.value);
  22853. for (const key in selectedMap) {
  22854. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  22855. deleted.push(selectedMap[key].row);
  22856. }
  22857. }
  22858. } else {
  22859. deleted = selection.value.filter((item) => !data2.value.includes(item));
  22860. }
  22861. if (deleted.length) {
  22862. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  22863. selection.value = newSelection;
  22864. instance.emit("selection-change", newSelection.slice());
  22865. }
  22866. };
  22867. const getSelectionRows = () => {
  22868. return (selection.value || []).slice();
  22869. };
  22870. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  22871. const changed = toggleRowStatus(selection.value, row, selected);
  22872. if (changed) {
  22873. const newSelection = (selection.value || []).slice();
  22874. if (emitChange) {
  22875. instance.emit("select", newSelection, row);
  22876. }
  22877. instance.emit("selection-change", newSelection);
  22878. }
  22879. };
  22880. const _toggleAllSelection = () => {
  22881. var _a22, _b2;
  22882. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  22883. isAllSelected.value = value;
  22884. let selectionChanged = false;
  22885. let childrenCount = 0;
  22886. const rowKey2 = (_b2 = (_a22 = instance == null ? void 0 : instance.store) == null ? void 0 : _a22.states) == null ? void 0 : _b2.rowKey.value;
  22887. data2.value.forEach((row, index) => {
  22888. const rowIndex = index + childrenCount;
  22889. if (selectable.value) {
  22890. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  22891. selectionChanged = true;
  22892. }
  22893. } else {
  22894. if (toggleRowStatus(selection.value, row, value)) {
  22895. selectionChanged = true;
  22896. }
  22897. }
  22898. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  22899. });
  22900. if (selectionChanged) {
  22901. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  22902. }
  22903. instance.emit("select-all", selection.value);
  22904. };
  22905. const updateSelectionByRowKey = () => {
  22906. const selectedMap = getKeysMap(selection.value, rowKey.value);
  22907. data2.value.forEach((row) => {
  22908. const rowId = getRowIdentity(row, rowKey.value);
  22909. const rowInfo = selectedMap[rowId];
  22910. if (rowInfo) {
  22911. selection.value[rowInfo.index] = row;
  22912. }
  22913. });
  22914. };
  22915. const updateAllSelected = () => {
  22916. var _a22, _b2, _c;
  22917. if (((_a22 = data2.value) == null ? void 0 : _a22.length) === 0) {
  22918. isAllSelected.value = false;
  22919. return;
  22920. }
  22921. let selectedMap;
  22922. if (rowKey.value) {
  22923. selectedMap = getKeysMap(selection.value, rowKey.value);
  22924. }
  22925. const isSelected2 = function(row) {
  22926. if (selectedMap) {
  22927. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  22928. } else {
  22929. return selection.value.includes(row);
  22930. }
  22931. };
  22932. let isAllSelected_ = true;
  22933. let selectedCount = 0;
  22934. let childrenCount = 0;
  22935. for (let i = 0, j = (data2.value || []).length; i < j; i++) {
  22936. const keyProp = (_c = (_b2 = instance == null ? void 0 : instance.store) == null ? void 0 : _b2.states) == null ? void 0 : _c.rowKey.value;
  22937. const rowIndex = i + childrenCount;
  22938. const item = data2.value[i];
  22939. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  22940. if (!isSelected2(item)) {
  22941. if (!selectable.value || isRowSelectable) {
  22942. isAllSelected_ = false;
  22943. break;
  22944. }
  22945. } else {
  22946. selectedCount++;
  22947. }
  22948. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  22949. }
  22950. if (selectedCount === 0)
  22951. isAllSelected_ = false;
  22952. isAllSelected.value = isAllSelected_;
  22953. };
  22954. const getChildrenCount = (rowKey2) => {
  22955. var _a22;
  22956. if (!instance || !instance.store)
  22957. return 0;
  22958. const { treeData } = instance.store.states;
  22959. let count = 0;
  22960. const children = (_a22 = treeData.value[rowKey2]) == null ? void 0 : _a22.children;
  22961. if (children) {
  22962. count += children.length;
  22963. children.forEach((childKey) => {
  22964. count += getChildrenCount(childKey);
  22965. });
  22966. }
  22967. return count;
  22968. };
  22969. const updateFilters = (columns2, values) => {
  22970. if (!Array.isArray(columns2)) {
  22971. columns2 = [columns2];
  22972. }
  22973. const filters_ = {};
  22974. columns2.forEach((col) => {
  22975. filters.value[col.id] = values;
  22976. filters_[col.columnKey || col.id] = values;
  22977. });
  22978. return filters_;
  22979. };
  22980. const updateSort = (column, prop, order2) => {
  22981. if (sortingColumn.value && sortingColumn.value !== column) {
  22982. sortingColumn.value.order = null;
  22983. }
  22984. sortingColumn.value = column;
  22985. sortProp.value = prop;
  22986. sortOrder.value = order2;
  22987. };
  22988. const execFilter = () => {
  22989. let sourceData = unref(_data);
  22990. Object.keys(filters.value).forEach((columnId) => {
  22991. const values = filters.value[columnId];
  22992. if (!values || values.length === 0)
  22993. return;
  22994. const column = getColumnById({
  22995. columns: columns.value
  22996. }, columnId);
  22997. if (column && column.filterMethod) {
  22998. sourceData = sourceData.filter((row) => {
  22999. return values.some((value) => column.filterMethod.call(null, value, row, column));
  23000. });
  23001. }
  23002. });
  23003. filteredData.value = sourceData;
  23004. };
  23005. const execSort = () => {
  23006. data2.value = sortData(filteredData.value, {
  23007. sortingColumn: sortingColumn.value,
  23008. sortProp: sortProp.value,
  23009. sortOrder: sortOrder.value
  23010. });
  23011. };
  23012. const execQuery = (ignore = void 0) => {
  23013. if (!(ignore && ignore.filter)) {
  23014. execFilter();
  23015. }
  23016. execSort();
  23017. };
  23018. const clearFilter = (columnKeys) => {
  23019. const { tableHeaderRef } = instance.refs;
  23020. if (!tableHeaderRef)
  23021. return;
  23022. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  23023. const keys2 = Object.keys(panels);
  23024. if (!keys2.length)
  23025. return;
  23026. if (typeof columnKeys === "string") {
  23027. columnKeys = [columnKeys];
  23028. }
  23029. if (Array.isArray(columnKeys)) {
  23030. const columns_ = columnKeys.map((key) => getColumnByKey({
  23031. columns: columns.value
  23032. }, key));
  23033. keys2.forEach((key) => {
  23034. const column = columns_.find((col) => col.id === key);
  23035. if (column) {
  23036. column.filteredValue = [];
  23037. }
  23038. });
  23039. instance.store.commit("filterChange", {
  23040. column: columns_,
  23041. values: [],
  23042. silent: true,
  23043. multi: true
  23044. });
  23045. } else {
  23046. keys2.forEach((key) => {
  23047. const column = columns.value.find((col) => col.id === key);
  23048. if (column) {
  23049. column.filteredValue = [];
  23050. }
  23051. });
  23052. filters.value = {};
  23053. instance.store.commit("filterChange", {
  23054. column: {},
  23055. values: [],
  23056. silent: true
  23057. });
  23058. }
  23059. };
  23060. const clearSort = () => {
  23061. if (!sortingColumn.value)
  23062. return;
  23063. updateSort(null, null, null);
  23064. instance.store.commit("changeSortCondition", {
  23065. silent: true
  23066. });
  23067. };
  23068. const {
  23069. setExpandRowKeys,
  23070. toggleRowExpansion,
  23071. updateExpandRows,
  23072. states: expandStates,
  23073. isRowExpanded
  23074. } = useExpand({
  23075. data: data2,
  23076. rowKey
  23077. });
  23078. const {
  23079. updateTreeExpandKeys,
  23080. toggleTreeExpansion,
  23081. updateTreeData,
  23082. loadOrToggle,
  23083. states: treeStates
  23084. } = useTree({
  23085. data: data2,
  23086. rowKey
  23087. });
  23088. const {
  23089. updateCurrentRowData,
  23090. updateCurrentRow,
  23091. setCurrentRowKey,
  23092. states: currentData
  23093. } = useCurrent({
  23094. data: data2,
  23095. rowKey
  23096. });
  23097. const setExpandRowKeysAdapter = (val) => {
  23098. setExpandRowKeys(val);
  23099. updateTreeExpandKeys(val);
  23100. };
  23101. const toggleRowExpansionAdapter = (row, expanded) => {
  23102. const hasExpandColumn = columns.value.some(({ type: type4 }) => type4 === "expand");
  23103. if (hasExpandColumn) {
  23104. toggleRowExpansion(row, expanded);
  23105. } else {
  23106. toggleTreeExpansion(row, expanded);
  23107. }
  23108. };
  23109. return {
  23110. assertRowKey,
  23111. updateColumns,
  23112. scheduleLayout,
  23113. isSelected,
  23114. clearSelection,
  23115. cleanSelection,
  23116. getSelectionRows,
  23117. toggleRowSelection,
  23118. _toggleAllSelection,
  23119. toggleAllSelection: null,
  23120. updateSelectionByRowKey,
  23121. updateAllSelected,
  23122. updateFilters,
  23123. updateCurrentRow,
  23124. updateSort,
  23125. execFilter,
  23126. execSort,
  23127. execQuery,
  23128. clearFilter,
  23129. clearSort,
  23130. toggleRowExpansion,
  23131. setExpandRowKeysAdapter,
  23132. setCurrentRowKey,
  23133. toggleRowExpansionAdapter,
  23134. isRowExpanded,
  23135. updateExpandRows,
  23136. updateCurrentRowData,
  23137. loadOrToggle,
  23138. updateTreeData,
  23139. states: __spreadValues(__spreadValues(__spreadValues({
  23140. tableSize,
  23141. rowKey,
  23142. data: data2,
  23143. _data,
  23144. isComplex,
  23145. _columns,
  23146. originColumns,
  23147. columns,
  23148. fixedColumns,
  23149. rightFixedColumns,
  23150. leafColumns,
  23151. fixedLeafColumns,
  23152. rightFixedLeafColumns,
  23153. leafColumnsLength,
  23154. fixedLeafColumnsLength,
  23155. rightFixedLeafColumnsLength,
  23156. isAllSelected,
  23157. selection,
  23158. reserveSelection,
  23159. selectOnIndeterminate,
  23160. selectable,
  23161. filters,
  23162. filteredData,
  23163. sortingColumn,
  23164. sortProp,
  23165. sortOrder,
  23166. hoverRow
  23167. }, expandStates), treeStates), currentData)
  23168. };
  23169. }
  23170. function replaceColumn(array4, column) {
  23171. return array4.map((item) => {
  23172. var _a2;
  23173. if (item.id === column.id) {
  23174. return column;
  23175. } else if ((_a2 = item.children) == null ? void 0 : _a2.length) {
  23176. item.children = replaceColumn(item.children, column);
  23177. }
  23178. return item;
  23179. });
  23180. }
  23181. function sortColumn(array4) {
  23182. array4.forEach((item) => {
  23183. var _a2, _b2;
  23184. item.no = (_a2 = item.getColumnIndex) == null ? void 0 : _a2.call(item);
  23185. if ((_b2 = item.children) == null ? void 0 : _b2.length) {
  23186. sortColumn(item.children);
  23187. }
  23188. });
  23189. array4.sort((cur, pre) => cur.no - pre.no);
  23190. }
  23191. function useStore() {
  23192. const instance = getCurrentInstance();
  23193. const watcher = useWatcher$1();
  23194. const ns = useNamespace("table");
  23195. const mutations = {
  23196. setData(states, data2) {
  23197. const dataInstanceChanged = unref(states._data) !== data2;
  23198. states.data.value = data2;
  23199. states._data.value = data2;
  23200. instance.store.execQuery();
  23201. instance.store.updateCurrentRowData();
  23202. instance.store.updateExpandRows();
  23203. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  23204. if (unref(states.reserveSelection)) {
  23205. instance.store.assertRowKey();
  23206. instance.store.updateSelectionByRowKey();
  23207. } else {
  23208. if (dataInstanceChanged) {
  23209. instance.store.clearSelection();
  23210. } else {
  23211. instance.store.cleanSelection();
  23212. }
  23213. }
  23214. instance.store.updateAllSelected();
  23215. if (instance.$ready) {
  23216. instance.store.scheduleLayout();
  23217. }
  23218. },
  23219. insertColumn(states, column, parent) {
  23220. const array4 = unref(states._columns);
  23221. let newColumns = [];
  23222. if (!parent) {
  23223. array4.push(column);
  23224. newColumns = array4;
  23225. } else {
  23226. if (parent && !parent.children) {
  23227. parent.children = [];
  23228. }
  23229. parent.children.push(column);
  23230. newColumns = replaceColumn(array4, parent);
  23231. }
  23232. sortColumn(newColumns);
  23233. states._columns.value = newColumns;
  23234. if (column.type === "selection") {
  23235. states.selectable.value = column.selectable;
  23236. states.reserveSelection.value = column.reserveSelection;
  23237. }
  23238. if (instance.$ready) {
  23239. instance.store.updateColumns();
  23240. instance.store.scheduleLayout();
  23241. }
  23242. },
  23243. removeColumn(states, column, parent) {
  23244. const array4 = unref(states._columns) || [];
  23245. if (parent) {
  23246. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  23247. if (parent.children.length === 0) {
  23248. delete parent.children;
  23249. }
  23250. states._columns.value = replaceColumn(array4, parent);
  23251. } else {
  23252. const index = array4.indexOf(column);
  23253. if (index > -1) {
  23254. array4.splice(index, 1);
  23255. states._columns.value = array4;
  23256. }
  23257. }
  23258. if (instance.$ready) {
  23259. instance.store.updateColumns();
  23260. instance.store.scheduleLayout();
  23261. }
  23262. },
  23263. sort(states, options) {
  23264. const { prop, order: order2, init } = options;
  23265. if (prop) {
  23266. const column = unref(states.columns).find((column2) => column2.property === prop);
  23267. if (column) {
  23268. column.order = order2;
  23269. instance.store.updateSort(column, prop, order2);
  23270. instance.store.commit("changeSortCondition", { init });
  23271. }
  23272. }
  23273. },
  23274. changeSortCondition(states, options) {
  23275. const { sortingColumn: column, sortProp: prop, sortOrder: order2 } = states;
  23276. if (unref(order2) === null) {
  23277. states.sortingColumn.value = null;
  23278. states.sortProp.value = null;
  23279. }
  23280. const ingore = { filter: true };
  23281. instance.store.execQuery(ingore);
  23282. if (!options || !(options.silent || options.init)) {
  23283. instance.emit("sort-change", {
  23284. column: unref(column),
  23285. prop: unref(prop),
  23286. order: unref(order2)
  23287. });
  23288. }
  23289. instance.store.updateTableScrollY();
  23290. },
  23291. filterChange(_states, options) {
  23292. const { column, values, silent } = options;
  23293. const newFilters = instance.store.updateFilters(column, values);
  23294. instance.store.execQuery();
  23295. if (!silent) {
  23296. instance.emit("filter-change", newFilters);
  23297. }
  23298. instance.store.updateTableScrollY();
  23299. },
  23300. toggleAllSelection() {
  23301. instance.store.toggleAllSelection();
  23302. },
  23303. rowSelectedChanged(_states, row) {
  23304. instance.store.toggleRowSelection(row);
  23305. instance.store.updateAllSelected();
  23306. },
  23307. setHoverRow(states, row) {
  23308. states.hoverRow.value = row;
  23309. },
  23310. setCurrentRow(_states, row) {
  23311. instance.store.updateCurrentRow(row);
  23312. }
  23313. };
  23314. const commit = function(name, ...args) {
  23315. const mutations2 = instance.store.mutations;
  23316. if (mutations2[name]) {
  23317. mutations2[name].apply(instance, [instance.store.states].concat(args));
  23318. } else {
  23319. throw new Error(`Action not found: ${name}`);
  23320. }
  23321. };
  23322. const updateTableScrollY = function() {
  23323. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  23324. };
  23325. return __spreadProps(__spreadValues({
  23326. ns
  23327. }, watcher), {
  23328. mutations,
  23329. commit,
  23330. updateTableScrollY
  23331. });
  23332. }
  23333. const InitialStateMap = {
  23334. rowKey: "rowKey",
  23335. defaultExpandAll: "defaultExpandAll",
  23336. selectOnIndeterminate: "selectOnIndeterminate",
  23337. indent: "indent",
  23338. lazy: "lazy",
  23339. data: "data",
  23340. ["treeProps.hasChildren"]: {
  23341. key: "lazyColumnIdentifier",
  23342. default: "hasChildren"
  23343. },
  23344. ["treeProps.children"]: {
  23345. key: "childrenColumnName",
  23346. default: "children"
  23347. }
  23348. };
  23349. function createStore(table, props) {
  23350. if (!table) {
  23351. throw new Error("Table is required.");
  23352. }
  23353. const store = useStore();
  23354. store.toggleAllSelection = debounce$1(store._toggleAllSelection, 10);
  23355. Object.keys(InitialStateMap).forEach((key) => {
  23356. handleValue(getArrKeysValue(props, key), key, store);
  23357. });
  23358. proxyTableProps(store, props);
  23359. return store;
  23360. }
  23361. function proxyTableProps(store, props) {
  23362. Object.keys(InitialStateMap).forEach((key) => {
  23363. watch(() => getArrKeysValue(props, key), (value) => {
  23364. handleValue(value, key, store);
  23365. });
  23366. });
  23367. }
  23368. function handleValue(value, propsKey, store) {
  23369. let newVal = value;
  23370. let storeKey = InitialStateMap[propsKey];
  23371. if (typeof InitialStateMap[propsKey] === "object") {
  23372. storeKey = storeKey.key;
  23373. newVal = newVal || InitialStateMap[propsKey].default;
  23374. }
  23375. store.states[storeKey].value = newVal;
  23376. }
  23377. function getArrKeysValue(props, keys2) {
  23378. if (keys2.includes(".")) {
  23379. const keyList = keys2.split(".");
  23380. let value = props;
  23381. keyList.forEach((key) => {
  23382. value = value[key];
  23383. });
  23384. return value;
  23385. } else {
  23386. return props[keys2];
  23387. }
  23388. }
  23389. class TableLayout {
  23390. constructor(options) {
  23391. this.observers = [];
  23392. this.table = null;
  23393. this.store = null;
  23394. this.columns = [];
  23395. this.fit = true;
  23396. this.showHeader = true;
  23397. this.height = ref(null);
  23398. this.scrollX = ref(false);
  23399. this.scrollY = ref(false);
  23400. this.bodyWidth = ref(null);
  23401. this.fixedWidth = ref(null);
  23402. this.rightFixedWidth = ref(null);
  23403. this.tableHeight = ref(null);
  23404. this.headerHeight = ref(44);
  23405. this.appendHeight = ref(0);
  23406. this.footerHeight = ref(44);
  23407. this.viewportHeight = ref(null);
  23408. this.bodyHeight = ref(null);
  23409. this.bodyScrollHeight = ref(0);
  23410. this.fixedBodyHeight = ref(null);
  23411. this.gutterWidth = 0;
  23412. for (const name in options) {
  23413. if (hasOwn(options, name)) {
  23414. if (isRef(this[name])) {
  23415. this[name].value = options[name];
  23416. } else {
  23417. this[name] = options[name];
  23418. }
  23419. }
  23420. }
  23421. if (!this.table) {
  23422. throw new Error("Table is required for Table Layout");
  23423. }
  23424. if (!this.store) {
  23425. throw new Error("Store is required for Table Layout");
  23426. }
  23427. }
  23428. updateScrollY() {
  23429. const height = this.height.value;
  23430. if (height === null)
  23431. return false;
  23432. const bodyWrapper = this.table.refs.bodyWrapper;
  23433. if (this.table.vnode.el && bodyWrapper) {
  23434. let scrollY = true;
  23435. const prevScrollY = this.scrollY.value;
  23436. if (this.bodyHeight.value === null) {
  23437. scrollY = false;
  23438. } else {
  23439. scrollY = bodyWrapper.scrollHeight > this.bodyHeight.value;
  23440. }
  23441. this.scrollY.value = scrollY;
  23442. return prevScrollY !== scrollY;
  23443. }
  23444. return false;
  23445. }
  23446. setHeight(value, prop = "height") {
  23447. if (!isClient$1)
  23448. return;
  23449. const el = this.table.vnode.el;
  23450. value = parseHeight(value);
  23451. this.height.value = Number(value);
  23452. if (!el && (value || value === 0))
  23453. return nextTick(() => this.setHeight(value, prop));
  23454. if (typeof value === "number") {
  23455. el.style[prop] = `${value}px`;
  23456. this.updateElsHeight();
  23457. } else if (typeof value === "string") {
  23458. el.style[prop] = value;
  23459. this.updateElsHeight();
  23460. }
  23461. }
  23462. setMaxHeight(value) {
  23463. this.setHeight(value, "max-height");
  23464. }
  23465. getFlattenColumns() {
  23466. const flattenColumns = [];
  23467. const columns = this.table.store.states.columns.value;
  23468. columns.forEach((column) => {
  23469. if (column.isColumnGroup) {
  23470. flattenColumns.push.apply(flattenColumns, column.columns);
  23471. } else {
  23472. flattenColumns.push(column);
  23473. }
  23474. });
  23475. return flattenColumns;
  23476. }
  23477. updateElsHeight() {
  23478. var _a2, _b2;
  23479. if (!this.table.$ready)
  23480. return nextTick(() => this.updateElsHeight());
  23481. const {
  23482. tableWrapper,
  23483. headerWrapper,
  23484. appendWrapper,
  23485. footerWrapper,
  23486. tableHeader,
  23487. tableBody
  23488. } = this.table.refs;
  23489. if (tableWrapper && tableWrapper.style.display === "none") {
  23490. return;
  23491. }
  23492. const { tableLayout } = this.table.props;
  23493. this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0;
  23494. if (this.showHeader && !headerWrapper && tableLayout === "fixed") {
  23495. return;
  23496. }
  23497. const headerTrElm = tableHeader ? tableHeader : null;
  23498. const noneHeader = this.headerDisplayNone(headerTrElm);
  23499. const headerWrapperOffsetHeight = (headerWrapper == null ? void 0 : headerWrapper.offsetHeight) || 0;
  23500. const headerHeight = this.headerHeight.value = !this.showHeader ? 0 : headerWrapperOffsetHeight;
  23501. if (this.showHeader && !noneHeader && headerWrapperOffsetHeight > 0 && (this.table.store.states.columns.value || []).length > 0 && headerHeight < 2) {
  23502. return nextTick(() => this.updateElsHeight());
  23503. }
  23504. const tableHeight = this.tableHeight.value = (_b2 = (_a2 = this.table) == null ? void 0 : _a2.vnode.el) == null ? void 0 : _b2.clientHeight;
  23505. const footerHeight = this.footerHeight.value = footerWrapper ? footerWrapper.offsetHeight : 0;
  23506. if (this.height.value !== null) {
  23507. if (this.bodyHeight.value === null) {
  23508. requestAnimationFrame(() => this.updateElsHeight());
  23509. }
  23510. this.bodyHeight.value = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
  23511. this.bodyScrollHeight.value = tableBody == null ? void 0 : tableBody.scrollHeight;
  23512. }
  23513. this.fixedBodyHeight.value = this.scrollX.value ? this.bodyHeight.value - this.gutterWidth : this.bodyHeight.value;
  23514. this.viewportHeight.value = this.scrollX.value ? tableHeight - this.gutterWidth : tableHeight;
  23515. this.updateScrollY();
  23516. this.notifyObservers("scrollable");
  23517. }
  23518. headerDisplayNone(elm) {
  23519. if (!elm)
  23520. return true;
  23521. let headerChild = elm;
  23522. while (headerChild.tagName !== "DIV") {
  23523. if (getComputedStyle(headerChild).display === "none") {
  23524. return true;
  23525. }
  23526. headerChild = headerChild.parentElement;
  23527. }
  23528. return false;
  23529. }
  23530. updateColumnsWidth() {
  23531. if (!isClient$1)
  23532. return;
  23533. const fit = this.fit;
  23534. const bodyWidth = this.table.vnode.el.clientWidth;
  23535. let bodyMinWidth = 0;
  23536. const flattenColumns = this.getFlattenColumns();
  23537. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  23538. flattenColumns.forEach((column) => {
  23539. if (typeof column.width === "number" && column.realWidth)
  23540. column.realWidth = null;
  23541. });
  23542. if (flexColumns.length > 0 && fit) {
  23543. flattenColumns.forEach((column) => {
  23544. bodyMinWidth += Number(column.width || column.minWidth || 80);
  23545. });
  23546. if (bodyMinWidth <= bodyWidth) {
  23547. this.scrollX.value = false;
  23548. const totalFlexWidth = bodyWidth - bodyMinWidth;
  23549. if (flexColumns.length === 1) {
  23550. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  23551. } else {
  23552. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  23553. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  23554. let noneFirstWidth = 0;
  23555. flexColumns.forEach((column, index) => {
  23556. if (index === 0)
  23557. return;
  23558. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  23559. noneFirstWidth += flexWidth;
  23560. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  23561. });
  23562. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  23563. }
  23564. } else {
  23565. this.scrollX.value = true;
  23566. flexColumns.forEach((column) => {
  23567. column.realWidth = Number(column.minWidth);
  23568. });
  23569. }
  23570. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  23571. this.table.state.resizeState.value.width = this.bodyWidth.value;
  23572. } else {
  23573. flattenColumns.forEach((column) => {
  23574. if (!column.width && !column.minWidth) {
  23575. column.realWidth = 80;
  23576. } else {
  23577. column.realWidth = Number(column.width || column.minWidth);
  23578. }
  23579. bodyMinWidth += column.realWidth;
  23580. });
  23581. this.scrollX.value = bodyMinWidth > bodyWidth;
  23582. this.bodyWidth.value = bodyMinWidth;
  23583. }
  23584. const fixedColumns = this.store.states.fixedColumns.value;
  23585. if (fixedColumns.length > 0) {
  23586. let fixedWidth = 0;
  23587. fixedColumns.forEach((column) => {
  23588. fixedWidth += Number(column.realWidth || column.width);
  23589. });
  23590. this.fixedWidth.value = fixedWidth;
  23591. }
  23592. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  23593. if (rightFixedColumns.length > 0) {
  23594. let rightFixedWidth = 0;
  23595. rightFixedColumns.forEach((column) => {
  23596. rightFixedWidth += Number(column.realWidth || column.width);
  23597. });
  23598. this.rightFixedWidth.value = rightFixedWidth;
  23599. }
  23600. this.notifyObservers("columns");
  23601. }
  23602. addObserver(observer) {
  23603. this.observers.push(observer);
  23604. }
  23605. removeObserver(observer) {
  23606. const index = this.observers.indexOf(observer);
  23607. if (index !== -1) {
  23608. this.observers.splice(index, 1);
  23609. }
  23610. }
  23611. notifyObservers(event) {
  23612. const observers = this.observers;
  23613. observers.forEach((observer) => {
  23614. var _a2, _b2;
  23615. switch (event) {
  23616. case "columns":
  23617. (_a2 = observer.state) == null ? void 0 : _a2.onColumnsChange(this);
  23618. break;
  23619. case "scrollable":
  23620. (_b2 = observer.state) == null ? void 0 : _b2.onScrollableChange(this);
  23621. break;
  23622. default:
  23623. throw new Error(`Table Layout don't have event ${event}.`);
  23624. }
  23625. });
  23626. }
  23627. }
  23628. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  23629. const _sfc_main$e = defineComponent({
  23630. name: "ElTableFilterPanel",
  23631. components: {
  23632. ElCheckbox,
  23633. ElCheckboxGroup,
  23634. ElScrollbar,
  23635. ElTooltip,
  23636. ElIcon,
  23637. ArrowDown: arrowDown,
  23638. ArrowUp: arrowUp
  23639. },
  23640. directives: { ClickOutside },
  23641. props: {
  23642. placement: {
  23643. type: String,
  23644. default: "bottom-start"
  23645. },
  23646. store: {
  23647. type: Object
  23648. },
  23649. column: {
  23650. type: Object
  23651. },
  23652. upDataColumn: {
  23653. type: Function
  23654. }
  23655. },
  23656. setup(props) {
  23657. const instance = getCurrentInstance();
  23658. const { t } = useLocale();
  23659. const ns = useNamespace("table-filter");
  23660. const parent = instance == null ? void 0 : instance.parent;
  23661. if (!parent.filterPanels.value[props.column.id]) {
  23662. parent.filterPanels.value[props.column.id] = instance;
  23663. }
  23664. const tooltipVisible = ref(false);
  23665. const tooltip = ref(null);
  23666. const filters = computed(() => {
  23667. return props.column && props.column.filters;
  23668. });
  23669. const filterValue = computed({
  23670. get: () => {
  23671. var _a2;
  23672. return (((_a2 = props.column) == null ? void 0 : _a2.filteredValue) || [])[0];
  23673. },
  23674. set: (value) => {
  23675. if (filteredValue.value) {
  23676. if (typeof value !== "undefined" && value !== null) {
  23677. filteredValue.value.splice(0, 1, value);
  23678. } else {
  23679. filteredValue.value.splice(0, 1);
  23680. }
  23681. }
  23682. }
  23683. });
  23684. const filteredValue = computed({
  23685. get() {
  23686. if (props.column) {
  23687. return props.column.filteredValue || [];
  23688. }
  23689. return [];
  23690. },
  23691. set(value) {
  23692. if (props.column) {
  23693. props.upDataColumn("filteredValue", value);
  23694. }
  23695. }
  23696. });
  23697. const multiple = computed(() => {
  23698. if (props.column) {
  23699. return props.column.filterMultiple;
  23700. }
  23701. return true;
  23702. });
  23703. const isActive = (filter) => {
  23704. return filter.value === filterValue.value;
  23705. };
  23706. const hidden = () => {
  23707. tooltipVisible.value = false;
  23708. };
  23709. const showFilterPanel = (e) => {
  23710. e.stopPropagation();
  23711. tooltipVisible.value = !tooltipVisible.value;
  23712. };
  23713. const hideFilterPanel = () => {
  23714. tooltipVisible.value = false;
  23715. };
  23716. const handleConfirm = () => {
  23717. confirmFilter(filteredValue.value);
  23718. hidden();
  23719. };
  23720. const handleReset = () => {
  23721. filteredValue.value = [];
  23722. confirmFilter(filteredValue.value);
  23723. hidden();
  23724. };
  23725. const handleSelect = (_filterValue) => {
  23726. filterValue.value = _filterValue;
  23727. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  23728. confirmFilter(filteredValue.value);
  23729. } else {
  23730. confirmFilter([]);
  23731. }
  23732. hidden();
  23733. };
  23734. const confirmFilter = (filteredValue2) => {
  23735. props.store.commit("filterChange", {
  23736. column: props.column,
  23737. values: filteredValue2
  23738. });
  23739. props.store.updateAllSelected();
  23740. };
  23741. watch(tooltipVisible, (value) => {
  23742. if (props.column) {
  23743. props.upDataColumn("filterOpened", value);
  23744. }
  23745. }, {
  23746. immediate: true
  23747. });
  23748. const popperPaneRef = computed(() => {
  23749. var _a2, _b2;
  23750. return (_b2 = (_a2 = tooltip.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  23751. });
  23752. return {
  23753. tooltipVisible,
  23754. multiple,
  23755. filteredValue,
  23756. filterValue,
  23757. filters,
  23758. handleConfirm,
  23759. handleReset,
  23760. handleSelect,
  23761. isActive,
  23762. t,
  23763. ns,
  23764. showFilterPanel,
  23765. hideFilterPanel,
  23766. popperPaneRef,
  23767. tooltip
  23768. };
  23769. }
  23770. });
  23771. const _hoisted_1$b = { key: 0 };
  23772. const _hoisted_2$9 = ["disabled"];
  23773. const _hoisted_3$6 = ["label", "onClick"];
  23774. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  23775. const _component_el_checkbox = resolveComponent("el-checkbox");
  23776. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  23777. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  23778. const _component_arrow_up = resolveComponent("arrow-up");
  23779. const _component_arrow_down = resolveComponent("arrow-down");
  23780. const _component_el_icon = resolveComponent("el-icon");
  23781. const _component_el_tooltip = resolveComponent("el-tooltip");
  23782. const _directive_click_outside = resolveDirective("click-outside");
  23783. return openBlock(), createBlock(_component_el_tooltip, {
  23784. ref: "tooltip",
  23785. visible: _ctx.tooltipVisible,
  23786. "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => _ctx.tooltipVisible = $event),
  23787. offset: 0,
  23788. placement: _ctx.placement,
  23789. "show-arrow": false,
  23790. "stop-popper-mouse-event": false,
  23791. "append-to-body": "",
  23792. effect: "light",
  23793. pure: "",
  23794. "popper-class": _ctx.ns.b(),
  23795. persistent: ""
  23796. }, {
  23797. content: withCtx(() => [
  23798. _ctx.multiple ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
  23799. createElementVNode("div", {
  23800. class: normalizeClass(_ctx.ns.e("content"))
  23801. }, [
  23802. createVNode(_component_el_scrollbar, {
  23803. "wrap-class": _ctx.ns.e("wrap")
  23804. }, {
  23805. default: withCtx(() => [
  23806. createVNode(_component_el_checkbox_group, {
  23807. modelValue: _ctx.filteredValue,
  23808. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  23809. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  23810. }, {
  23811. default: withCtx(() => [
  23812. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  23813. return openBlock(), createBlock(_component_el_checkbox, {
  23814. key: filter.value,
  23815. label: filter.value
  23816. }, {
  23817. default: withCtx(() => [
  23818. createTextVNode(toDisplayString(filter.text), 1)
  23819. ]),
  23820. _: 2
  23821. }, 1032, ["label"]);
  23822. }), 128))
  23823. ]),
  23824. _: 1
  23825. }, 8, ["modelValue", "class"])
  23826. ]),
  23827. _: 1
  23828. }, 8, ["wrap-class"])
  23829. ], 2),
  23830. createElementVNode("div", {
  23831. class: normalizeClass(_ctx.ns.e("bottom"))
  23832. }, [
  23833. createElementVNode("button", {
  23834. class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  23835. disabled: _ctx.filteredValue.length === 0,
  23836. type: "button",
  23837. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  23838. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$9),
  23839. createElementVNode("button", {
  23840. type: "button",
  23841. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  23842. }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  23843. ], 2)
  23844. ])) : (openBlock(), createElementBlock("ul", {
  23845. key: 1,
  23846. class: normalizeClass(_ctx.ns.e("list"))
  23847. }, [
  23848. createElementVNode("li", {
  23849. class: normalizeClass([
  23850. _ctx.ns.e("list-item"),
  23851. {
  23852. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  23853. }
  23854. ]),
  23855. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  23856. }, toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  23857. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  23858. return openBlock(), createElementBlock("li", {
  23859. key: filter.value,
  23860. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  23861. label: filter.value,
  23862. onClick: ($event) => _ctx.handleSelect(filter.value)
  23863. }, toDisplayString(filter.text), 11, _hoisted_3$6);
  23864. }), 128))
  23865. ], 2))
  23866. ]),
  23867. default: withCtx(() => [
  23868. withDirectives((openBlock(), createElementBlock("span", {
  23869. class: normalizeClass([
  23870. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  23871. `${_ctx.ns.namespace.value}-none-outline`
  23872. ]),
  23873. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  23874. }, [
  23875. createVNode(_component_el_icon, null, {
  23876. default: withCtx(() => [
  23877. _ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
  23878. ]),
  23879. _: 1
  23880. })
  23881. ], 2)), [
  23882. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  23883. ])
  23884. ]),
  23885. _: 1
  23886. }, 8, ["visible", "placement", "popper-class"]);
  23887. }
  23888. var FilterPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$3], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/filter-panel.vue"]]);
  23889. function useLayoutObserver(root2) {
  23890. const instance = getCurrentInstance();
  23891. onBeforeMount(() => {
  23892. tableLayout.value.addObserver(instance);
  23893. });
  23894. onMounted(() => {
  23895. onColumnsChange(tableLayout.value);
  23896. onScrollableChange(tableLayout.value);
  23897. });
  23898. onUpdated(() => {
  23899. onColumnsChange(tableLayout.value);
  23900. onScrollableChange(tableLayout.value);
  23901. });
  23902. onUnmounted(() => {
  23903. tableLayout.value.removeObserver(instance);
  23904. });
  23905. const tableLayout = computed(() => {
  23906. const layout = root2.layout;
  23907. if (!layout) {
  23908. throw new Error("Can not find table layout.");
  23909. }
  23910. return layout;
  23911. });
  23912. const onColumnsChange = (layout) => {
  23913. var _a2;
  23914. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col")) || [];
  23915. if (!cols.length)
  23916. return;
  23917. const flattenColumns = layout.getFlattenColumns();
  23918. const columnsMap = {};
  23919. flattenColumns.forEach((column) => {
  23920. columnsMap[column.id] = column;
  23921. });
  23922. for (let i = 0, j = cols.length; i < j; i++) {
  23923. const col = cols[i];
  23924. const name = col.getAttribute("name");
  23925. const column = columnsMap[name];
  23926. if (column) {
  23927. col.setAttribute("width", column.realWidth || column.width);
  23928. }
  23929. }
  23930. };
  23931. const onScrollableChange = (layout) => {
  23932. var _a2, _b2;
  23933. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col[name=gutter]")) || [];
  23934. for (let i = 0, j = cols.length; i < j; i++) {
  23935. const col = cols[i];
  23936. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  23937. }
  23938. const ths = ((_b2 = root2.vnode.el) == null ? void 0 : _b2.querySelectorAll("th.gutter")) || [];
  23939. for (let i = 0, j = ths.length; i < j; i++) {
  23940. const th = ths[i];
  23941. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  23942. th.style.display = layout.scrollY.value ? "" : "none";
  23943. }
  23944. };
  23945. return {
  23946. tableLayout: tableLayout.value,
  23947. onColumnsChange,
  23948. onScrollableChange
  23949. };
  23950. }
  23951. const TABLE_INJECTION_KEY = Symbol("ElTable");
  23952. function useEvent(props, emit) {
  23953. const instance = getCurrentInstance();
  23954. const parent = inject(TABLE_INJECTION_KEY);
  23955. const handleFilterClick = (event) => {
  23956. event.stopPropagation();
  23957. return;
  23958. };
  23959. const handleHeaderClick = (event, column) => {
  23960. if (!column.filters && column.sortable) {
  23961. handleSortClick(event, column, false);
  23962. } else if (column.filterable && !column.sortable) {
  23963. handleFilterClick(event);
  23964. }
  23965. parent == null ? void 0 : parent.emit("header-click", column, event);
  23966. };
  23967. const handleHeaderContextMenu = (event, column) => {
  23968. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  23969. };
  23970. const draggingColumn = ref(null);
  23971. const dragging = ref(false);
  23972. const dragState = ref({});
  23973. const handleMouseDown = (event, column) => {
  23974. if (!isClient$1)
  23975. return;
  23976. if (column.children && column.children.length > 0)
  23977. return;
  23978. if (draggingColumn.value && props.border) {
  23979. dragging.value = true;
  23980. const table = parent;
  23981. emit("set-drag-visible", true);
  23982. const tableEl = table == null ? void 0 : table.vnode.el;
  23983. const tableLeft = tableEl.getBoundingClientRect().left;
  23984. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  23985. const columnRect = columnEl.getBoundingClientRect();
  23986. const minLeft = columnRect.left - tableLeft + 30;
  23987. addClass(columnEl, "noclick");
  23988. dragState.value = {
  23989. startMouseLeft: event.clientX,
  23990. startLeft: columnRect.right - tableLeft,
  23991. startColumnLeft: columnRect.left - tableLeft,
  23992. tableLeft
  23993. };
  23994. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  23995. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  23996. document.onselectstart = function() {
  23997. return false;
  23998. };
  23999. document.ondragstart = function() {
  24000. return false;
  24001. };
  24002. const handleMouseMove2 = (event2) => {
  24003. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  24004. const proxyLeft = dragState.value.startLeft + deltaLeft;
  24005. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  24006. };
  24007. const handleMouseUp = () => {
  24008. if (dragging.value) {
  24009. const { startColumnLeft, startLeft } = dragState.value;
  24010. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  24011. const columnWidth = finalLeft - startColumnLeft;
  24012. column.width = column.realWidth = columnWidth;
  24013. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  24014. requestAnimationFrame(() => {
  24015. props.store.scheduleLayout(false, true);
  24016. });
  24017. document.body.style.cursor = "";
  24018. dragging.value = false;
  24019. draggingColumn.value = null;
  24020. dragState.value = {};
  24021. emit("set-drag-visible", false);
  24022. }
  24023. document.removeEventListener("mousemove", handleMouseMove2);
  24024. document.removeEventListener("mouseup", handleMouseUp);
  24025. document.onselectstart = null;
  24026. document.ondragstart = null;
  24027. setTimeout(() => {
  24028. removeClass(columnEl, "noclick");
  24029. }, 0);
  24030. };
  24031. document.addEventListener("mousemove", handleMouseMove2);
  24032. document.addEventListener("mouseup", handleMouseUp);
  24033. }
  24034. };
  24035. const handleMouseMove = (event, column) => {
  24036. if (column.children && column.children.length > 0)
  24037. return;
  24038. let target = event.target;
  24039. while (target && target.tagName !== "TH") {
  24040. target = target.parentNode;
  24041. }
  24042. if (!column || !column.resizable)
  24043. return;
  24044. if (!dragging.value && props.border) {
  24045. const rect = target.getBoundingClientRect();
  24046. const bodyStyle = document.body.style;
  24047. if (rect.width > 12 && rect.right - event.pageX < 8) {
  24048. bodyStyle.cursor = "col-resize";
  24049. if (hasClass(target, "is-sortable")) {
  24050. target.style.cursor = "col-resize";
  24051. }
  24052. draggingColumn.value = column;
  24053. } else if (!dragging.value) {
  24054. bodyStyle.cursor = "";
  24055. if (hasClass(target, "is-sortable")) {
  24056. target.style.cursor = "pointer";
  24057. }
  24058. draggingColumn.value = null;
  24059. }
  24060. }
  24061. };
  24062. const handleMouseOut = () => {
  24063. if (!isClient$1)
  24064. return;
  24065. document.body.style.cursor = "";
  24066. };
  24067. const toggleOrder = ({ order: order2, sortOrders }) => {
  24068. if (order2 === "")
  24069. return sortOrders[0];
  24070. const index = sortOrders.indexOf(order2 || null);
  24071. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  24072. };
  24073. const handleSortClick = (event, column, givenOrder) => {
  24074. event.stopPropagation();
  24075. const order2 = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  24076. let target = event.target;
  24077. while (target && target.tagName !== "TH") {
  24078. target = target.parentNode;
  24079. }
  24080. if (target && target.tagName === "TH") {
  24081. if (hasClass(target, "noclick")) {
  24082. removeClass(target, "noclick");
  24083. return;
  24084. }
  24085. }
  24086. if (!column.sortable)
  24087. return;
  24088. const states = props.store.states;
  24089. let sortProp = states.sortProp.value;
  24090. let sortOrder;
  24091. const sortingColumn = states.sortingColumn.value;
  24092. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  24093. if (sortingColumn) {
  24094. sortingColumn.order = null;
  24095. }
  24096. states.sortingColumn.value = column;
  24097. sortProp = column.property;
  24098. }
  24099. if (!order2) {
  24100. sortOrder = column.order = null;
  24101. } else {
  24102. sortOrder = column.order = order2;
  24103. }
  24104. states.sortProp.value = sortProp;
  24105. states.sortOrder.value = sortOrder;
  24106. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  24107. };
  24108. return {
  24109. handleHeaderClick,
  24110. handleHeaderContextMenu,
  24111. handleMouseDown,
  24112. handleMouseMove,
  24113. handleMouseOut,
  24114. handleSortClick,
  24115. handleFilterClick
  24116. };
  24117. }
  24118. function useStyle$2(props) {
  24119. const parent = inject(TABLE_INJECTION_KEY);
  24120. const ns = useNamespace("table");
  24121. const getHeaderRowStyle = (rowIndex) => {
  24122. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  24123. if (typeof headerRowStyle === "function") {
  24124. return headerRowStyle.call(null, { rowIndex });
  24125. }
  24126. return headerRowStyle;
  24127. };
  24128. const getHeaderRowClass = (rowIndex) => {
  24129. const classes = [];
  24130. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  24131. if (typeof headerRowClassName === "string") {
  24132. classes.push(headerRowClassName);
  24133. } else if (typeof headerRowClassName === "function") {
  24134. classes.push(headerRowClassName.call(null, { rowIndex }));
  24135. }
  24136. return classes.join(" ");
  24137. };
  24138. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  24139. var _a2;
  24140. let headerCellStyles = (_a2 = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a2 : {};
  24141. if (typeof headerCellStyles === "function") {
  24142. headerCellStyles = headerCellStyles.call(null, {
  24143. rowIndex,
  24144. columnIndex,
  24145. row,
  24146. column
  24147. });
  24148. }
  24149. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  24150. ensurePosition(fixedStyle, "left");
  24151. ensurePosition(fixedStyle, "right");
  24152. return Object.assign({}, headerCellStyles, fixedStyle);
  24153. };
  24154. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  24155. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  24156. const classes = [
  24157. column.id,
  24158. column.order,
  24159. column.headerAlign,
  24160. column.className,
  24161. column.labelClassName,
  24162. ...fixedClasses
  24163. ];
  24164. if (!column.children) {
  24165. classes.push("is-leaf");
  24166. }
  24167. if (column.sortable) {
  24168. classes.push("is-sortable");
  24169. }
  24170. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  24171. if (typeof headerCellClassName === "string") {
  24172. classes.push(headerCellClassName);
  24173. } else if (typeof headerCellClassName === "function") {
  24174. classes.push(headerCellClassName.call(null, {
  24175. rowIndex,
  24176. columnIndex,
  24177. row,
  24178. column
  24179. }));
  24180. }
  24181. classes.push(ns.e("cell"));
  24182. return classes.filter((className) => Boolean(className)).join(" ");
  24183. };
  24184. return {
  24185. getHeaderRowStyle,
  24186. getHeaderRowClass,
  24187. getHeaderCellStyle,
  24188. getHeaderCellClass
  24189. };
  24190. }
  24191. const getAllColumns = (columns) => {
  24192. const result = [];
  24193. columns.forEach((column) => {
  24194. if (column.children) {
  24195. result.push(column);
  24196. result.push.apply(result, getAllColumns(column.children));
  24197. } else {
  24198. result.push(column);
  24199. }
  24200. });
  24201. return result;
  24202. };
  24203. const convertToRows = (originColumns) => {
  24204. let maxLevel = 1;
  24205. const traverse = (column, parent) => {
  24206. if (parent) {
  24207. column.level = parent.level + 1;
  24208. if (maxLevel < column.level) {
  24209. maxLevel = column.level;
  24210. }
  24211. }
  24212. if (column.children) {
  24213. let colSpan = 0;
  24214. column.children.forEach((subColumn) => {
  24215. traverse(subColumn, column);
  24216. colSpan += subColumn.colSpan;
  24217. });
  24218. column.colSpan = colSpan;
  24219. } else {
  24220. column.colSpan = 1;
  24221. }
  24222. };
  24223. originColumns.forEach((column) => {
  24224. column.level = 1;
  24225. traverse(column, void 0);
  24226. });
  24227. const rows = [];
  24228. for (let i = 0; i < maxLevel; i++) {
  24229. rows.push([]);
  24230. }
  24231. const allColumns = getAllColumns(originColumns);
  24232. allColumns.forEach((column) => {
  24233. if (!column.children) {
  24234. column.rowSpan = maxLevel - column.level + 1;
  24235. } else {
  24236. column.rowSpan = 1;
  24237. column.children.forEach((col) => col.isSubColumn = true);
  24238. }
  24239. rows[column.level - 1].push(column);
  24240. });
  24241. return rows;
  24242. };
  24243. function useUtils$1(props) {
  24244. const parent = inject(TABLE_INJECTION_KEY);
  24245. const columnRows = computed(() => {
  24246. return convertToRows(props.store.states.originColumns.value);
  24247. });
  24248. const isGroup = computed(() => {
  24249. const result = columnRows.value.length > 1;
  24250. if (result && parent) {
  24251. parent.state.isGroup.value = true;
  24252. }
  24253. return result;
  24254. });
  24255. const toggleAllSelection = (event) => {
  24256. event.stopPropagation();
  24257. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  24258. };
  24259. return {
  24260. isGroup,
  24261. toggleAllSelection,
  24262. columnRows
  24263. };
  24264. }
  24265. var TableHeader = defineComponent({
  24266. name: "ElTableHeader",
  24267. components: {
  24268. ElCheckbox
  24269. },
  24270. props: {
  24271. fixed: {
  24272. type: String,
  24273. default: ""
  24274. },
  24275. store: {
  24276. required: true,
  24277. type: Object
  24278. },
  24279. border: Boolean,
  24280. defaultSort: {
  24281. type: Object,
  24282. default: () => {
  24283. return {
  24284. prop: "",
  24285. order: ""
  24286. };
  24287. }
  24288. }
  24289. },
  24290. setup(props, { emit }) {
  24291. const instance = getCurrentInstance();
  24292. const parent = inject(TABLE_INJECTION_KEY);
  24293. const ns = useNamespace("table");
  24294. const filterPanels = ref({});
  24295. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  24296. onMounted(async () => {
  24297. await nextTick();
  24298. await nextTick();
  24299. const { prop, order: order2 } = props.defaultSort;
  24300. parent == null ? void 0 : parent.store.commit("sort", { prop, order: order2, init: true });
  24301. });
  24302. const {
  24303. handleHeaderClick,
  24304. handleHeaderContextMenu,
  24305. handleMouseDown,
  24306. handleMouseMove,
  24307. handleMouseOut,
  24308. handleSortClick,
  24309. handleFilterClick
  24310. } = useEvent(props, emit);
  24311. const {
  24312. getHeaderRowStyle,
  24313. getHeaderRowClass,
  24314. getHeaderCellStyle,
  24315. getHeaderCellClass
  24316. } = useStyle$2(props);
  24317. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  24318. instance.state = {
  24319. onColumnsChange,
  24320. onScrollableChange
  24321. };
  24322. instance.filterPanels = filterPanels;
  24323. return {
  24324. ns,
  24325. filterPanels,
  24326. onColumnsChange,
  24327. onScrollableChange,
  24328. columnRows,
  24329. getHeaderRowClass,
  24330. getHeaderRowStyle,
  24331. getHeaderCellClass,
  24332. getHeaderCellStyle,
  24333. handleHeaderClick,
  24334. handleHeaderContextMenu,
  24335. handleMouseDown,
  24336. handleMouseMove,
  24337. handleMouseOut,
  24338. handleSortClick,
  24339. handleFilterClick,
  24340. isGroup,
  24341. toggleAllSelection
  24342. };
  24343. },
  24344. render() {
  24345. const {
  24346. ns,
  24347. isGroup,
  24348. columnRows,
  24349. getHeaderCellStyle,
  24350. getHeaderCellClass,
  24351. getHeaderRowClass,
  24352. getHeaderRowStyle,
  24353. handleHeaderClick,
  24354. handleHeaderContextMenu,
  24355. handleMouseDown,
  24356. handleMouseMove,
  24357. handleSortClick,
  24358. handleMouseOut,
  24359. store,
  24360. $parent
  24361. } = this;
  24362. let rowSpan = 1;
  24363. return h$1("thead", {
  24364. class: { [ns.is("group")]: isGroup }
  24365. }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
  24366. class: getHeaderRowClass(rowIndex),
  24367. key: rowIndex,
  24368. style: getHeaderRowStyle(rowIndex)
  24369. }, subColumns.map((column, cellIndex) => {
  24370. if (column.rowSpan > rowSpan) {
  24371. rowSpan = column.rowSpan;
  24372. }
  24373. return h$1("th", {
  24374. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  24375. colspan: column.colSpan,
  24376. key: `${column.id}-thead`,
  24377. rowspan: column.rowSpan,
  24378. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  24379. onClick: ($event) => handleHeaderClick($event, column),
  24380. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  24381. onMousedown: ($event) => handleMouseDown($event, column),
  24382. onMousemove: ($event) => handleMouseMove($event, column),
  24383. onMouseout: handleMouseOut
  24384. }, [
  24385. h$1("div", {
  24386. class: [
  24387. "cell",
  24388. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : "",
  24389. column.labelClassName
  24390. ]
  24391. }, [
  24392. column.renderHeader ? column.renderHeader({
  24393. column,
  24394. $index: cellIndex,
  24395. store,
  24396. _self: $parent
  24397. }) : column.label,
  24398. column.sortable && h$1("span", {
  24399. onClick: ($event) => handleSortClick($event, column),
  24400. class: "caret-wrapper"
  24401. }, [
  24402. h$1("i", {
  24403. onClick: ($event) => handleSortClick($event, column, "ascending"),
  24404. class: "sort-caret ascending"
  24405. }),
  24406. h$1("i", {
  24407. onClick: ($event) => handleSortClick($event, column, "descending"),
  24408. class: "sort-caret descending"
  24409. })
  24410. ]),
  24411. column.filterable && h$1(FilterPanel, {
  24412. store,
  24413. placement: column.filterPlacement || "bottom-start",
  24414. column,
  24415. upDataColumn: (key, value) => {
  24416. column[key] = value;
  24417. }
  24418. })
  24419. ])
  24420. ]);
  24421. }))));
  24422. }
  24423. });
  24424. function useEvents(props) {
  24425. const parent = inject(TABLE_INJECTION_KEY);
  24426. const tooltipContent = ref("");
  24427. const tooltipTrigger = ref(h$1("div"));
  24428. const handleEvent = (event, row, name) => {
  24429. var _a2;
  24430. const table = parent;
  24431. const cell = getCell(event);
  24432. let column;
  24433. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  24434. if (cell) {
  24435. column = getColumnByCell({
  24436. columns: props.store.states.columns.value
  24437. }, cell, namespace);
  24438. if (column) {
  24439. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  24440. }
  24441. }
  24442. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  24443. };
  24444. const handleDoubleClick = (event, row) => {
  24445. handleEvent(event, row, "dblclick");
  24446. };
  24447. const handleClick = (event, row) => {
  24448. props.store.commit("setCurrentRow", row);
  24449. handleEvent(event, row, "click");
  24450. };
  24451. const handleContextMenu = (event, row) => {
  24452. handleEvent(event, row, "contextmenu");
  24453. };
  24454. const handleMouseEnter = debounce$1((index) => {
  24455. props.store.commit("setHoverRow", index);
  24456. }, 30);
  24457. const handleMouseLeave = debounce$1(() => {
  24458. props.store.commit("setHoverRow", null);
  24459. }, 30);
  24460. const handleCellMouseEnter = (event, row) => {
  24461. var _a2;
  24462. const table = parent;
  24463. const cell = getCell(event);
  24464. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  24465. if (cell) {
  24466. const column = getColumnByCell({
  24467. columns: props.store.states.columns.value
  24468. }, cell, namespace);
  24469. const hoverState = table.hoverState = { cell, column, row };
  24470. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  24471. }
  24472. const cellChild = event.target.querySelector(".cell");
  24473. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  24474. return;
  24475. }
  24476. const range3 = document.createRange();
  24477. range3.setStart(cellChild, 0);
  24478. range3.setEnd(cellChild, cellChild.childNodes.length);
  24479. const rangeWidth = range3.getBoundingClientRect().width;
  24480. const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0);
  24481. if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
  24482. createTablePopper(cell, cell.innerText || cell.textContent, {
  24483. placement: "top",
  24484. strategy: "fixed"
  24485. }, row.tooltipEffect);
  24486. }
  24487. };
  24488. const handleCellMouseLeave = (event) => {
  24489. const cell = getCell(event);
  24490. if (!cell)
  24491. return;
  24492. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  24493. 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);
  24494. };
  24495. return {
  24496. handleDoubleClick,
  24497. handleClick,
  24498. handleContextMenu,
  24499. handleMouseEnter,
  24500. handleMouseLeave,
  24501. handleCellMouseEnter,
  24502. handleCellMouseLeave,
  24503. tooltipContent,
  24504. tooltipTrigger
  24505. };
  24506. }
  24507. function useStyles(props) {
  24508. const parent = inject(TABLE_INJECTION_KEY);
  24509. const ns = useNamespace("table");
  24510. const getRowStyle = (row, rowIndex) => {
  24511. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  24512. if (typeof rowStyle === "function") {
  24513. return rowStyle.call(null, {
  24514. row,
  24515. rowIndex
  24516. });
  24517. }
  24518. return rowStyle || null;
  24519. };
  24520. const getRowClass = (row, rowIndex) => {
  24521. const classes = [ns.e("row")];
  24522. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  24523. classes.push("current-row");
  24524. }
  24525. if (props.stripe && rowIndex % 2 === 1) {
  24526. classes.push(ns.em("row", "striped"));
  24527. }
  24528. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  24529. if (typeof rowClassName === "string") {
  24530. classes.push(rowClassName);
  24531. } else if (typeof rowClassName === "function") {
  24532. classes.push(rowClassName.call(null, {
  24533. row,
  24534. rowIndex
  24535. }));
  24536. }
  24537. return classes;
  24538. };
  24539. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  24540. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  24541. let cellStyles = cellStyle != null ? cellStyle : {};
  24542. if (typeof cellStyle === "function") {
  24543. cellStyles = cellStyle.call(null, {
  24544. rowIndex,
  24545. columnIndex,
  24546. row,
  24547. column
  24548. });
  24549. }
  24550. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  24551. ensurePosition(fixedStyle, "left");
  24552. ensurePosition(fixedStyle, "right");
  24553. return Object.assign({}, cellStyles, fixedStyle);
  24554. };
  24555. const getCellClass = (rowIndex, columnIndex, row, column) => {
  24556. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store);
  24557. const classes = [column.id, column.align, column.className, ...fixedClasses];
  24558. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  24559. if (typeof cellClassName === "string") {
  24560. classes.push(cellClassName);
  24561. } else if (typeof cellClassName === "function") {
  24562. classes.push(cellClassName.call(null, {
  24563. rowIndex,
  24564. columnIndex,
  24565. row,
  24566. column
  24567. }));
  24568. }
  24569. classes.push(ns.e("cell"));
  24570. return classes.filter((className) => Boolean(className)).join(" ");
  24571. };
  24572. const getSpan = (row, column, rowIndex, columnIndex) => {
  24573. let rowspan = 1;
  24574. let colspan = 1;
  24575. const fn2 = parent == null ? void 0 : parent.props.spanMethod;
  24576. if (typeof fn2 === "function") {
  24577. const result = fn2({
  24578. row,
  24579. column,
  24580. rowIndex,
  24581. columnIndex
  24582. });
  24583. if (Array.isArray(result)) {
  24584. rowspan = result[0];
  24585. colspan = result[1];
  24586. } else if (typeof result === "object") {
  24587. rowspan = result.rowspan;
  24588. colspan = result.colspan;
  24589. }
  24590. }
  24591. return { rowspan, colspan };
  24592. };
  24593. const getColspanRealWidth = (columns, colspan, index) => {
  24594. if (colspan < 1) {
  24595. return columns[index].realWidth;
  24596. }
  24597. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  24598. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  24599. };
  24600. return {
  24601. getRowStyle,
  24602. getRowClass,
  24603. getCellStyle,
  24604. getCellClass,
  24605. getSpan,
  24606. getColspanRealWidth
  24607. };
  24608. }
  24609. function useRender$1(props) {
  24610. const parent = inject(TABLE_INJECTION_KEY);
  24611. const {
  24612. handleDoubleClick,
  24613. handleClick,
  24614. handleContextMenu,
  24615. handleMouseEnter,
  24616. handleMouseLeave,
  24617. handleCellMouseEnter,
  24618. handleCellMouseLeave,
  24619. tooltipContent,
  24620. tooltipTrigger
  24621. } = useEvents(props);
  24622. const {
  24623. getRowStyle,
  24624. getRowClass,
  24625. getCellStyle,
  24626. getCellClass,
  24627. getSpan,
  24628. getColspanRealWidth
  24629. } = useStyles(props);
  24630. const firstDefaultColumnIndex = computed(() => {
  24631. return props.store.states.columns.value.findIndex(({ type: type4 }) => type4 === "default");
  24632. });
  24633. const getKeyOfRow = (row, index) => {
  24634. const rowKey = parent.props.rowKey;
  24635. if (rowKey) {
  24636. return getRowIdentity(row, rowKey);
  24637. }
  24638. return index;
  24639. };
  24640. const rowRender = (row, $index, treeRowData, expanded = false) => {
  24641. const { tooltipEffect, store } = props;
  24642. const { indent, columns } = store.states;
  24643. const rowClasses = getRowClass(row, $index);
  24644. let display = true;
  24645. if (treeRowData) {
  24646. rowClasses.push(`el-table__row--level-${treeRowData.level}`);
  24647. display = treeRowData.display;
  24648. }
  24649. const displayStyle = display ? null : {
  24650. display: "none"
  24651. };
  24652. return h$1("tr", {
  24653. style: [displayStyle, getRowStyle(row, $index)],
  24654. class: rowClasses,
  24655. key: getKeyOfRow(row, $index),
  24656. onDblclick: ($event) => handleDoubleClick($event, row),
  24657. onClick: ($event) => handleClick($event, row),
  24658. onContextmenu: ($event) => handleContextMenu($event, row),
  24659. onMouseenter: () => handleMouseEnter($index),
  24660. onMouseleave: handleMouseLeave
  24661. }, columns.value.map((column, cellIndex) => {
  24662. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  24663. if (!rowspan || !colspan) {
  24664. return null;
  24665. }
  24666. const columnData = __spreadValues({}, column);
  24667. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  24668. const data2 = {
  24669. store: props.store,
  24670. _self: props.context || parent,
  24671. column: columnData,
  24672. row,
  24673. $index,
  24674. cellIndex,
  24675. expanded
  24676. };
  24677. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  24678. data2.treeNode = {
  24679. indent: treeRowData.level * indent.value,
  24680. level: treeRowData.level
  24681. };
  24682. if (typeof treeRowData.expanded === "boolean") {
  24683. data2.treeNode.expanded = treeRowData.expanded;
  24684. if ("loading" in treeRowData) {
  24685. data2.treeNode.loading = treeRowData.loading;
  24686. }
  24687. if ("noLazyChildren" in treeRowData) {
  24688. data2.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  24689. }
  24690. }
  24691. }
  24692. const baseKey = `${$index},${cellIndex}`;
  24693. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  24694. const tdChildren = cellChildren(cellIndex, column, data2);
  24695. return h$1("td", {
  24696. style: getCellStyle($index, cellIndex, row, column),
  24697. class: getCellClass($index, cellIndex, row, column),
  24698. key: `${patchKey}${baseKey}`,
  24699. rowspan,
  24700. colspan,
  24701. onMouseenter: ($event) => handleCellMouseEnter($event, __spreadProps(__spreadValues({}, row), { tooltipEffect })),
  24702. onMouseleave: handleCellMouseLeave
  24703. }, [tdChildren]);
  24704. }));
  24705. };
  24706. const cellChildren = (cellIndex, column, data2) => {
  24707. return column.renderCell(data2);
  24708. };
  24709. const wrappedRowRender = (row, $index) => {
  24710. const store = props.store;
  24711. const { isRowExpanded, assertRowKey } = store;
  24712. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  24713. const columns = store.states.columns.value;
  24714. const hasExpandColumn = columns.some(({ type: type4 }) => type4 === "expand");
  24715. if (hasExpandColumn) {
  24716. const expanded = isRowExpanded(row);
  24717. const tr = rowRender(row, $index, void 0, expanded);
  24718. const renderExpanded = parent.renderExpanded;
  24719. if (expanded) {
  24720. if (!renderExpanded) {
  24721. console.error("[Element Error]renderExpanded is required.");
  24722. return tr;
  24723. }
  24724. return [
  24725. [
  24726. tr,
  24727. h$1("tr", {
  24728. key: `expanded-row__${tr.key}`
  24729. }, [
  24730. h$1("td", {
  24731. colspan: columns.length,
  24732. class: "el-table__cell el-table__expanded-cell"
  24733. }, [renderExpanded({ row, $index, store, expanded })])
  24734. ])
  24735. ]
  24736. ];
  24737. } else {
  24738. return [[tr]];
  24739. }
  24740. } else if (Object.keys(treeData.value).length) {
  24741. assertRowKey();
  24742. const key = getRowIdentity(row, rowKey.value);
  24743. let cur = treeData.value[key];
  24744. let treeRowData = null;
  24745. if (cur) {
  24746. treeRowData = {
  24747. expanded: cur.expanded,
  24748. level: cur.level,
  24749. display: true
  24750. };
  24751. if (typeof cur.lazy === "boolean") {
  24752. if (typeof cur.loaded === "boolean" && cur.loaded) {
  24753. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  24754. }
  24755. treeRowData.loading = cur.loading;
  24756. }
  24757. }
  24758. const tmp = [rowRender(row, $index, treeRowData)];
  24759. if (cur) {
  24760. let i = 0;
  24761. const traverse = (children, parent2) => {
  24762. if (!(children && children.length && parent2))
  24763. return;
  24764. children.forEach((node) => {
  24765. const innerTreeRowData = {
  24766. display: parent2.display && parent2.expanded,
  24767. level: parent2.level + 1,
  24768. expanded: false,
  24769. noLazyChildren: false,
  24770. loading: false
  24771. };
  24772. const childKey = getRowIdentity(node, rowKey.value);
  24773. if (childKey === void 0 || childKey === null) {
  24774. throw new Error("For nested data item, row-key is required.");
  24775. }
  24776. cur = __spreadValues({}, treeData.value[childKey]);
  24777. if (cur) {
  24778. innerTreeRowData.expanded = cur.expanded;
  24779. cur.level = cur.level || innerTreeRowData.level;
  24780. cur.display = !!(cur.expanded && innerTreeRowData.display);
  24781. if (typeof cur.lazy === "boolean") {
  24782. if (typeof cur.loaded === "boolean" && cur.loaded) {
  24783. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  24784. }
  24785. innerTreeRowData.loading = cur.loading;
  24786. }
  24787. }
  24788. i++;
  24789. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  24790. if (cur) {
  24791. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  24792. traverse(nodes2, cur);
  24793. }
  24794. });
  24795. };
  24796. cur.display = true;
  24797. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  24798. traverse(nodes, cur);
  24799. }
  24800. return tmp;
  24801. } else {
  24802. return rowRender(row, $index, void 0);
  24803. }
  24804. };
  24805. return {
  24806. wrappedRowRender,
  24807. tooltipContent,
  24808. tooltipTrigger
  24809. };
  24810. }
  24811. const defaultProps$2 = {
  24812. store: {
  24813. required: true,
  24814. type: Object
  24815. },
  24816. stripe: Boolean,
  24817. tooltipEffect: String,
  24818. context: {
  24819. default: () => ({}),
  24820. type: Object
  24821. },
  24822. rowClassName: [String, Function],
  24823. rowStyle: [Object, Function],
  24824. fixed: {
  24825. type: String,
  24826. default: ""
  24827. },
  24828. highlight: Boolean
  24829. };
  24830. var TableBody = defineComponent({
  24831. name: "ElTableBody",
  24832. props: defaultProps$2,
  24833. setup(props) {
  24834. const instance = getCurrentInstance();
  24835. const parent = inject(TABLE_INJECTION_KEY);
  24836. const ns = useNamespace("table");
  24837. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  24838. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  24839. watch(props.store.states.hoverRow, (newVal, oldVal) => {
  24840. if (!props.store.states.isComplex.value || !isClient$1)
  24841. return;
  24842. let raf = window.requestAnimationFrame;
  24843. if (!raf) {
  24844. raf = (fn2) => window.setTimeout(fn2, 16);
  24845. }
  24846. raf(() => {
  24847. var _a2;
  24848. const rows = (_a2 = instance == null ? void 0 : instance.vnode.el) == null ? void 0 : _a2.querySelectorAll(`.${ns.e("row")}`);
  24849. const oldRow = rows[oldVal];
  24850. const newRow = rows[newVal];
  24851. if (oldRow) {
  24852. removeClass(oldRow, "hover-row");
  24853. }
  24854. if (newRow) {
  24855. addClass(newRow, "hover-row");
  24856. }
  24857. });
  24858. });
  24859. onUnmounted(() => {
  24860. var _a2;
  24861. (_a2 = removePopper) == null ? void 0 : _a2();
  24862. });
  24863. onUpdated(() => {
  24864. var _a2;
  24865. (_a2 = removePopper) == null ? void 0 : _a2();
  24866. });
  24867. return {
  24868. ns,
  24869. onColumnsChange,
  24870. onScrollableChange,
  24871. wrappedRowRender,
  24872. tooltipContent,
  24873. tooltipTrigger
  24874. };
  24875. },
  24876. render() {
  24877. const { wrappedRowRender, store } = this;
  24878. const data2 = store.states.data.value || [];
  24879. return h$1("tbody", {}, [
  24880. data2.reduce((acc, row) => {
  24881. return acc.concat(wrappedRowRender(row, acc.length));
  24882. }, [])
  24883. ]);
  24884. }
  24885. });
  24886. function hColgroup(props) {
  24887. const isAuto = props.tableLayout === "auto";
  24888. let columns = props.columns || [];
  24889. if (isAuto) {
  24890. if (columns.every((column) => column.width === void 0)) {
  24891. columns = [];
  24892. }
  24893. }
  24894. const getPropsData = (column) => {
  24895. const propsData = {
  24896. key: `${props.tableLayout}_${column.id}`,
  24897. style: {},
  24898. name: void 0
  24899. };
  24900. if (isAuto) {
  24901. propsData.style = {
  24902. width: `${column.width}px`
  24903. };
  24904. } else {
  24905. propsData.name = column.id;
  24906. }
  24907. return propsData;
  24908. };
  24909. return h$1("colgroup", {}, columns.map((column) => h$1("col", getPropsData(column))));
  24910. }
  24911. hColgroup.props = ["columns", "tableLayout"];
  24912. function useMapState() {
  24913. const table = inject(TABLE_INJECTION_KEY);
  24914. const store = table == null ? void 0 : table.store;
  24915. const leftFixedLeafCount = computed(() => {
  24916. return store.states.fixedLeafColumnsLength.value;
  24917. });
  24918. const rightFixedLeafCount = computed(() => {
  24919. return store.states.rightFixedColumns.value.length;
  24920. });
  24921. const columnsCount = computed(() => {
  24922. return store.states.columns.value.length;
  24923. });
  24924. const leftFixedCount = computed(() => {
  24925. return store.states.fixedColumns.value.length;
  24926. });
  24927. const rightFixedCount = computed(() => {
  24928. return store.states.rightFixedColumns.value.length;
  24929. });
  24930. return {
  24931. leftFixedLeafCount,
  24932. rightFixedLeafCount,
  24933. columnsCount,
  24934. leftFixedCount,
  24935. rightFixedCount,
  24936. columns: store.states.columns
  24937. };
  24938. }
  24939. function useStyle$1(props) {
  24940. const { columns } = useMapState();
  24941. const ns = useNamespace("table");
  24942. const getCellClasses = (columns2, cellIndex) => {
  24943. const column = columns2[cellIndex];
  24944. const classes = [
  24945. ns.e("cell"),
  24946. column.id,
  24947. column.align,
  24948. column.labelClassName,
  24949. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  24950. ];
  24951. if (column.className) {
  24952. classes.push(column.className);
  24953. }
  24954. if (!column.children) {
  24955. classes.push(ns.is("leaf"));
  24956. }
  24957. return classes;
  24958. };
  24959. const getCellStyles = (column, cellIndex) => {
  24960. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  24961. ensurePosition(fixedStyle, "left");
  24962. ensurePosition(fixedStyle, "right");
  24963. return fixedStyle;
  24964. };
  24965. return {
  24966. getCellClasses,
  24967. getCellStyles,
  24968. columns
  24969. };
  24970. }
  24971. var TableFooter = defineComponent({
  24972. name: "ElTableFooter",
  24973. props: {
  24974. fixed: {
  24975. type: String,
  24976. default: ""
  24977. },
  24978. store: {
  24979. required: true,
  24980. type: Object
  24981. },
  24982. summaryMethod: Function,
  24983. sumText: String,
  24984. border: Boolean,
  24985. defaultSort: {
  24986. type: Object,
  24987. default: () => {
  24988. return {
  24989. prop: "",
  24990. order: ""
  24991. };
  24992. }
  24993. }
  24994. },
  24995. setup(props) {
  24996. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  24997. const ns = useNamespace("table");
  24998. return {
  24999. ns,
  25000. getCellClasses,
  25001. getCellStyles,
  25002. columns
  25003. };
  25004. },
  25005. render() {
  25006. const {
  25007. columns,
  25008. getCellStyles,
  25009. getCellClasses,
  25010. summaryMethod,
  25011. sumText,
  25012. ns
  25013. } = this;
  25014. const data2 = this.store.states.data.value;
  25015. let sums = [];
  25016. if (summaryMethod) {
  25017. sums = summaryMethod({
  25018. columns,
  25019. data: data2
  25020. });
  25021. } else {
  25022. columns.forEach((column, index) => {
  25023. if (index === 0) {
  25024. sums[index] = sumText;
  25025. return;
  25026. }
  25027. const values = data2.map((item) => Number(item[column.property]));
  25028. const precisions = [];
  25029. let notNumber = true;
  25030. values.forEach((value) => {
  25031. if (!Number.isNaN(+value)) {
  25032. notNumber = false;
  25033. const decimal = `${value}`.split(".")[1];
  25034. precisions.push(decimal ? decimal.length : 0);
  25035. }
  25036. });
  25037. const precision = Math.max.apply(null, precisions);
  25038. if (!notNumber) {
  25039. sums[index] = values.reduce((prev, curr) => {
  25040. const value = Number(curr);
  25041. if (!Number.isNaN(+value)) {
  25042. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  25043. } else {
  25044. return prev;
  25045. }
  25046. }, 0);
  25047. } else {
  25048. sums[index] = "";
  25049. }
  25050. });
  25051. }
  25052. return h$1("table", {
  25053. class: ns.e("footer"),
  25054. cellspacing: "0",
  25055. cellpadding: "0",
  25056. border: "0"
  25057. }, [
  25058. hColgroup({
  25059. columns
  25060. }),
  25061. h$1("tbody", [
  25062. h$1("tr", {}, [
  25063. ...columns.map((column, cellIndex) => h$1("td", {
  25064. key: cellIndex,
  25065. colspan: column.colSpan,
  25066. rowspan: column.rowSpan,
  25067. class: getCellClasses(columns, cellIndex),
  25068. style: getCellStyles(column, cellIndex)
  25069. }, [
  25070. h$1("div", {
  25071. class: ["cell", column.labelClassName]
  25072. }, [sums[cellIndex]])
  25073. ]))
  25074. ])
  25075. ])
  25076. ]);
  25077. }
  25078. });
  25079. function useUtils(store) {
  25080. const setCurrentRow = (row) => {
  25081. store.commit("setCurrentRow", row);
  25082. };
  25083. const getSelectionRows = () => {
  25084. return store.getSelectionRows();
  25085. };
  25086. const toggleRowSelection = (row, selected) => {
  25087. store.toggleRowSelection(row, selected, false);
  25088. store.updateAllSelected();
  25089. };
  25090. const clearSelection = () => {
  25091. store.clearSelection();
  25092. };
  25093. const clearFilter = (columnKeys) => {
  25094. store.clearFilter(columnKeys);
  25095. };
  25096. const toggleAllSelection = () => {
  25097. store.commit("toggleAllSelection");
  25098. };
  25099. const toggleRowExpansion = (row, expanded) => {
  25100. store.toggleRowExpansionAdapter(row, expanded);
  25101. };
  25102. const clearSort = () => {
  25103. store.clearSort();
  25104. };
  25105. const sort = (prop, order2) => {
  25106. store.commit("sort", { prop, order: order2 });
  25107. };
  25108. return {
  25109. setCurrentRow,
  25110. getSelectionRows,
  25111. toggleRowSelection,
  25112. clearSelection,
  25113. clearFilter,
  25114. toggleAllSelection,
  25115. toggleRowExpansion,
  25116. clearSort,
  25117. sort
  25118. };
  25119. }
  25120. function useStyle(props, layout, store, table) {
  25121. const isHidden = ref(false);
  25122. const renderExpanded = ref(null);
  25123. const resizeProxyVisible = ref(false);
  25124. const setDragVisible = (visible) => {
  25125. resizeProxyVisible.value = visible;
  25126. };
  25127. const resizeState = ref({
  25128. width: null,
  25129. height: null
  25130. });
  25131. const isGroup = ref(false);
  25132. const scrollbarViewStyle = {
  25133. display: "inline-block",
  25134. verticalAlign: "middle"
  25135. };
  25136. const tableWidth = ref();
  25137. watchEffect(() => {
  25138. layout.setHeight(props.height);
  25139. });
  25140. watchEffect(() => {
  25141. layout.setMaxHeight(props.maxHeight);
  25142. });
  25143. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  25144. if (!unref(rowKey))
  25145. return;
  25146. store.setCurrentRowKey(`${currentRowKey}`);
  25147. }, {
  25148. immediate: true
  25149. });
  25150. watch(() => props.data, (data2) => {
  25151. table.store.commit("setData", data2);
  25152. }, {
  25153. immediate: true,
  25154. deep: true
  25155. });
  25156. watchEffect(() => {
  25157. if (props.expandRowKeys) {
  25158. store.setExpandRowKeysAdapter(props.expandRowKeys);
  25159. }
  25160. });
  25161. const handleMouseLeave = () => {
  25162. table.store.commit("setHoverRow", null);
  25163. if (table.hoverState)
  25164. table.hoverState = null;
  25165. };
  25166. const handleHeaderFooterMousewheel = (event, data2) => {
  25167. const { pixelX, pixelY } = data2;
  25168. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  25169. table.refs.bodyWrapper.scrollLeft += data2.pixelX / 5;
  25170. }
  25171. };
  25172. const shouldUpdateHeight = computed(() => {
  25173. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  25174. });
  25175. const tableBodyStyles = computed(() => {
  25176. return {
  25177. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  25178. };
  25179. });
  25180. const doLayout = () => {
  25181. if (shouldUpdateHeight.value) {
  25182. layout.updateElsHeight();
  25183. }
  25184. layout.updateColumnsWidth();
  25185. requestAnimationFrame(syncPostion);
  25186. };
  25187. onMounted(async () => {
  25188. await nextTick();
  25189. store.updateColumns();
  25190. bindEvents();
  25191. requestAnimationFrame(doLayout);
  25192. resizeState.value = {
  25193. width: tableWidth.value = table.vnode.el.offsetWidth,
  25194. height: table.vnode.el.offsetHeight
  25195. };
  25196. store.states.columns.value.forEach((column) => {
  25197. if (column.filteredValue && column.filteredValue.length) {
  25198. table.store.commit("filterChange", {
  25199. column,
  25200. values: column.filteredValue,
  25201. silent: true
  25202. });
  25203. }
  25204. });
  25205. table.$ready = true;
  25206. });
  25207. const setScrollClassByEl = (el, className) => {
  25208. if (!el)
  25209. return;
  25210. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  25211. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  25212. el.className = classList.join(" ");
  25213. };
  25214. const setScrollClass = (className) => {
  25215. const { tableWrapper } = table.refs;
  25216. setScrollClassByEl(tableWrapper, className);
  25217. };
  25218. const hasScrollClass = (className) => {
  25219. const { tableWrapper } = table.refs;
  25220. if (tableWrapper && tableWrapper.classList.contains(className)) {
  25221. return true;
  25222. }
  25223. return false;
  25224. };
  25225. const syncPostion = function() {
  25226. if (!table.refs.scrollBarRef)
  25227. return;
  25228. if (!layout.scrollX.value) {
  25229. const scrollingNoneClass = "is-scrolling-none";
  25230. if (!hasScrollClass(scrollingNoneClass)) {
  25231. setScrollClass(scrollingNoneClass);
  25232. }
  25233. return;
  25234. }
  25235. const scrollContainer = table.refs.scrollBarRef.wrap$;
  25236. if (!scrollContainer)
  25237. return;
  25238. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  25239. const { headerWrapper, footerWrapper } = table.refs;
  25240. if (headerWrapper)
  25241. headerWrapper.scrollLeft = scrollLeft;
  25242. if (footerWrapper)
  25243. footerWrapper.scrollLeft = scrollLeft;
  25244. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  25245. if (scrollLeft >= maxScrollLeftPosition) {
  25246. setScrollClass("is-scrolling-right");
  25247. } else if (scrollLeft === 0) {
  25248. setScrollClass("is-scrolling-left");
  25249. } else {
  25250. setScrollClass("is-scrolling-middle");
  25251. }
  25252. };
  25253. const bindEvents = () => {
  25254. var _a2;
  25255. if (!table.refs.scrollBarRef)
  25256. return;
  25257. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.addEventListener("scroll", syncPostion, {
  25258. passive: true
  25259. });
  25260. if (props.fit) {
  25261. addResizeListener(table.vnode.el, resizeListener);
  25262. } else {
  25263. on(window, "resize", doLayout);
  25264. }
  25265. };
  25266. onBeforeUnmount(() => {
  25267. unbindEvents();
  25268. });
  25269. const unbindEvents = () => {
  25270. var _a2;
  25271. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.removeEventListener("scroll", syncPostion, true);
  25272. if (props.fit) {
  25273. removeResizeListener(table.vnode.el, resizeListener);
  25274. } else {
  25275. off(window, "resize", doLayout);
  25276. }
  25277. };
  25278. const resizeListener = () => {
  25279. if (!table.$ready)
  25280. return;
  25281. let shouldUpdateLayout = false;
  25282. const el = table.vnode.el;
  25283. const { width: oldWidth, height: oldHeight } = resizeState.value;
  25284. const width = tableWidth.value = el.offsetWidth;
  25285. if (oldWidth !== width) {
  25286. shouldUpdateLayout = true;
  25287. }
  25288. const height2 = el.offsetHeight;
  25289. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height2) {
  25290. shouldUpdateLayout = true;
  25291. }
  25292. if (shouldUpdateLayout) {
  25293. resizeState.value = {
  25294. width,
  25295. height: height2
  25296. };
  25297. doLayout();
  25298. }
  25299. };
  25300. const tableSize = useSize();
  25301. const bodyWidth = computed(() => {
  25302. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  25303. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  25304. });
  25305. const tableLayout = computed(() => {
  25306. if (props.maxHeight)
  25307. return "fixed";
  25308. return props.tableLayout;
  25309. });
  25310. function calcMaxHeight(maxHeight, footerHeight, headerHeight) {
  25311. const parsedMaxHeight = parseHeight(maxHeight);
  25312. const tableHeaderHeight = props.showHeader ? headerHeight : 0;
  25313. if (parsedMaxHeight === null)
  25314. return;
  25315. if (isString(parsedMaxHeight)) {
  25316. return `calc(${parsedMaxHeight} - ${footerHeight}px - ${tableHeaderHeight}px)`;
  25317. }
  25318. return parsedMaxHeight - footerHeight - tableHeaderHeight;
  25319. }
  25320. const height = computed(() => {
  25321. const headerHeight = layout.headerHeight.value || 0;
  25322. const bodyHeight2 = layout.bodyHeight.value;
  25323. const footerHeight = layout.footerHeight.value || 0;
  25324. if (props.height) {
  25325. return bodyHeight2 ? bodyHeight2 : void 0;
  25326. } else if (props.maxHeight) {
  25327. return calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  25328. }
  25329. return void 0;
  25330. });
  25331. const bodyHeight = computed(() => {
  25332. const headerHeight = layout.headerHeight.value || 0;
  25333. const bodyHeight2 = layout.bodyHeight.value;
  25334. const footerHeight = layout.footerHeight.value || 0;
  25335. if (props.height) {
  25336. return {
  25337. height: bodyHeight2 ? `${bodyHeight2}px` : ""
  25338. };
  25339. } else if (props.maxHeight) {
  25340. const maxHeight = calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  25341. if (maxHeight !== null) {
  25342. return {
  25343. "max-height": `${maxHeight}${isNumber(maxHeight) ? "px" : ""}`
  25344. };
  25345. }
  25346. }
  25347. return {};
  25348. });
  25349. const emptyBlockStyle = computed(() => {
  25350. if (props.data && props.data.length)
  25351. return null;
  25352. let height2 = "100%";
  25353. if (layout.appendHeight.value) {
  25354. height2 = `calc(100% - ${layout.appendHeight.value}px)`;
  25355. }
  25356. return {
  25357. width: tableWidth.value ? `${tableWidth.value}px` : "",
  25358. height: height2
  25359. };
  25360. });
  25361. const handleFixedMousewheel = (event, data2) => {
  25362. const bodyWrapper = table.refs.bodyWrapper;
  25363. if (Math.abs(data2.spinY) > 0) {
  25364. const currentScrollTop = bodyWrapper.scrollTop;
  25365. if (data2.pixelY < 0 && currentScrollTop !== 0) {
  25366. event.preventDefault();
  25367. }
  25368. if (data2.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  25369. event.preventDefault();
  25370. }
  25371. bodyWrapper.scrollTop += Math.ceil(data2.pixelY / 5);
  25372. } else {
  25373. bodyWrapper.scrollLeft += Math.ceil(data2.pixelX / 5);
  25374. }
  25375. };
  25376. const fixedHeight = computed(() => {
  25377. if (props.maxHeight) {
  25378. if (props.showSummary) {
  25379. return {
  25380. bottom: 0
  25381. };
  25382. }
  25383. return {
  25384. bottom: layout.scrollX.value && props.data.length ? `${layout.gutterWidth}px` : ""
  25385. };
  25386. } else {
  25387. if (props.showSummary) {
  25388. return {
  25389. height: layout.tableHeight.value ? `${layout.tableHeight.value}px` : ""
  25390. };
  25391. }
  25392. return {
  25393. height: layout.viewportHeight.value ? `${layout.viewportHeight.value}px` : ""
  25394. };
  25395. }
  25396. });
  25397. const fixedBodyHeight = computed(() => {
  25398. if (props.height) {
  25399. return {
  25400. height: layout.fixedBodyHeight.value ? `${layout.fixedBodyHeight.value}px` : ""
  25401. };
  25402. } else if (props.maxHeight) {
  25403. let maxHeight = parseHeight(props.maxHeight);
  25404. if (typeof maxHeight === "number") {
  25405. maxHeight = layout.scrollX.value ? maxHeight - layout.gutterWidth : maxHeight;
  25406. if (props.showHeader) {
  25407. maxHeight -= layout.headerHeight.value;
  25408. }
  25409. maxHeight -= layout.footerHeight.value;
  25410. return {
  25411. "max-height": `${maxHeight}px`
  25412. };
  25413. }
  25414. }
  25415. return {};
  25416. });
  25417. return {
  25418. isHidden,
  25419. renderExpanded,
  25420. setDragVisible,
  25421. isGroup,
  25422. handleMouseLeave,
  25423. handleHeaderFooterMousewheel,
  25424. tableSize,
  25425. bodyHeight,
  25426. height,
  25427. emptyBlockStyle,
  25428. handleFixedMousewheel,
  25429. fixedHeight,
  25430. fixedBodyHeight,
  25431. resizeProxyVisible,
  25432. bodyWidth,
  25433. resizeState,
  25434. doLayout,
  25435. tableBodyStyles,
  25436. tableLayout,
  25437. scrollbarViewStyle
  25438. };
  25439. }
  25440. var defaultProps$1 = {
  25441. data: {
  25442. type: Array,
  25443. default: () => {
  25444. return [];
  25445. }
  25446. },
  25447. size: String,
  25448. width: [String, Number],
  25449. height: [String, Number],
  25450. maxHeight: [String, Number],
  25451. fit: {
  25452. type: Boolean,
  25453. default: true
  25454. },
  25455. stripe: Boolean,
  25456. border: Boolean,
  25457. rowKey: [String, Function],
  25458. showHeader: {
  25459. type: Boolean,
  25460. default: true
  25461. },
  25462. showSummary: Boolean,
  25463. sumText: String,
  25464. summaryMethod: Function,
  25465. rowClassName: [String, Function],
  25466. rowStyle: [Object, Function],
  25467. cellClassName: [String, Function],
  25468. cellStyle: [Object, Function],
  25469. headerRowClassName: [String, Function],
  25470. headerRowStyle: [Object, Function],
  25471. headerCellClassName: [String, Function],
  25472. headerCellStyle: [Object, Function],
  25473. highlightCurrentRow: Boolean,
  25474. currentRowKey: [String, Number],
  25475. emptyText: String,
  25476. expandRowKeys: Array,
  25477. defaultExpandAll: Boolean,
  25478. defaultSort: Object,
  25479. tooltipEffect: String,
  25480. spanMethod: Function,
  25481. selectOnIndeterminate: {
  25482. type: Boolean,
  25483. default: true
  25484. },
  25485. indent: {
  25486. type: Number,
  25487. default: 16
  25488. },
  25489. treeProps: {
  25490. type: Object,
  25491. default: () => {
  25492. return {
  25493. hasChildren: "hasChildren",
  25494. children: "children"
  25495. };
  25496. }
  25497. },
  25498. lazy: Boolean,
  25499. load: Function,
  25500. style: {
  25501. type: Object,
  25502. default: () => ({})
  25503. },
  25504. className: {
  25505. type: String,
  25506. default: ""
  25507. },
  25508. tableLayout: {
  25509. type: String,
  25510. default: "fixed"
  25511. },
  25512. scrollbarAlwaysOn: {
  25513. type: Boolean,
  25514. default: false
  25515. }
  25516. };
  25517. const useScrollbar = () => {
  25518. const scrollBarRef = ref();
  25519. const scrollTo = (options, yCoord) => {
  25520. const scrollbar = scrollBarRef.value;
  25521. if (scrollbar) {
  25522. scrollbar.scrollTo(options, yCoord);
  25523. }
  25524. };
  25525. const setScrollPosition = (position, offset2) => {
  25526. const scrollbar = scrollBarRef.value;
  25527. if (scrollbar && isNumber(offset2) && ["Top", "Left"].includes(position)) {
  25528. scrollbar[`setScroll${position}`](offset2);
  25529. }
  25530. };
  25531. const setScrollTop = (top2) => setScrollPosition("Top", top2);
  25532. const setScrollLeft = (left2) => setScrollPosition("Left", left2);
  25533. return {
  25534. scrollBarRef,
  25535. scrollTo,
  25536. setScrollTop,
  25537. setScrollLeft
  25538. };
  25539. };
  25540. let tableIdSeed = 1;
  25541. const _sfc_main$d = defineComponent({
  25542. name: "ElTable",
  25543. directives: {
  25544. Mousewheel
  25545. },
  25546. components: {
  25547. TableHeader,
  25548. TableBody,
  25549. TableFooter,
  25550. ElScrollbar,
  25551. hColgroup
  25552. },
  25553. props: defaultProps$1,
  25554. emits: [
  25555. "select",
  25556. "select-all",
  25557. "selection-change",
  25558. "cell-mouse-enter",
  25559. "cell-mouse-leave",
  25560. "cell-contextmenu",
  25561. "cell-click",
  25562. "cell-dblclick",
  25563. "row-click",
  25564. "row-contextmenu",
  25565. "row-dblclick",
  25566. "header-click",
  25567. "header-contextmenu",
  25568. "sort-change",
  25569. "filter-change",
  25570. "current-change",
  25571. "header-dragend",
  25572. "expand-change"
  25573. ],
  25574. setup(props) {
  25575. const { t } = useLocale();
  25576. const ns = useNamespace("table");
  25577. const table = getCurrentInstance();
  25578. provide(TABLE_INJECTION_KEY, table);
  25579. const store = createStore(table, props);
  25580. table.store = store;
  25581. const layout = new TableLayout({
  25582. store: table.store,
  25583. table,
  25584. fit: props.fit,
  25585. showHeader: props.showHeader
  25586. });
  25587. table.layout = layout;
  25588. const isEmpty3 = computed(() => (store.states.data.value || []).length === 0);
  25589. const {
  25590. setCurrentRow,
  25591. getSelectionRows,
  25592. toggleRowSelection,
  25593. clearSelection,
  25594. clearFilter,
  25595. toggleAllSelection,
  25596. toggleRowExpansion,
  25597. clearSort,
  25598. sort
  25599. } = useUtils(store);
  25600. const {
  25601. isHidden,
  25602. renderExpanded,
  25603. setDragVisible,
  25604. isGroup,
  25605. handleMouseLeave,
  25606. handleHeaderFooterMousewheel,
  25607. tableSize,
  25608. bodyHeight,
  25609. height,
  25610. emptyBlockStyle,
  25611. handleFixedMousewheel,
  25612. fixedHeight,
  25613. fixedBodyHeight,
  25614. resizeProxyVisible,
  25615. bodyWidth,
  25616. resizeState,
  25617. doLayout,
  25618. tableBodyStyles,
  25619. tableLayout,
  25620. scrollbarViewStyle
  25621. } = useStyle(props, layout, store, table);
  25622. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar();
  25623. const debouncedUpdateLayout = debounce$1(doLayout, 50);
  25624. const tableId = `el-table_${tableIdSeed++}`;
  25625. table.tableId = tableId;
  25626. table.state = {
  25627. isGroup,
  25628. resizeState,
  25629. doLayout,
  25630. debouncedUpdateLayout
  25631. };
  25632. const computedSumText = computed(() => props.sumText || t("el.table.sumText"));
  25633. const computedEmptyText = computed(() => {
  25634. return props.emptyText || t("el.table.emptyText");
  25635. });
  25636. return {
  25637. ns,
  25638. layout,
  25639. store,
  25640. handleHeaderFooterMousewheel,
  25641. handleMouseLeave,
  25642. tableId,
  25643. tableSize,
  25644. isHidden,
  25645. isEmpty: isEmpty3,
  25646. renderExpanded,
  25647. resizeProxyVisible,
  25648. resizeState,
  25649. isGroup,
  25650. bodyWidth,
  25651. bodyHeight,
  25652. height,
  25653. tableBodyStyles,
  25654. emptyBlockStyle,
  25655. debouncedUpdateLayout,
  25656. handleFixedMousewheel,
  25657. fixedHeight,
  25658. fixedBodyHeight,
  25659. setCurrentRow,
  25660. getSelectionRows,
  25661. toggleRowSelection,
  25662. clearSelection,
  25663. clearFilter,
  25664. toggleAllSelection,
  25665. toggleRowExpansion,
  25666. clearSort,
  25667. doLayout,
  25668. sort,
  25669. t,
  25670. setDragVisible,
  25671. context: table,
  25672. computedSumText,
  25673. computedEmptyText,
  25674. tableLayout,
  25675. scrollbarViewStyle,
  25676. scrollBarRef,
  25677. scrollTo,
  25678. setScrollLeft,
  25679. setScrollTop
  25680. };
  25681. }
  25682. });
  25683. const _hoisted_1$a = ["data-prefix"];
  25684. const _hoisted_2$8 = {
  25685. ref: "hiddenColumns",
  25686. class: "hidden-columns"
  25687. };
  25688. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  25689. const _component_hColgroup = resolveComponent("hColgroup");
  25690. const _component_table_header = resolveComponent("table-header");
  25691. const _component_table_body = resolveComponent("table-body");
  25692. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  25693. const _component_table_footer = resolveComponent("table-footer");
  25694. const _directive_mousewheel = resolveDirective("mousewheel");
  25695. return openBlock(), createElementBlock("div", {
  25696. ref: "tableWrapper",
  25697. class: normalizeClass([
  25698. {
  25699. [_ctx.ns.m("fit")]: _ctx.fit,
  25700. [_ctx.ns.m("striped")]: _ctx.stripe,
  25701. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  25702. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  25703. [_ctx.ns.m("group")]: _ctx.isGroup,
  25704. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  25705. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  25706. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  25707. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  25708. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  25709. "has-footer": _ctx.showSummary
  25710. },
  25711. _ctx.ns.m(_ctx.tableSize),
  25712. _ctx.className,
  25713. _ctx.ns.b(),
  25714. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  25715. ]),
  25716. style: normalizeStyle(_ctx.style),
  25717. "data-prefix": _ctx.ns.namespace.value,
  25718. onMouseleave: _cache[0] || (_cache[0] = ($event) => _ctx.handleMouseLeave())
  25719. }, [
  25720. createElementVNode("div", {
  25721. class: normalizeClass(_ctx.ns.e("inner-wrapper"))
  25722. }, [
  25723. createElementVNode("div", _hoisted_2$8, [
  25724. renderSlot(_ctx.$slots, "default")
  25725. ], 512),
  25726. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  25727. key: 0,
  25728. ref: "headerWrapper",
  25729. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  25730. }, [
  25731. createElementVNode("table", {
  25732. ref: "tableHeader",
  25733. class: normalizeClass(_ctx.ns.e("header")),
  25734. style: normalizeStyle(_ctx.tableBodyStyles),
  25735. border: "0",
  25736. cellpadding: "0",
  25737. cellspacing: "0"
  25738. }, [
  25739. createVNode(_component_hColgroup, {
  25740. columns: _ctx.store.states.columns.value,
  25741. "table-layout": _ctx.tableLayout
  25742. }, null, 8, ["columns", "table-layout"]),
  25743. createVNode(_component_table_header, {
  25744. ref: "tableHeaderRef",
  25745. border: _ctx.border,
  25746. "default-sort": _ctx.defaultSort,
  25747. store: _ctx.store,
  25748. onSetDragVisible: _ctx.setDragVisible
  25749. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  25750. ], 6)
  25751. ], 2)), [
  25752. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  25753. ]) : createCommentVNode("v-if", true),
  25754. createElementVNode("div", {
  25755. ref: "bodyWrapper",
  25756. style: normalizeStyle(_ctx.bodyHeight),
  25757. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  25758. }, [
  25759. createVNode(_component_el_scrollbar, {
  25760. ref: "scrollBarRef",
  25761. height: _ctx.maxHeight ? void 0 : _ctx.height,
  25762. "max-height": _ctx.maxHeight ? _ctx.height : void 0,
  25763. "view-style": _ctx.scrollbarViewStyle,
  25764. always: _ctx.scrollbarAlwaysOn
  25765. }, {
  25766. default: withCtx(() => [
  25767. createElementVNode("table", {
  25768. ref: "tableBody",
  25769. class: normalizeClass(_ctx.ns.e("body")),
  25770. cellspacing: "0",
  25771. cellpadding: "0",
  25772. border: "0",
  25773. style: normalizeStyle({
  25774. width: _ctx.bodyWidth,
  25775. tableLayout: _ctx.tableLayout
  25776. })
  25777. }, [
  25778. createVNode(_component_hColgroup, {
  25779. columns: _ctx.store.states.columns.value,
  25780. "table-layout": _ctx.tableLayout
  25781. }, null, 8, ["columns", "table-layout"]),
  25782. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  25783. key: 0,
  25784. border: _ctx.border,
  25785. "default-sort": _ctx.defaultSort,
  25786. store: _ctx.store,
  25787. onSetDragVisible: _ctx.setDragVisible
  25788. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : createCommentVNode("v-if", true),
  25789. createVNode(_component_table_body, {
  25790. context: _ctx.context,
  25791. highlight: _ctx.highlightCurrentRow,
  25792. "row-class-name": _ctx.rowClassName,
  25793. "tooltip-effect": _ctx.tooltipEffect,
  25794. "row-style": _ctx.rowStyle,
  25795. store: _ctx.store,
  25796. stripe: _ctx.stripe
  25797. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "row-style", "store", "stripe"])
  25798. ], 6),
  25799. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  25800. key: 0,
  25801. ref: "emptyBlock",
  25802. style: normalizeStyle(_ctx.emptyBlockStyle),
  25803. class: normalizeClass(_ctx.ns.e("empty-block"))
  25804. }, [
  25805. createElementVNode("span", {
  25806. class: normalizeClass(_ctx.ns.e("empty-text"))
  25807. }, [
  25808. renderSlot(_ctx.$slots, "empty", {}, () => [
  25809. createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
  25810. ])
  25811. ], 2)
  25812. ], 6)) : createCommentVNode("v-if", true),
  25813. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  25814. key: 1,
  25815. ref: "appendWrapper",
  25816. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  25817. }, [
  25818. renderSlot(_ctx.$slots, "append")
  25819. ], 2)) : createCommentVNode("v-if", true)
  25820. ]),
  25821. _: 3
  25822. }, 8, ["height", "max-height", "view-style", "always"])
  25823. ], 6),
  25824. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  25825. key: 1,
  25826. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  25827. }, null, 2)) : createCommentVNode("v-if", true)
  25828. ], 2),
  25829. _ctx.showSummary ? withDirectives((openBlock(), createElementBlock("div", {
  25830. key: 0,
  25831. ref: "footerWrapper",
  25832. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  25833. }, [
  25834. createVNode(_component_table_footer, {
  25835. border: _ctx.border,
  25836. "default-sort": _ctx.defaultSort,
  25837. store: _ctx.store,
  25838. style: normalizeStyle(_ctx.tableBodyStyles),
  25839. "sum-text": _ctx.computedSumText,
  25840. "summary-method": _ctx.summaryMethod
  25841. }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"])
  25842. ], 2)), [
  25843. [vShow, !_ctx.isEmpty],
  25844. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  25845. ]) : createCommentVNode("v-if", true),
  25846. withDirectives(createElementVNode("div", {
  25847. ref: "resizeProxy",
  25848. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  25849. }, null, 2), [
  25850. [vShow, _ctx.resizeProxyVisible]
  25851. ])
  25852. ], 46, _hoisted_1$a);
  25853. }
  25854. var Table = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$2], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/table.vue"]]);
  25855. const defaultClassNames = {
  25856. selection: "table-column--selection",
  25857. expand: "table__expand-column"
  25858. };
  25859. const cellStarts = {
  25860. default: {
  25861. order: ""
  25862. },
  25863. selection: {
  25864. width: 48,
  25865. minWidth: 48,
  25866. realWidth: 48,
  25867. order: ""
  25868. },
  25869. expand: {
  25870. width: 48,
  25871. minWidth: 48,
  25872. realWidth: 48,
  25873. order: ""
  25874. },
  25875. index: {
  25876. width: 48,
  25877. minWidth: 48,
  25878. realWidth: 48,
  25879. order: ""
  25880. }
  25881. };
  25882. const getDefaultClassName = (type4) => {
  25883. return defaultClassNames[type4] || "";
  25884. };
  25885. const cellForced = {
  25886. selection: {
  25887. renderHeader({ store }) {
  25888. function isDisabled() {
  25889. return store.states.data.value && store.states.data.value.length === 0;
  25890. }
  25891. return h$1(ElCheckbox, {
  25892. disabled: isDisabled(),
  25893. size: store.states.tableSize.value,
  25894. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  25895. "onUpdate:modelValue": store.toggleAllSelection,
  25896. modelValue: store.states.isAllSelected.value
  25897. });
  25898. },
  25899. renderCell({
  25900. row,
  25901. column,
  25902. store,
  25903. $index
  25904. }) {
  25905. return h$1(ElCheckbox, {
  25906. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  25907. size: store.states.tableSize.value,
  25908. onChange: () => {
  25909. store.commit("rowSelectedChanged", row);
  25910. },
  25911. onClick: (event) => event.stopPropagation(),
  25912. modelValue: store.isSelected(row)
  25913. });
  25914. },
  25915. sortable: false,
  25916. resizable: false
  25917. },
  25918. index: {
  25919. renderHeader({ column }) {
  25920. return column.label || "#";
  25921. },
  25922. renderCell({
  25923. column,
  25924. $index
  25925. }) {
  25926. let i = $index + 1;
  25927. const index = column.index;
  25928. if (typeof index === "number") {
  25929. i = $index + index;
  25930. } else if (typeof index === "function") {
  25931. i = index($index);
  25932. }
  25933. return h$1("div", {}, [i]);
  25934. },
  25935. sortable: false
  25936. },
  25937. expand: {
  25938. renderHeader({ column }) {
  25939. return column.label || "";
  25940. },
  25941. renderCell({
  25942. row,
  25943. store,
  25944. expanded
  25945. }) {
  25946. const { ns } = store;
  25947. const classes = [ns.e("expand-icon")];
  25948. if (expanded) {
  25949. classes.push(ns.em("expand-icon", "expanded"));
  25950. }
  25951. const callback = function(e) {
  25952. e.stopPropagation();
  25953. store.toggleRowExpansion(row);
  25954. };
  25955. return h$1("div", {
  25956. class: classes,
  25957. onClick: callback
  25958. }, {
  25959. default: () => {
  25960. return [
  25961. h$1(ElIcon, null, {
  25962. default: () => {
  25963. return [h$1(arrowRight)];
  25964. }
  25965. })
  25966. ];
  25967. }
  25968. });
  25969. },
  25970. sortable: false,
  25971. resizable: false
  25972. }
  25973. };
  25974. function defaultRenderCell({
  25975. row,
  25976. column,
  25977. $index
  25978. }) {
  25979. var _a2;
  25980. const property = column.property;
  25981. const value = property && getProp(row, property).value;
  25982. if (column && column.formatter) {
  25983. return column.formatter(row, column, value, $index);
  25984. }
  25985. return ((_a2 = value == null ? void 0 : value.toString) == null ? void 0 : _a2.call(value)) || "";
  25986. }
  25987. function treeCellPrefix({
  25988. row,
  25989. treeNode,
  25990. store
  25991. }, createPlacehoder = false) {
  25992. const { ns } = store;
  25993. if (!treeNode) {
  25994. if (createPlacehoder) {
  25995. return [
  25996. h$1("span", {
  25997. class: ns.e("placeholder")
  25998. })
  25999. ];
  26000. }
  26001. return null;
  26002. }
  26003. const ele = [];
  26004. const callback = function(e) {
  26005. e.stopPropagation();
  26006. store.loadOrToggle(row);
  26007. };
  26008. if (treeNode.indent) {
  26009. ele.push(h$1("span", {
  26010. class: ns.e("indent"),
  26011. style: { "padding-left": `${treeNode.indent}px` }
  26012. }));
  26013. }
  26014. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  26015. const expandClasses = [
  26016. ns.e("expand-icon"),
  26017. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  26018. ];
  26019. let icon = arrowRight;
  26020. if (treeNode.loading) {
  26021. icon = loading;
  26022. }
  26023. ele.push(h$1("div", {
  26024. class: expandClasses,
  26025. onClick: callback
  26026. }, {
  26027. default: () => {
  26028. return [
  26029. h$1(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  26030. default: () => [h$1(icon)]
  26031. })
  26032. ];
  26033. }
  26034. }));
  26035. } else {
  26036. ele.push(h$1("span", {
  26037. class: ns.e("placeholder")
  26038. }));
  26039. }
  26040. return ele;
  26041. }
  26042. function getAllAliases(props, aliases) {
  26043. return props.reduce((prev, cur) => {
  26044. prev[cur] = cur;
  26045. return prev;
  26046. }, aliases);
  26047. }
  26048. function useWatcher(owner, props_) {
  26049. const instance = getCurrentInstance();
  26050. const registerComplexWatchers = () => {
  26051. const props = ["fixed"];
  26052. const aliases = {
  26053. realWidth: "width",
  26054. realMinWidth: "minWidth"
  26055. };
  26056. const allAliases = getAllAliases(props, aliases);
  26057. Object.keys(allAliases).forEach((key) => {
  26058. const columnKey = aliases[key];
  26059. if (hasOwn(props_, columnKey)) {
  26060. watch(() => props_[columnKey], (newVal) => {
  26061. let value = newVal;
  26062. if (columnKey === "width" && key === "realWidth") {
  26063. value = parseWidth(newVal);
  26064. }
  26065. if (columnKey === "minWidth" && key === "realMinWidth") {
  26066. value = parseMinWidth(newVal);
  26067. }
  26068. instance.columnConfig.value[columnKey] = value;
  26069. instance.columnConfig.value[key] = value;
  26070. const updateColumns = columnKey === "fixed";
  26071. owner.value.store.scheduleLayout(updateColumns);
  26072. });
  26073. }
  26074. });
  26075. };
  26076. const registerNormalWatchers = () => {
  26077. const props = [
  26078. "label",
  26079. "filters",
  26080. "filterMultiple",
  26081. "sortable",
  26082. "index",
  26083. "formatter",
  26084. "className",
  26085. "labelClassName",
  26086. "showOverflowTooltip"
  26087. ];
  26088. const aliases = {
  26089. property: "prop",
  26090. align: "realAlign",
  26091. headerAlign: "realHeaderAlign"
  26092. };
  26093. const allAliases = getAllAliases(props, aliases);
  26094. Object.keys(allAliases).forEach((key) => {
  26095. const columnKey = aliases[key];
  26096. if (hasOwn(props_, columnKey)) {
  26097. watch(() => props_[columnKey], (newVal) => {
  26098. instance.columnConfig.value[key] = newVal;
  26099. });
  26100. }
  26101. });
  26102. };
  26103. return {
  26104. registerComplexWatchers,
  26105. registerNormalWatchers
  26106. };
  26107. }
  26108. function useRender(props, slots, owner) {
  26109. const instance = getCurrentInstance();
  26110. const columnId = ref("");
  26111. const isSubColumn = ref(false);
  26112. const realAlign = ref();
  26113. const realHeaderAlign = ref();
  26114. const ns = useNamespace("table");
  26115. watchEffect(() => {
  26116. realAlign.value = props.align ? `is-${props.align}` : null;
  26117. realAlign.value;
  26118. });
  26119. watchEffect(() => {
  26120. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  26121. realHeaderAlign.value;
  26122. });
  26123. const columnOrTableParent = computed(() => {
  26124. let parent = instance.vnode.vParent || instance.parent;
  26125. while (parent && !parent.tableId && !parent.columnId) {
  26126. parent = parent.vnode.vParent || parent.parent;
  26127. }
  26128. return parent;
  26129. });
  26130. const hasTreeColumn = computed(() => {
  26131. const { store } = instance.parent;
  26132. if (!store)
  26133. return false;
  26134. const { treeData } = store.states;
  26135. const treeDataValue = treeData.value;
  26136. return treeDataValue && Object.keys(treeDataValue).length > 0;
  26137. });
  26138. const realWidth = ref(parseWidth(props.width));
  26139. const realMinWidth = ref(parseMinWidth(props.minWidth));
  26140. const setColumnWidth = (column) => {
  26141. if (realWidth.value)
  26142. column.width = realWidth.value;
  26143. if (realMinWidth.value) {
  26144. column.minWidth = realMinWidth.value;
  26145. }
  26146. if (!column.minWidth) {
  26147. column.minWidth = 80;
  26148. }
  26149. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  26150. return column;
  26151. };
  26152. const setColumnForcedProps = (column) => {
  26153. const type4 = column.type;
  26154. const source = cellForced[type4] || {};
  26155. Object.keys(source).forEach((prop) => {
  26156. const value = source[prop];
  26157. if (prop !== "className" && value !== void 0) {
  26158. column[prop] = value;
  26159. }
  26160. });
  26161. const className = getDefaultClassName(type4);
  26162. if (className) {
  26163. const forceClass = `${unref(ns.namespace)}-${className}`;
  26164. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  26165. }
  26166. return column;
  26167. };
  26168. const checkSubColumn = (children) => {
  26169. if (Array.isArray(children)) {
  26170. children.forEach((child) => check2(child));
  26171. } else {
  26172. check2(children);
  26173. }
  26174. function check2(item) {
  26175. var _a2;
  26176. if (((_a2 = item == null ? void 0 : item.type) == null ? void 0 : _a2.name) === "ElTableColumn") {
  26177. item.vParent = instance;
  26178. }
  26179. }
  26180. };
  26181. const setColumnRenders = (column) => {
  26182. if (props.renderHeader)
  26183. ;
  26184. else if (column.type !== "selection") {
  26185. column.renderHeader = (scope) => {
  26186. instance.columnConfig.value["label"];
  26187. const renderHeader = slots.header;
  26188. return renderHeader ? renderHeader(scope) : column.label;
  26189. };
  26190. }
  26191. let originRenderCell = column.renderCell;
  26192. const hasTreeColumnValue = hasTreeColumn.value;
  26193. if (column.type === "expand") {
  26194. column.renderCell = (data2) => h$1("div", {
  26195. class: "cell"
  26196. }, [originRenderCell(data2)]);
  26197. owner.value.renderExpanded = (data2) => {
  26198. return slots.default ? slots.default(data2) : slots.default;
  26199. };
  26200. } else {
  26201. originRenderCell = originRenderCell || defaultRenderCell;
  26202. column.renderCell = (data2) => {
  26203. let children = null;
  26204. if (slots.default) {
  26205. const vnodes = slots.default(data2);
  26206. children = vnodes.some((v2) => v2.type !== Comment) ? vnodes : originRenderCell(data2);
  26207. } else {
  26208. children = originRenderCell(data2);
  26209. }
  26210. const shouldCreatePlaceholder = hasTreeColumnValue && data2.cellIndex === 0;
  26211. const prefix = treeCellPrefix(data2, shouldCreatePlaceholder);
  26212. const props2 = {
  26213. class: "cell",
  26214. style: {}
  26215. };
  26216. if (column.showOverflowTooltip) {
  26217. props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
  26218. props2.style = {
  26219. width: `${(data2.column.realWidth || Number(data2.column.width)) - 1}px`
  26220. };
  26221. }
  26222. checkSubColumn(children);
  26223. return h$1("div", props2, [prefix, children]);
  26224. };
  26225. }
  26226. return column;
  26227. };
  26228. const getPropsData = (...propsKey) => {
  26229. return propsKey.reduce((prev, cur) => {
  26230. if (Array.isArray(cur)) {
  26231. cur.forEach((key) => {
  26232. prev[key] = props[key];
  26233. });
  26234. }
  26235. return prev;
  26236. }, {});
  26237. };
  26238. const getColumnElIndex = (children, child) => {
  26239. return Array.prototype.indexOf.call(children, child);
  26240. };
  26241. return {
  26242. columnId,
  26243. realAlign,
  26244. isSubColumn,
  26245. realHeaderAlign,
  26246. columnOrTableParent,
  26247. setColumnWidth,
  26248. setColumnForcedProps,
  26249. setColumnRenders,
  26250. getPropsData,
  26251. getColumnElIndex
  26252. };
  26253. }
  26254. var defaultProps = {
  26255. type: {
  26256. type: String,
  26257. default: "default"
  26258. },
  26259. label: String,
  26260. className: String,
  26261. labelClassName: String,
  26262. property: String,
  26263. prop: String,
  26264. width: {
  26265. type: [String, Number],
  26266. default: ""
  26267. },
  26268. minWidth: {
  26269. type: [String, Number],
  26270. default: ""
  26271. },
  26272. renderHeader: Function,
  26273. sortable: {
  26274. type: [Boolean, String],
  26275. default: false
  26276. },
  26277. sortMethod: Function,
  26278. sortBy: [String, Function, Array],
  26279. resizable: {
  26280. type: Boolean,
  26281. default: true
  26282. },
  26283. columnKey: String,
  26284. align: String,
  26285. headerAlign: String,
  26286. showTooltipWhenOverflow: Boolean,
  26287. showOverflowTooltip: Boolean,
  26288. fixed: [Boolean, String],
  26289. formatter: Function,
  26290. selectable: Function,
  26291. reserveSelection: Boolean,
  26292. filterMethod: Function,
  26293. filteredValue: Array,
  26294. filters: Array,
  26295. filterPlacement: String,
  26296. filterMultiple: {
  26297. type: Boolean,
  26298. default: true
  26299. },
  26300. index: [Number, Function],
  26301. sortOrders: {
  26302. type: Array,
  26303. default: () => {
  26304. return ["ascending", "descending", null];
  26305. },
  26306. validator: (val) => {
  26307. return val.every((order2) => ["ascending", "descending", null].includes(order2));
  26308. }
  26309. }
  26310. };
  26311. let columnIdSeed = 1;
  26312. var ElTableColumn$1 = defineComponent({
  26313. name: "ElTableColumn",
  26314. components: {
  26315. ElCheckbox
  26316. },
  26317. props: defaultProps,
  26318. setup(props, { slots }) {
  26319. const instance = getCurrentInstance();
  26320. const columnConfig = ref({});
  26321. const owner = computed(() => {
  26322. let parent2 = instance.parent;
  26323. while (parent2 && !parent2.tableId) {
  26324. parent2 = parent2.parent;
  26325. }
  26326. return parent2;
  26327. });
  26328. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  26329. const {
  26330. columnId,
  26331. isSubColumn,
  26332. realHeaderAlign,
  26333. columnOrTableParent,
  26334. setColumnWidth,
  26335. setColumnForcedProps,
  26336. setColumnRenders,
  26337. getPropsData,
  26338. getColumnElIndex,
  26339. realAlign
  26340. } = useRender(props, slots, owner);
  26341. const parent = columnOrTableParent.value;
  26342. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  26343. onBeforeMount(() => {
  26344. isSubColumn.value = owner.value !== parent;
  26345. const type4 = props.type || "default";
  26346. const sortable = props.sortable === "" ? true : props.sortable;
  26347. const defaults = __spreadProps(__spreadValues({}, cellStarts[type4]), {
  26348. id: columnId.value,
  26349. type: type4,
  26350. property: props.prop || props.property,
  26351. align: realAlign,
  26352. headerAlign: realHeaderAlign,
  26353. showOverflowTooltip: props.showOverflowTooltip || props.showTooltipWhenOverflow,
  26354. filterable: props.filters || props.filterMethod,
  26355. filteredValue: [],
  26356. filterPlacement: "",
  26357. isColumnGroup: false,
  26358. isSubColumn: false,
  26359. filterOpened: false,
  26360. sortable,
  26361. index: props.index,
  26362. rawColumnKey: instance.vnode.key
  26363. });
  26364. const basicProps = [
  26365. "columnKey",
  26366. "label",
  26367. "className",
  26368. "labelClassName",
  26369. "type",
  26370. "renderHeader",
  26371. "formatter",
  26372. "fixed",
  26373. "resizable"
  26374. ];
  26375. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  26376. const selectProps = ["selectable", "reserveSelection"];
  26377. const filterProps = [
  26378. "filterMethod",
  26379. "filters",
  26380. "filterMultiple",
  26381. "filterOpened",
  26382. "filteredValue",
  26383. "filterPlacement"
  26384. ];
  26385. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  26386. column = mergeOptions(defaults, column);
  26387. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  26388. column = chains(column);
  26389. columnConfig.value = column;
  26390. registerNormalWatchers();
  26391. registerComplexWatchers();
  26392. });
  26393. onMounted(() => {
  26394. var _a2;
  26395. const parent2 = columnOrTableParent.value;
  26396. const children = isSubColumn.value ? parent2.vnode.el.children : (_a2 = parent2.refs.hiddenColumns) == null ? void 0 : _a2.children;
  26397. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  26398. columnConfig.value.getColumnIndex = getColumnIndex;
  26399. const columnIndex = getColumnIndex();
  26400. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null);
  26401. });
  26402. onBeforeUnmount(() => {
  26403. owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null);
  26404. });
  26405. instance.columnId = columnId.value;
  26406. instance.columnConfig = columnConfig;
  26407. return;
  26408. },
  26409. render() {
  26410. var _a2, _b2, _c;
  26411. try {
  26412. const renderDefault = (_b2 = (_a2 = this.$slots).default) == null ? void 0 : _b2.call(_a2, {
  26413. row: {},
  26414. column: {},
  26415. $index: -1
  26416. });
  26417. const children = [];
  26418. if (Array.isArray(renderDefault)) {
  26419. for (const childNode of renderDefault) {
  26420. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  26421. children.push(childNode);
  26422. } else if (childNode.type === Fragment && Array.isArray(childNode.children)) {
  26423. childNode.children.forEach((vnode2) => {
  26424. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) {
  26425. children.push(vnode2);
  26426. }
  26427. });
  26428. }
  26429. }
  26430. }
  26431. const vnode = h$1("div", children);
  26432. return vnode;
  26433. } catch (e) {
  26434. return h$1("div", []);
  26435. }
  26436. }
  26437. });
  26438. const ElTable = withInstall(Table, {
  26439. TableColumn: ElTableColumn$1
  26440. });
  26441. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  26442. const SCOPE$1 = "ElUpload";
  26443. class UploadAjaxError extends Error {
  26444. constructor(message, status, method4, url2) {
  26445. super(message);
  26446. this.name = "UploadAjaxError";
  26447. this.status = status;
  26448. this.method = method4;
  26449. this.url = url2;
  26450. }
  26451. }
  26452. function getError(action, option, xhr) {
  26453. let msg;
  26454. if (xhr.response) {
  26455. msg = `${xhr.response.error || xhr.response}`;
  26456. } else if (xhr.responseText) {
  26457. msg = `${xhr.responseText}`;
  26458. } else {
  26459. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  26460. }
  26461. return new UploadAjaxError(msg, xhr.status, option.method, action);
  26462. }
  26463. function getBody(xhr) {
  26464. const text = xhr.responseText || xhr.response;
  26465. if (!text) {
  26466. return text;
  26467. }
  26468. try {
  26469. return JSON.parse(text);
  26470. } catch (e) {
  26471. return text;
  26472. }
  26473. }
  26474. const ajaxUpload = (option) => {
  26475. if (typeof XMLHttpRequest === "undefined")
  26476. throwError(SCOPE$1, "XMLHttpRequest is undefined");
  26477. const xhr = new XMLHttpRequest();
  26478. const action = option.action;
  26479. if (xhr.upload) {
  26480. xhr.upload.addEventListener("progress", (evt) => {
  26481. const progressEvt = evt;
  26482. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  26483. option.onProgress(progressEvt);
  26484. });
  26485. }
  26486. const formData = new FormData();
  26487. if (option.data) {
  26488. for (const [key, value] of Object.entries(option.data)) {
  26489. if (Array.isArray(value))
  26490. formData.append(key, ...value);
  26491. else
  26492. formData.append(key, value);
  26493. }
  26494. }
  26495. formData.append(option.filename, option.file, option.file.name);
  26496. xhr.addEventListener("error", () => {
  26497. option.onError(getError(action, option, xhr));
  26498. });
  26499. xhr.addEventListener("load", () => {
  26500. if (xhr.status < 200 || xhr.status >= 300) {
  26501. return option.onError(getError(action, option, xhr));
  26502. }
  26503. option.onSuccess(getBody(xhr));
  26504. });
  26505. xhr.open(option.method, action, true);
  26506. if (option.withCredentials && "withCredentials" in xhr) {
  26507. xhr.withCredentials = true;
  26508. }
  26509. const headers = option.headers || {};
  26510. if (headers instanceof Headers) {
  26511. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  26512. } else {
  26513. for (const [key, value] of Object.entries(headers)) {
  26514. if (isNil(value))
  26515. continue;
  26516. xhr.setRequestHeader(key, String(value));
  26517. }
  26518. }
  26519. xhr.send(formData);
  26520. return xhr;
  26521. };
  26522. const uploadListTypes = ["text", "picture", "picture-card"];
  26523. let fileId = 1;
  26524. const genFileId = () => Date.now() + fileId++;
  26525. const uploadBaseProps = buildProps({
  26526. action: {
  26527. type: String,
  26528. required: true
  26529. },
  26530. headers: {
  26531. type: definePropType(Object)
  26532. },
  26533. method: {
  26534. type: String,
  26535. default: "post"
  26536. },
  26537. data: {
  26538. type: Object,
  26539. default: () => mutable({})
  26540. },
  26541. multiple: {
  26542. type: Boolean,
  26543. default: false
  26544. },
  26545. name: {
  26546. type: String,
  26547. default: "file"
  26548. },
  26549. drag: {
  26550. type: Boolean,
  26551. default: false
  26552. },
  26553. withCredentials: Boolean,
  26554. showFileList: {
  26555. type: Boolean,
  26556. default: true
  26557. },
  26558. accept: {
  26559. type: String,
  26560. default: ""
  26561. },
  26562. type: {
  26563. type: String,
  26564. default: "select"
  26565. },
  26566. fileList: {
  26567. type: definePropType(Array),
  26568. default: () => mutable([])
  26569. },
  26570. autoUpload: {
  26571. type: Boolean,
  26572. default: true
  26573. },
  26574. listType: {
  26575. type: String,
  26576. values: uploadListTypes,
  26577. default: "text"
  26578. },
  26579. httpRequest: {
  26580. type: definePropType(Function),
  26581. default: ajaxUpload
  26582. },
  26583. disabled: Boolean,
  26584. limit: Number
  26585. });
  26586. const uploadProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  26587. beforeUpload: {
  26588. type: definePropType(Function),
  26589. default: NOOP
  26590. },
  26591. beforeRemove: {
  26592. type: definePropType(Function)
  26593. },
  26594. onRemove: {
  26595. type: definePropType(Function),
  26596. default: NOOP
  26597. },
  26598. onChange: {
  26599. type: definePropType(Function),
  26600. default: NOOP
  26601. },
  26602. onPreview: {
  26603. type: definePropType(Function),
  26604. default: NOOP
  26605. },
  26606. onSuccess: {
  26607. type: definePropType(Function),
  26608. default: NOOP
  26609. },
  26610. onProgress: {
  26611. type: definePropType(Function),
  26612. default: NOOP
  26613. },
  26614. onError: {
  26615. type: definePropType(Function),
  26616. default: NOOP
  26617. },
  26618. onExceed: {
  26619. type: definePropType(Function),
  26620. default: NOOP
  26621. }
  26622. }));
  26623. const uploadListProps = buildProps({
  26624. files: {
  26625. type: definePropType(Array),
  26626. default: () => mutable([])
  26627. },
  26628. disabled: {
  26629. type: Boolean,
  26630. default: false
  26631. },
  26632. handlePreview: {
  26633. type: definePropType(Function),
  26634. default: NOOP
  26635. },
  26636. listType: {
  26637. type: String,
  26638. values: uploadListTypes,
  26639. default: "text"
  26640. }
  26641. });
  26642. const uploadListEmits = {
  26643. remove: (file) => !!file
  26644. };
  26645. const _hoisted_1$9 = ["onKeydown"];
  26646. const _hoisted_2$7 = ["src"];
  26647. const _hoisted_3$5 = ["onClick"];
  26648. const _hoisted_4$5 = ["onClick"];
  26649. const _hoisted_5$5 = ["onClick"];
  26650. const __default__$4 = {
  26651. name: "ElUploadList"
  26652. };
  26653. const _sfc_main$c = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
  26654. props: uploadListProps,
  26655. emits: uploadListEmits,
  26656. setup(__props, { emit }) {
  26657. const props = __props;
  26658. const { t } = useLocale();
  26659. const nsUpload = useNamespace("upload");
  26660. const nsIcon = useNamespace("icon");
  26661. const nsList = useNamespace("list");
  26662. const focusing = ref(false);
  26663. const handleClick = (file) => {
  26664. props.handlePreview(file);
  26665. };
  26666. const onFileClicked = (e) => {
  26667. e.target.focus();
  26668. };
  26669. const handleRemove = (file) => {
  26670. emit("remove", file);
  26671. };
  26672. return (_ctx, _cache) => {
  26673. return openBlock(), createBlock(TransitionGroup, {
  26674. tag: "ul",
  26675. class: normalizeClass([
  26676. unref(nsUpload).b("list"),
  26677. unref(nsUpload).bm("list", _ctx.listType),
  26678. unref(nsUpload).is("disabled", _ctx.disabled)
  26679. ]),
  26680. name: unref(nsList).b()
  26681. }, {
  26682. default: withCtx(() => [
  26683. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file) => {
  26684. return openBlock(), createElementBlock("li", {
  26685. key: file.uid || file.name,
  26686. class: normalizeClass([
  26687. unref(nsUpload).be("list", "item"),
  26688. unref(nsUpload).is(file.status),
  26689. { focusing: focusing.value }
  26690. ]),
  26691. tabindex: "0",
  26692. onKeydown: withKeys(($event) => !_ctx.disabled && handleRemove(file), ["delete"]),
  26693. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  26694. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  26695. onClick: onFileClicked
  26696. }, [
  26697. renderSlot(_ctx.$slots, "default", { file }, () => [
  26698. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  26699. key: 0,
  26700. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  26701. src: file.url,
  26702. alt: ""
  26703. }, null, 10, _hoisted_2$7)) : createCommentVNode("v-if", true),
  26704. _ctx.listType !== "picture" && (file.status === "uploading" || _ctx.listType !== "picture-card") ? (openBlock(), createElementBlock("div", {
  26705. key: 1,
  26706. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  26707. }, [
  26708. createElementVNode("a", {
  26709. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  26710. onClick: ($event) => handleClick(file)
  26711. }, [
  26712. createVNode(unref(ElIcon), {
  26713. class: normalizeClass(unref(nsIcon).m("document"))
  26714. }, {
  26715. default: withCtx(() => [
  26716. createVNode(unref(document$1))
  26717. ]),
  26718. _: 1
  26719. }, 8, ["class"]),
  26720. createTextVNode(" " + toDisplayString(file.name), 1)
  26721. ], 10, _hoisted_3$5),
  26722. file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  26723. key: 0,
  26724. type: _ctx.listType === "picture-card" ? "circle" : "line",
  26725. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  26726. percentage: Number(file.percentage),
  26727. style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  26728. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
  26729. ], 2)) : createCommentVNode("v-if", true),
  26730. createElementVNode("label", {
  26731. class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
  26732. }, [
  26733. _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  26734. key: 0,
  26735. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  26736. }, {
  26737. default: withCtx(() => [
  26738. createVNode(unref(circleCheck))
  26739. ]),
  26740. _: 1
  26741. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  26742. key: 1,
  26743. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  26744. }, {
  26745. default: withCtx(() => [
  26746. createVNode(unref(check))
  26747. ]),
  26748. _: 1
  26749. }, 8, ["class"])) : createCommentVNode("v-if", true)
  26750. ], 2),
  26751. !_ctx.disabled ? (openBlock(), createBlock(unref(ElIcon), {
  26752. key: 2,
  26753. class: normalizeClass(unref(nsIcon).m("close")),
  26754. onClick: ($event) => handleRemove(file)
  26755. }, {
  26756. default: withCtx(() => [
  26757. createVNode(unref(close))
  26758. ]),
  26759. _: 2
  26760. }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
  26761. createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  26762. createCommentVNode(" This is a bug which needs to be fixed "),
  26763. createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  26764. !_ctx.disabled ? (openBlock(), createElementBlock("i", {
  26765. key: 3,
  26766. class: normalizeClass(unref(nsIcon).m("close-tip"))
  26767. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  26768. _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  26769. key: 4,
  26770. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  26771. }, [
  26772. createElementVNode("span", {
  26773. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  26774. onClick: ($event) => _ctx.handlePreview(file)
  26775. }, [
  26776. createVNode(unref(ElIcon), {
  26777. class: normalizeClass(unref(nsIcon).m("zoom-in"))
  26778. }, {
  26779. default: withCtx(() => [
  26780. createVNode(unref(zoomIn))
  26781. ]),
  26782. _: 1
  26783. }, 8, ["class"])
  26784. ], 10, _hoisted_4$5),
  26785. !_ctx.disabled ? (openBlock(), createElementBlock("span", {
  26786. key: 0,
  26787. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  26788. onClick: ($event) => handleRemove(file)
  26789. }, [
  26790. createVNode(unref(ElIcon), {
  26791. class: normalizeClass(unref(nsIcon).m("delete"))
  26792. }, {
  26793. default: withCtx(() => [
  26794. createVNode(unref(_delete))
  26795. ]),
  26796. _: 1
  26797. }, 8, ["class"])
  26798. ], 10, _hoisted_5$5)) : createCommentVNode("v-if", true)
  26799. ], 2)) : createCommentVNode("v-if", true)
  26800. ])
  26801. ], 42, _hoisted_1$9);
  26802. }), 128)),
  26803. renderSlot(_ctx.$slots, "append")
  26804. ]),
  26805. _: 3
  26806. }, 8, ["class", "name"]);
  26807. };
  26808. }
  26809. }));
  26810. var UploadList = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);
  26811. const uploadDraggerProps = buildProps({
  26812. disabled: {
  26813. type: Boolean,
  26814. default: false
  26815. }
  26816. });
  26817. const uploadDraggerEmits = {
  26818. file: (file) => isArray(file)
  26819. };
  26820. const _hoisted_1$8 = ["onDrop", "onDragover"];
  26821. const __default__$3 = {
  26822. name: "ElUploadDrag"
  26823. };
  26824. const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
  26825. props: uploadDraggerProps,
  26826. emits: uploadDraggerEmits,
  26827. setup(__props, { emit }) {
  26828. const props = __props;
  26829. const COMPONENT_NAME2 = "ElUploadDrag";
  26830. const uploaderContext = inject(uploadContextKey);
  26831. if (!uploaderContext) {
  26832. throwError(COMPONENT_NAME2, "usage: <el-upload><el-upload-dragger /></el-upload>");
  26833. }
  26834. const ns = useNamespace("upload");
  26835. const dragover = ref(false);
  26836. const onDrop = (e) => {
  26837. if (props.disabled)
  26838. return;
  26839. dragover.value = false;
  26840. const files = Array.from(e.dataTransfer.files);
  26841. const accept = uploaderContext.accept.value;
  26842. if (!accept) {
  26843. emit("file", files);
  26844. return;
  26845. }
  26846. const filesFiltered = files.filter((file) => {
  26847. const { type: type4, name } = file;
  26848. const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
  26849. const baseType = type4.replace(/\/.*$/, "");
  26850. return accept.split(",").map((type22) => type22.trim()).filter((type22) => type22).some((acceptedType) => {
  26851. if (acceptedType.startsWith(".")) {
  26852. return extension === acceptedType;
  26853. }
  26854. if (/\/\*$/.test(acceptedType)) {
  26855. return baseType === acceptedType.replace(/\/\*$/, "");
  26856. }
  26857. if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
  26858. return type4 === acceptedType;
  26859. }
  26860. return false;
  26861. });
  26862. });
  26863. emit("file", filesFiltered);
  26864. };
  26865. const onDragover = () => {
  26866. if (!props.disabled)
  26867. dragover.value = true;
  26868. };
  26869. return (_ctx, _cache) => {
  26870. return openBlock(), createElementBlock("div", {
  26871. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  26872. onDrop: withModifiers(onDrop, ["prevent"]),
  26873. onDragover: withModifiers(onDragover, ["prevent"]),
  26874. onDragleave: _cache[0] || (_cache[0] = withModifiers(($event) => dragover.value = false, ["prevent"]))
  26875. }, [
  26876. renderSlot(_ctx.$slots, "default")
  26877. ], 42, _hoisted_1$8);
  26878. };
  26879. }
  26880. }));
  26881. var UploadDragger = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);
  26882. const uploadContentProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  26883. fileList: {
  26884. type: definePropType(Array),
  26885. default: () => mutable([])
  26886. },
  26887. beforeUpload: {
  26888. type: definePropType(Function),
  26889. default: NOOP
  26890. },
  26891. onRemove: {
  26892. type: definePropType(Function),
  26893. default: NOOP
  26894. },
  26895. onStart: {
  26896. type: definePropType(Function),
  26897. default: NOOP
  26898. },
  26899. onSuccess: {
  26900. type: definePropType(Function),
  26901. default: NOOP
  26902. },
  26903. onProgress: {
  26904. type: definePropType(Function),
  26905. default: NOOP
  26906. },
  26907. onError: {
  26908. type: definePropType(Function),
  26909. default: NOOP
  26910. },
  26911. onExceed: {
  26912. type: definePropType(Function),
  26913. default: NOOP
  26914. }
  26915. }));
  26916. const _hoisted_1$7 = ["onKeydown"];
  26917. const _hoisted_2$6 = ["name", "multiple", "accept"];
  26918. const __default__$2 = {
  26919. name: "ElUploadContent",
  26920. inheritAttrs: false
  26921. };
  26922. const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
  26923. props: uploadContentProps,
  26924. setup(__props, { expose }) {
  26925. const props = __props;
  26926. const ns = useNamespace("upload");
  26927. const requests = shallowRef({});
  26928. const inputRef = shallowRef();
  26929. const uploadFiles = (files) => {
  26930. if (files.length === 0)
  26931. return;
  26932. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  26933. if (limit && fileList.length + files.length > limit) {
  26934. onExceed(files, fileList);
  26935. return;
  26936. }
  26937. if (!multiple) {
  26938. files = files.slice(0, 1);
  26939. }
  26940. for (const file of files) {
  26941. const rawFile = file;
  26942. rawFile.uid = genFileId();
  26943. onStart(rawFile);
  26944. if (autoUpload)
  26945. upload(rawFile);
  26946. }
  26947. };
  26948. const upload = async (rawFile) => {
  26949. inputRef.value.value = "";
  26950. if (!props.beforeUpload) {
  26951. return doUpload(rawFile);
  26952. }
  26953. let hookResult;
  26954. try {
  26955. hookResult = await props.beforeUpload(rawFile);
  26956. } catch (e) {
  26957. hookResult = false;
  26958. }
  26959. if (hookResult === false) {
  26960. props.onRemove(rawFile);
  26961. return;
  26962. }
  26963. let file = rawFile;
  26964. if (hookResult instanceof Blob) {
  26965. if (hookResult instanceof File) {
  26966. file = hookResult;
  26967. } else {
  26968. file = new File([hookResult], rawFile.name, {
  26969. type: rawFile.type
  26970. });
  26971. }
  26972. for (const key of Object.keys(rawFile)) {
  26973. file[key] = rawFile[key];
  26974. }
  26975. }
  26976. doUpload(rawFile);
  26977. };
  26978. const doUpload = (rawFile) => {
  26979. const {
  26980. headers,
  26981. data: data2,
  26982. method: method4,
  26983. withCredentials,
  26984. name: filename,
  26985. action,
  26986. onProgress,
  26987. onSuccess,
  26988. onError,
  26989. httpRequest
  26990. } = props;
  26991. const { uid: uid2 } = rawFile;
  26992. const options = {
  26993. headers: headers || {},
  26994. withCredentials,
  26995. file: rawFile,
  26996. data: data2,
  26997. method: method4,
  26998. filename,
  26999. action,
  27000. onProgress: (evt) => {
  27001. onProgress(evt, rawFile);
  27002. },
  27003. onSuccess: (res) => {
  27004. onSuccess(res, rawFile);
  27005. delete requests.value[uid2];
  27006. },
  27007. onError: (err) => {
  27008. onError(err, rawFile);
  27009. delete requests.value[uid2];
  27010. }
  27011. };
  27012. const request = httpRequest(options);
  27013. requests.value[uid2] = request;
  27014. if (request instanceof Promise) {
  27015. request.then(options.onSuccess, options.onError);
  27016. }
  27017. };
  27018. const handleChange2 = (e) => {
  27019. const files = e.target.files;
  27020. if (!files)
  27021. return;
  27022. uploadFiles(Array.from(files));
  27023. };
  27024. const handleClick = () => {
  27025. if (!props.disabled) {
  27026. inputRef.value.value = "";
  27027. inputRef.value.click();
  27028. }
  27029. };
  27030. const handleKeydown = () => {
  27031. handleClick();
  27032. };
  27033. const abort = (file) => {
  27034. const _reqs = entriesOf(requests.value).filter(file ? ([uid2]) => String(file.uid) === uid2 : () => true);
  27035. _reqs.forEach(([uid2, req]) => {
  27036. if (req instanceof XMLHttpRequest)
  27037. req.abort();
  27038. delete requests.value[uid2];
  27039. });
  27040. };
  27041. expose({
  27042. abort,
  27043. upload
  27044. });
  27045. return (_ctx, _cache) => {
  27046. return openBlock(), createElementBlock("div", {
  27047. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.listType)]),
  27048. tabindex: "0",
  27049. onClick: handleClick,
  27050. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  27051. }, [
  27052. _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
  27053. key: 0,
  27054. disabled: _ctx.disabled,
  27055. onFile: uploadFiles
  27056. }, {
  27057. default: withCtx(() => [
  27058. renderSlot(_ctx.$slots, "default")
  27059. ]),
  27060. _: 3
  27061. }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
  27062. createElementVNode("input", {
  27063. ref_key: "inputRef",
  27064. ref: inputRef,
  27065. class: normalizeClass(unref(ns).e("input")),
  27066. name: _ctx.name,
  27067. multiple: _ctx.multiple,
  27068. accept: _ctx.accept,
  27069. type: "file",
  27070. onChange: handleChange2
  27071. }, null, 42, _hoisted_2$6)
  27072. ], 42, _hoisted_1$7);
  27073. };
  27074. }
  27075. }));
  27076. var UploadContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);
  27077. const SCOPE = "ElUpload";
  27078. const revokeObjectURL = (file) => {
  27079. var _a2;
  27080. if ((_a2 = file.url) == null ? void 0 : _a2.startsWith("blob:")) {
  27081. URL.revokeObjectURL(file.url);
  27082. }
  27083. };
  27084. const useHandlers = (props, uploadRef) => {
  27085. const uploadFiles = ref([]);
  27086. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  27087. function abort(file) {
  27088. var _a2;
  27089. (_a2 = uploadRef.value) == null ? void 0 : _a2.abort(file);
  27090. }
  27091. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  27092. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  27093. }
  27094. const handleError = (err, rawFile) => {
  27095. const file = getFile(rawFile);
  27096. if (!file)
  27097. return;
  27098. file.status = "fail";
  27099. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  27100. props.onError(err, file, uploadFiles.value);
  27101. props.onChange(file, uploadFiles.value);
  27102. };
  27103. const handleProgress = (evt, rawFile) => {
  27104. const file = getFile(rawFile);
  27105. if (!file)
  27106. return;
  27107. props.onProgress(evt, file, uploadFiles.value);
  27108. file.status = "uploading";
  27109. file.percentage = Math.round(evt.percent);
  27110. };
  27111. const handleSuccess = (response, rawFile) => {
  27112. const file = getFile(rawFile);
  27113. if (!file)
  27114. return;
  27115. file.status = "success";
  27116. file.response = response;
  27117. props.onSuccess(response, file, uploadFiles.value);
  27118. props.onChange(file, uploadFiles.value);
  27119. };
  27120. const handleStart = (file) => {
  27121. const uploadFile = {
  27122. name: file.name,
  27123. percentage: 0,
  27124. status: "ready",
  27125. size: file.size,
  27126. raw: file,
  27127. uid: file.uid
  27128. };
  27129. if (props.listType === "picture-card" || props.listType === "picture") {
  27130. try {
  27131. uploadFile.url = URL.createObjectURL(file);
  27132. } catch (err) {
  27133. debugWarn(SCOPE, err.message);
  27134. props.onError(err, uploadFile, uploadFiles.value);
  27135. }
  27136. }
  27137. uploadFiles.value.push(uploadFile);
  27138. props.onChange(uploadFile, uploadFiles.value);
  27139. };
  27140. const handleRemove = async (file, rawFile) => {
  27141. if (rawFile) {
  27142. useDeprecated({
  27143. scope: SCOPE,
  27144. from: "handleRemove second argument",
  27145. version: "2.2",
  27146. replacement: "first argument `file`",
  27147. ref: "https://element-plus.org/en-US/component/upload.html#methods"
  27148. }, true);
  27149. }
  27150. const _file = rawFile || file;
  27151. const uploadFile = _file instanceof File ? getFile(_file) : _file;
  27152. if (!uploadFile)
  27153. throwError(SCOPE, "file to be removed not found");
  27154. const doRemove = (file2) => {
  27155. abort(file2);
  27156. const fileList = uploadFiles.value;
  27157. fileList.splice(fileList.indexOf(file2), 1);
  27158. props.onRemove(file2, fileList);
  27159. revokeObjectURL(file2);
  27160. };
  27161. if (props.beforeRemove) {
  27162. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  27163. if (before !== false)
  27164. doRemove(uploadFile);
  27165. } else {
  27166. doRemove(uploadFile);
  27167. }
  27168. };
  27169. function submit() {
  27170. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  27171. var _a2;
  27172. return raw && ((_a2 = uploadRef.value) == null ? void 0 : _a2.upload(raw));
  27173. });
  27174. }
  27175. watch(() => props.listType, (val) => {
  27176. if (val !== "picture-card" && val !== "picture") {
  27177. return;
  27178. }
  27179. uploadFiles.value = uploadFiles.value.map((file) => {
  27180. const { raw, url: url2 } = file;
  27181. if (!url2 && raw) {
  27182. try {
  27183. file.url = URL.createObjectURL(raw);
  27184. } catch (err) {
  27185. props.onError(err, file, uploadFiles.value);
  27186. }
  27187. }
  27188. return file;
  27189. });
  27190. });
  27191. watch(() => props.fileList, (fileList) => {
  27192. for (const file of fileList) {
  27193. file.uid || (file.uid = genFileId());
  27194. file.status || (file.status = "success");
  27195. }
  27196. uploadFiles.value = fileList;
  27197. }, { immediate: true, deep: true });
  27198. return {
  27199. abort,
  27200. clearFiles,
  27201. handleError,
  27202. handleProgress,
  27203. handleStart,
  27204. handleSuccess,
  27205. handleRemove,
  27206. submit,
  27207. uploadFiles
  27208. };
  27209. };
  27210. const __default__$1 = {
  27211. name: "ElUpload"
  27212. };
  27213. const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
  27214. props: uploadProps,
  27215. setup(__props, { expose }) {
  27216. const props = __props;
  27217. const slots = useSlots();
  27218. const disabled = useDisabled$1();
  27219. const uploadRef = shallowRef();
  27220. const {
  27221. abort,
  27222. submit,
  27223. clearFiles,
  27224. uploadFiles,
  27225. handleStart,
  27226. handleError,
  27227. handleRemove,
  27228. handleSuccess,
  27229. handleProgress
  27230. } = useHandlers(props, uploadRef);
  27231. const isPictureCard = computed(() => props.listType === "picture-card");
  27232. const uploadContentProps2 = computed(() => __spreadProps(__spreadValues({}, props), {
  27233. onStart: handleStart,
  27234. onProgress: handleProgress,
  27235. onSuccess: handleSuccess,
  27236. onError: handleError,
  27237. onRemove: handleRemove
  27238. }));
  27239. onBeforeUnmount(() => {
  27240. uploadFiles.value.forEach(({ url: url2 }) => {
  27241. if (url2 == null ? void 0 : url2.startsWith("blob:"))
  27242. URL.revokeObjectURL(url2);
  27243. });
  27244. });
  27245. provide(uploadContextKey, {
  27246. accept: toRef(props, "accept")
  27247. });
  27248. expose({
  27249. abort,
  27250. submit,
  27251. clearFiles,
  27252. handleStart,
  27253. handleRemove
  27254. });
  27255. return (_ctx, _cache) => {
  27256. return openBlock(), createElementBlock("div", null, [
  27257. unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  27258. key: 0,
  27259. disabled: unref(disabled),
  27260. "list-type": _ctx.listType,
  27261. files: unref(uploadFiles),
  27262. "handle-preview": _ctx.onPreview,
  27263. onRemove: unref(handleRemove)
  27264. }, createSlots({
  27265. append: withCtx(() => [
  27266. _ctx.listType === "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  27267. key: 0,
  27268. ref_key: "uploadRef",
  27269. ref: uploadRef
  27270. }, unref(uploadContentProps2)), {
  27271. default: withCtx(() => [
  27272. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  27273. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  27274. ]),
  27275. _: 3
  27276. }, 16)) : createCommentVNode("v-if", true)
  27277. ]),
  27278. _: 2
  27279. }, [
  27280. _ctx.$slots.file ? {
  27281. name: "default",
  27282. fn: withCtx(({ file }) => [
  27283. renderSlot(_ctx.$slots, "file", { file })
  27284. ])
  27285. } : void 0
  27286. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
  27287. _ctx.listType !== "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  27288. key: 1,
  27289. ref_key: "uploadRef",
  27290. ref: uploadRef
  27291. }, unref(uploadContentProps2)), {
  27292. default: withCtx(() => [
  27293. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  27294. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  27295. ]),
  27296. _: 3
  27297. }, 16)) : createCommentVNode("v-if", true),
  27298. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  27299. renderSlot(_ctx.$slots, "tip"),
  27300. !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  27301. key: 3,
  27302. disabled: unref(disabled),
  27303. "list-type": _ctx.listType,
  27304. files: unref(uploadFiles),
  27305. "handle-preview": _ctx.onPreview,
  27306. onRemove: unref(handleRemove)
  27307. }, createSlots({ _: 2 }, [
  27308. _ctx.$slots.file ? {
  27309. name: "default",
  27310. fn: withCtx(({ file }) => [
  27311. renderSlot(_ctx.$slots, "file", { file })
  27312. ])
  27313. } : void 0
  27314. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
  27315. ]);
  27316. };
  27317. }
  27318. }));
  27319. var Upload = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);
  27320. const ElUpload = withInstall(Upload);
  27321. var base = "";
  27322. var elDialog = "";
  27323. var elOverlay = "";
  27324. var elButton = "";
  27325. var elForm = "";
  27326. var elFormItem = "";
  27327. var elCascader = "";
  27328. var elInput = "";
  27329. var elPopper = "";
  27330. var elTag = "";
  27331. var elCascaderPanel = "";
  27332. var elCheckbox = "";
  27333. var elRadio = "";
  27334. var elScrollbar = "";
  27335. var elUpload = "";
  27336. var elProgress = "";
  27337. var elImage = "";
  27338. var elImageViewer = "";
  27339. var elSlider = "";
  27340. var elInputNumber = "";
  27341. var elTooltip = "";
  27342. var elSwitch = "";
  27343. var elOption = "";
  27344. var elOptionGroup = "";
  27345. var elSelect = "";
  27346. var elRate = "";
  27347. var elDatePicker = "";
  27348. var elTimePicker = "";
  27349. var elCheckboxGroup = "";
  27350. var elRadioGroup = "";
  27351. var elDivider = "";
  27352. var elTable = "";
  27353. var elTableColumn = "";
  27354. var GenerateFormItem_vue_vue_type_style_index_0_scoped_true_lang = "";
  27355. var _export_sfc = (sfc, props) => {
  27356. const target = sfc.__vccOpts || sfc;
  27357. for (const [key, val] of props) {
  27358. target[key] = val;
  27359. }
  27360. return target;
  27361. };
  27362. const _withScopeId = (n) => (pushScopeId("data-v-7e25971d"), n = n(), popScopeId(), n);
  27363. const _hoisted_1$6 = { key: 12 };
  27364. const _hoisted_2$5 = {
  27365. key: 1,
  27366. class: "custom:insert"
  27367. };
  27368. const _hoisted_3$4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("i", { class: "custom:img-upload mr-2" }, null, -1));
  27369. const _hoisted_4$4 = /* @__PURE__ */ createTextVNode("\u70B9\u51FB\u4E0A\u4F20 ");
  27370. const _hoisted_5$4 = ["href"];
  27371. const _hoisted_6$4 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  27372. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  27373. props: {
  27374. config: null,
  27375. element: null,
  27376. model: null,
  27377. updatedModel: null,
  27378. disabled: { type: Boolean },
  27379. request: null
  27380. },
  27381. setup(__props) {
  27382. const props = __props;
  27383. const originData = props.model[props.element.model];
  27384. const data2 = computed({
  27385. get: () => props.model[props.element.model],
  27386. set: (val) => {
  27387. props.model[props.element.model] = val;
  27388. if (JSON.stringify(originData) === JSON.stringify(val)) {
  27389. Reflect.deleteProperty(props.updatedModel, props.element.model);
  27390. } else {
  27391. props.updatedModel[props.element.model] = val;
  27392. }
  27393. }
  27394. });
  27395. const handleUploadSuccess = (_res, _file, fileList) => {
  27396. data2.value = fileList;
  27397. };
  27398. async function download(defaultValue, label) {
  27399. const a2 = document.createElement("a");
  27400. if (!props.request)
  27401. return;
  27402. a2.href = await props.request({
  27403. url: `/sys/common/static/${defaultValue}`,
  27404. responseType: "blob"
  27405. }).then((i) => {
  27406. if (i.size === 0)
  27407. return "";
  27408. return URL.createObjectURL(i);
  27409. });
  27410. a2.download = `${label}.${defaultValue.split(".")[1]}`;
  27411. a2.click();
  27412. }
  27413. return (_ctx, _cache) => {
  27414. const _component_GenerateFormItem = resolveComponent("GenerateFormItem", true);
  27415. const _component_el_table_column = ElTableColumn;
  27416. const _component_el_table = ElTable;
  27417. const _component_el_divider = ElDivider;
  27418. const _component_el_input = ElInput;
  27419. const _component_el_input_number = ElInputNumber;
  27420. const _component_el_radio = ElRadio;
  27421. const _component_el_radio_group = ElRadioGroup;
  27422. const _component_el_checkbox = ElCheckbox;
  27423. const _component_el_checkbox_group = ElCheckboxGroup$1;
  27424. const _component_el_time_picker = ElTimePicker;
  27425. const _component_el_date_picker = ElDatePicker;
  27426. const _component_el_rate = ElRate;
  27427. const _component_el_option = ElOption;
  27428. const _component_el_select = ElSelect;
  27429. const _component_el_switch = ElSwitch;
  27430. const _component_el_slider = ElSlider;
  27431. const _component_el_image = ElImage;
  27432. const _component_el_button = ElButton;
  27433. const _component_el_upload = ElUpload;
  27434. const _component_el_cascader = ElCascader;
  27435. const _component_el_form_item = ElFormItem;
  27436. return __props.element.type === "grid" ? (openBlock(), createElementBlock("div", {
  27437. key: 0,
  27438. grid: "~ cols-24",
  27439. style: normalizeStyle(`gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};`)
  27440. }, [
  27441. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (col, colIndex) => {
  27442. return openBlock(), createElementBlock("div", {
  27443. key: colIndex,
  27444. style: normalizeStyle(`grid-column: span ${col.span}`)
  27445. }, [
  27446. (openBlock(true), createElementBlock(Fragment, null, renderList(col.list, (colItem) => {
  27447. return openBlock(), createBlock(_component_GenerateFormItem, {
  27448. key: colItem.key,
  27449. request: __props.request,
  27450. model: __props.model,
  27451. "updated-model": __props.updatedModel,
  27452. element: colItem,
  27453. config: __props.config,
  27454. disabled: __props.disabled
  27455. }, null, 8, ["request", "model", "updated-model", "element", "config", "disabled"]);
  27456. }), 128))
  27457. ], 4);
  27458. }), 128))
  27459. ], 4)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  27460. key: 1,
  27461. border: "",
  27462. class: "mb-4.5",
  27463. data: __props.element.options.defaultValue
  27464. }, {
  27465. default: withCtx(() => [
  27466. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  27467. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  27468. key: i.prop,
  27469. align: __props.element.options.align
  27470. }, i), null, 16, ["align"]);
  27471. }), 128))
  27472. ]),
  27473. _: 1
  27474. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  27475. key: 2,
  27476. data: __props.element.options.defaultValue,
  27477. "content-position": "left"
  27478. }, {
  27479. default: withCtx(() => [
  27480. createTextVNode(toDisplayString(__props.element.label), 1)
  27481. ]),
  27482. _: 1
  27483. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  27484. key: __props.element.key,
  27485. label: __props.element.label,
  27486. prop: __props.element.model,
  27487. style: normalizeStyle(__props.element.type === "download" ? "display:inline-flex;margin-right:40px" : ""),
  27488. "label-width": __props.element.labelWidth
  27489. }, createSlots({
  27490. default: withCtx(() => [
  27491. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  27492. key: 0,
  27493. modelValue: unref(data2),
  27494. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(data2) ? data2.value = $event : null),
  27495. style: normalizeStyle({ width: __props.element.options.width }),
  27496. placeholder: __props.element.options.placeholder,
  27497. maxlength: parseInt(__props.element.options.maxlength),
  27498. clearable: __props.element.options.clearable,
  27499. readonly: __props.element.options.readonly,
  27500. disabled: __props.disabled || __props.element.options.disabled
  27501. }, createSlots({ _: 2 }, [
  27502. __props.element.options.prefix ? {
  27503. name: "prefix",
  27504. fn: withCtx(() => [
  27505. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  27506. ])
  27507. } : void 0,
  27508. __props.element.options.suffix ? {
  27509. name: "suffix",
  27510. fn: withCtx(() => [
  27511. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  27512. ])
  27513. } : void 0,
  27514. __props.element.options.prepend ? {
  27515. name: "prepend",
  27516. fn: withCtx(() => [
  27517. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  27518. ])
  27519. } : void 0,
  27520. __props.element.options.append ? {
  27521. name: "append",
  27522. fn: withCtx(() => [
  27523. createTextVNode(toDisplayString(__props.element.options.append), 1)
  27524. ])
  27525. } : void 0
  27526. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  27527. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  27528. key: 1,
  27529. modelValue: unref(data2),
  27530. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(data2) ? data2.value = $event : null),
  27531. style: normalizeStyle({ width: __props.element.options.width }),
  27532. placeholder: __props.element.options.placeholder,
  27533. maxlength: parseInt(__props.element.options.maxlength),
  27534. clearable: __props.element.options.clearable,
  27535. disabled: __props.disabled || __props.element.options.disabled,
  27536. readonly: __props.element.options.readonly,
  27537. "show-password": __props.element.options.showPassword
  27538. }, createSlots({ _: 2 }, [
  27539. __props.element.options.prefix ? {
  27540. name: "prefix",
  27541. fn: withCtx(() => [
  27542. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  27543. ])
  27544. } : void 0,
  27545. __props.element.options.suffix ? {
  27546. name: "suffix",
  27547. fn: withCtx(() => [
  27548. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  27549. ])
  27550. } : void 0,
  27551. __props.element.options.prepend ? {
  27552. name: "prepend",
  27553. fn: withCtx(() => [
  27554. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  27555. ])
  27556. } : void 0,
  27557. __props.element.options.append ? {
  27558. name: "append",
  27559. fn: withCtx(() => [
  27560. createTextVNode(toDisplayString(__props.element.options.append), 1)
  27561. ])
  27562. } : void 0
  27563. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "disabled", "readonly", "show-password"])) : createCommentVNode("", true),
  27564. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  27565. key: 2,
  27566. modelValue: unref(data2),
  27567. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(data2) ? data2.value = $event : null),
  27568. type: "textarea",
  27569. resize: "none",
  27570. rows: __props.element.options.rows,
  27571. style: normalizeStyle({ width: __props.element.options.width }),
  27572. placeholder: __props.element.options.placeholder,
  27573. maxlength: parseInt(__props.element.options.maxlength),
  27574. "show-word-limit": __props.element.options.showWordLimit,
  27575. autosize: __props.element.options.autosize,
  27576. clearable: __props.element.options.clearable,
  27577. readonly: __props.element.options.readonly,
  27578. disabled: __props.disabled || __props.element.options.disabled
  27579. }, null, 8, ["modelValue", "rows", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  27580. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  27581. key: 3,
  27582. modelValue: unref(data2),
  27583. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(data2) ? data2.value = $event : null),
  27584. style: normalizeStyle({ width: __props.element.options.width }),
  27585. max: __props.element.options.max,
  27586. min: __props.element.options.min,
  27587. disabled: __props.disabled || __props.element.options.disabled
  27588. }, null, 8, ["modelValue", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  27589. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  27590. key: 4,
  27591. modelValue: unref(data2),
  27592. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(data2) ? data2.value = $event : null),
  27593. style: normalizeStyle({ width: __props.element.options.width }),
  27594. disabled: __props.disabled || __props.element.options.disabled
  27595. }, {
  27596. default: withCtx(() => [
  27597. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  27598. return openBlock(), createBlock(_component_el_radio, {
  27599. key: item.value,
  27600. label: item.value,
  27601. style: normalizeStyle({
  27602. display: __props.element.options.inline ? "inline-block" : "block"
  27603. })
  27604. }, {
  27605. default: withCtx(() => [
  27606. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  27607. ]),
  27608. _: 2
  27609. }, 1032, ["label", "style"]);
  27610. }), 128))
  27611. ]),
  27612. _: 1
  27613. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  27614. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  27615. key: 5,
  27616. modelValue: unref(data2),
  27617. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(data2) ? data2.value = $event : null),
  27618. style: normalizeStyle({ width: __props.element.options.width }),
  27619. disabled: __props.disabled || __props.element.options.disabled
  27620. }, {
  27621. default: withCtx(() => [
  27622. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  27623. return openBlock(), createBlock(_component_el_checkbox, {
  27624. key: item.value,
  27625. label: item.value,
  27626. style: normalizeStyle({
  27627. display: __props.element.options.inline ? "inline-block" : "block"
  27628. })
  27629. }, {
  27630. default: withCtx(() => [
  27631. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  27632. ]),
  27633. _: 2
  27634. }, 1032, ["label", "style"]);
  27635. }), 128))
  27636. ]),
  27637. _: 1
  27638. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  27639. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_time_picker, {
  27640. key: 6,
  27641. modelValue: unref(data2),
  27642. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(data2) ? data2.value = $event : null),
  27643. placeholder: __props.element.options.placeholder,
  27644. readonly: __props.element.options.readonly,
  27645. editable: __props.element.options.editable,
  27646. clearable: __props.element.options.clearable,
  27647. format: __props.element.options.format,
  27648. disabled: __props.disabled || __props.element.options.disabled,
  27649. style: normalizeStyle({ width: __props.element.options.width })
  27650. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  27651. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_date_picker, {
  27652. key: 7,
  27653. modelValue: unref(data2),
  27654. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(data2) ? data2.value = $event : null),
  27655. placeholder: __props.element.options.placeholder,
  27656. readonly: __props.element.options.readonly,
  27657. editable: __props.element.options.editable,
  27658. clearable: __props.element.options.clearable,
  27659. format: __props.element.options.format,
  27660. disabled: __props.disabled || __props.element.options.disabled,
  27661. style: normalizeStyle({ width: __props.element.options.width })
  27662. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  27663. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  27664. key: 8,
  27665. modelValue: unref(data2),
  27666. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(data2) ? data2.value = $event : null),
  27667. max: __props.element.options.max,
  27668. "allow-half": __props.element.options.allowHalf,
  27669. disabled: __props.disabled || __props.element.options.disabled
  27670. }, null, 8, ["modelValue", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  27671. __props.element.type === "select" ? (openBlock(), createBlock(_component_el_select, {
  27672. key: 9,
  27673. modelValue: unref(data2),
  27674. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(data2) ? data2.value = $event : null),
  27675. multiple: __props.element.options.multiple,
  27676. placeholder: __props.element.options.placeholder,
  27677. clearable: __props.element.options.clearable,
  27678. filterable: __props.element.options.filterable,
  27679. disabled: __props.disabled || __props.element.options.disabled,
  27680. style: normalizeStyle({ width: __props.element.options.width })
  27681. }, {
  27682. default: withCtx(() => [
  27683. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  27684. return openBlock(), createBlock(_component_el_option, {
  27685. key: item.value,
  27686. value: item.value,
  27687. label: __props.element.options.showLabel ? item.label : item.value
  27688. }, null, 8, ["value", "label"]);
  27689. }), 128))
  27690. ]),
  27691. _: 1
  27692. }, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"])) : createCommentVNode("", true),
  27693. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  27694. key: 10,
  27695. modelValue: unref(data2),
  27696. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => isRef(data2) ? data2.value = $event : null),
  27697. "active-text": __props.element.options.activeText,
  27698. "inactive-text": __props.element.options.inactiveText,
  27699. disabled: __props.disabled || __props.element.options.disabled
  27700. }, null, 8, ["modelValue", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  27701. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  27702. key: 11,
  27703. modelValue: unref(data2),
  27704. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(data2) ? data2.value = $event : null),
  27705. min: __props.element.options.min,
  27706. max: __props.element.options.max,
  27707. step: __props.element.options.step,
  27708. range: __props.element.options.range,
  27709. disabled: __props.disabled || __props.element.options.disabled,
  27710. style: normalizeStyle({ width: __props.element.options.width })
  27711. }, null, 8, ["modelValue", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  27712. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$6, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  27713. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  27714. key: 13,
  27715. name: __props.element.options.file,
  27716. action: __props.element.options.action,
  27717. accept: __props.element.options.accept,
  27718. "list-type": __props.element.options.listType,
  27719. multiple: __props.element.options.multiple,
  27720. limit: __props.element.options.limit,
  27721. disabled: __props.disabled || __props.element.options.disabled,
  27722. "on-success": handleUploadSuccess
  27723. }, {
  27724. default: withCtx(() => {
  27725. var _a2;
  27726. return [
  27727. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  27728. ((_a2 = __props.element.options.defaultValue) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(_component_el_image, {
  27729. key: 0,
  27730. style: { "width": "100%", "height": "100%" },
  27731. "preview-src-list": [
  27732. "/api/sys/common/static/" + __props.element.options.defaultValue
  27733. ],
  27734. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  27735. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$5))
  27736. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  27737. default: withCtx(() => [
  27738. _hoisted_3$4,
  27739. _hoisted_4$4
  27740. ]),
  27741. _: 1
  27742. }))
  27743. ];
  27744. }),
  27745. _: 1
  27746. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  27747. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  27748. key: 14,
  27749. style: { "margin-top": "-4px" },
  27750. type: "text",
  27751. onClick: _cache[12] || (_cache[12] = ($event) => download(__props.element.options.defaultValue, __props.element.label))
  27752. }, {
  27753. default: withCtx(() => [
  27754. _hoisted_6$4
  27755. ]),
  27756. _: 1
  27757. })) : createCommentVNode("", true),
  27758. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  27759. key: 15,
  27760. modelValue: unref(data2),
  27761. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => isRef(data2) ? data2.value = $event : null),
  27762. options: __props.element.options.remoteOptions,
  27763. placeholder: __props.element.options.placeholder,
  27764. filterable: __props.element.options.filterable,
  27765. clearable: __props.element.options.clearable,
  27766. disabled: __props.disabled || __props.element.options.disabled,
  27767. style: normalizeStyle({ width: __props.element.options.width })
  27768. }, null, 8, ["modelValue", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  27769. ]),
  27770. _: 2
  27771. }, [
  27772. __props.element.type === "download" ? {
  27773. name: "label",
  27774. fn: withCtx(({ label }) => [
  27775. createElementVNode("a", {
  27776. href: `/api/sys/common/static/${__props.element.options.defaultValue}?inline=1`,
  27777. style: { "color": "#606266" },
  27778. target: "_blank"
  27779. }, toDisplayString(label), 9, _hoisted_5$4)
  27780. ])
  27781. } : void 0
  27782. ]), 1032, ["label", "prop", "style", "label-width"])) : createCommentVNode("", true);
  27783. };
  27784. }
  27785. });
  27786. var GenerateFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-7e25971d"]]);
  27787. const _sfc_main$7 = defineComponent({
  27788. name: "FormGenerate",
  27789. components: {
  27790. GenerateFormItem
  27791. },
  27792. props: {
  27793. data: {
  27794. type: Object,
  27795. default: getWidgetForm()
  27796. },
  27797. value: {
  27798. type: Object
  27799. },
  27800. disabled: {
  27801. type: Boolean,
  27802. default: false
  27803. },
  27804. request: {
  27805. type: Function
  27806. }
  27807. },
  27808. setup(props) {
  27809. var _a2;
  27810. const state = reactive({
  27811. generateForm: null,
  27812. model: {},
  27813. updatedModel: {},
  27814. rules: {},
  27815. widgetForm: (_a2 = props.data && JSON.parse(JSON.stringify(props.data))) != null ? _a2 : getWidgetForm()
  27816. });
  27817. const generateModel = (list) => {
  27818. for (let index = 0; index < list.length; index++) {
  27819. const model = list[index].model;
  27820. if (!model)
  27821. return;
  27822. if (list[index].type === "grid") {
  27823. list[index].columns.forEach((col) => generateModel(col.list));
  27824. } else {
  27825. if (props.value && Object.keys(props.value).includes(model))
  27826. state.model[model] = props.value[model];
  27827. else
  27828. state.model[model] = list[index].options.defaultValue;
  27829. state.rules[model] = list[index].options.rules;
  27830. }
  27831. }
  27832. };
  27833. const generateOptions = (list) => {
  27834. list.forEach(async (item) => {
  27835. if (item.type === "grid") {
  27836. item.columns.forEach((col) => generateOptions(col.list));
  27837. } else {
  27838. if (item.options.remote && item.options.remoteFunc) {
  27839. if (props.request) {
  27840. const { data: data2 } = await props.request({
  27841. url: item.options.remoteFunc
  27842. });
  27843. item.options.remoteOptions = data2.map((i) => ({
  27844. label: i[item.options.props.label],
  27845. value: i[item.options.props.value],
  27846. children: i[item.options.props.children]
  27847. }));
  27848. return;
  27849. }
  27850. const token = sessionStorage.getItem("token");
  27851. fetch(item.options.remoteFunc, {
  27852. headers: {
  27853. "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
  27854. "Token": token
  27855. }
  27856. }).then((resp) => resp.json()).then((json) => {
  27857. const res = json.data;
  27858. if (res instanceof Array) {
  27859. item.options.remoteOptions = res.map((data2) => ({
  27860. label: data2[item.options.props.label],
  27861. value: data2[item.options.props.value],
  27862. children: data2[item.options.props.children]
  27863. }));
  27864. }
  27865. });
  27866. }
  27867. }
  27868. });
  27869. };
  27870. watch(() => props.data, (val) => {
  27871. var _a3;
  27872. state.widgetForm = (_a3 = val && JSON.parse(JSON.stringify(val))) != null ? _a3 : getWidgetForm();
  27873. state.model = {};
  27874. state.rules = {};
  27875. generateModel(state.widgetForm.list);
  27876. generateOptions(state.widgetForm.list);
  27877. }, { deep: true, immediate: true });
  27878. const getData = () => {
  27879. return new Promise((resolve, reject) => {
  27880. state.generateForm.validate().then((validate) => {
  27881. if (validate)
  27882. resolve(state.updatedModel);
  27883. else
  27884. ElMessage.error("\u9A8C\u8BC1\u5931\u8D25");
  27885. }).catch((error) => {
  27886. reject(error);
  27887. });
  27888. });
  27889. };
  27890. const reset = () => {
  27891. state.generateForm.resetFields();
  27892. };
  27893. return __spreadProps(__spreadValues({}, toRefs(state)), {
  27894. getData,
  27895. reset
  27896. });
  27897. }
  27898. });
  27899. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  27900. const _component_GenerateFormItem = resolveComponent("GenerateFormItem");
  27901. const _component_el_form = ElForm;
  27902. return openBlock(), createBlock(_component_el_form, {
  27903. ref: "generateForm",
  27904. "label-suffix": ":",
  27905. model: _ctx.model,
  27906. rules: _ctx.rules,
  27907. size: _ctx.widgetForm.config.size,
  27908. "label-position": _ctx.widgetForm.config.labelPosition,
  27909. "label-width": `${_ctx.widgetForm.config.labelWidth}px`,
  27910. "hide-required-asterisk": _ctx.widgetForm.config.hideRequiredAsterisk
  27911. }, {
  27912. default: withCtx(() => [
  27913. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.widgetForm.list, (element, index) => {
  27914. return openBlock(), createBlock(_component_GenerateFormItem, {
  27915. key: element.key,
  27916. model: _ctx.model,
  27917. "updated-model": _ctx.updatedModel,
  27918. element: _ctx.widgetForm.list[index],
  27919. config: _ctx.data.config,
  27920. disabled: _ctx.disabled,
  27921. request: _ctx.request
  27922. }, null, 8, ["model", "updated-model", "element", "config", "disabled", "request"]);
  27923. }), 128))
  27924. ]),
  27925. _: 1
  27926. }, 8, ["model", "rules", "size", "label-position", "label-width", "hide-required-asterisk"]);
  27927. }
  27928. var GenerateForm = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$1]]);
  27929. const isClient = typeof window !== "undefined";
  27930. isClient ? window : void 0;
  27931. isClient ? window.document : void 0;
  27932. isClient ? window.navigator : void 0;
  27933. isClient ? window.location : void 0;
  27934. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  27935. const globalKey = "__vueuse_ssr_handlers__";
  27936. _global[globalKey] = _global[globalKey] || {};
  27937. _global[globalKey];
  27938. var _a, _b;
  27939. 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);
  27940. function useVModel(props, key, emit, options = {}) {
  27941. var _a2;
  27942. const {
  27943. passive: passive2 = false,
  27944. eventName,
  27945. deep = false
  27946. } = options;
  27947. const vm = getCurrentInstance();
  27948. const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a2 = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a2.bind(vm));
  27949. let event = eventName;
  27950. if (!key) {
  27951. {
  27952. key = "modelValue";
  27953. }
  27954. }
  27955. event = eventName || event || `update:${key}`;
  27956. if (passive2) {
  27957. const proxy = ref(props[key]);
  27958. watch(() => props[key], (v2) => proxy.value = v2);
  27959. watch(proxy, (v2) => {
  27960. if (v2 !== props[key] || deep)
  27961. _emit(event, v2);
  27962. }, {
  27963. deep
  27964. });
  27965. return proxy;
  27966. } else {
  27967. return computed({
  27968. get() {
  27969. return props[key];
  27970. },
  27971. set(value) {
  27972. _emit(event, value);
  27973. }
  27974. });
  27975. }
  27976. }
  27977. const _hoisted_1$5 = { class: "px-3 py-2 text-sm text-gray-700" };
  27978. const _hoisted_2$4 = {
  27979. key: 0,
  27980. 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"
  27981. };
  27982. let listIndex = 1;
  27983. function setListIndex(list) {
  27984. if (list.list.length > 0) {
  27985. const array4 = list.list.map((item) => item.model);
  27986. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  27987. const match = item.match(/plate(\d+)/);
  27988. return match ? match[1] : null;
  27989. });
  27990. listIndex = findMissingPositive(plateNumbers);
  27991. }
  27992. }
  27993. function cloneWidget(params) {
  27994. const key = Math.random().toString(36).substring(2, 9);
  27995. params = cloneDeep(__spreadProps(__spreadValues({}, params), {
  27996. key,
  27997. model: `plate${listIndex}`
  27998. }));
  27999. if (params.type === "grid") {
  28000. params.columns.forEach((i) => {
  28001. i.list = i.list.map(cloneWidget);
  28002. });
  28003. }
  28004. return params;
  28005. }
  28006. function findMissingPositive(nums) {
  28007. let numbers = nums.map(Number);
  28008. numbers.sort((a2, b2) => a2 - b2);
  28009. let missing = 1;
  28010. for (let i = 0; i < numbers.length; i++) {
  28011. if (numbers[i] === missing) {
  28012. missing++;
  28013. }
  28014. }
  28015. return missing;
  28016. }
  28017. const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  28018. props: {
  28019. fields: null,
  28020. title: null,
  28021. list: null,
  28022. allList: null
  28023. },
  28024. setup(__props) {
  28025. const props = __props;
  28026. let moveFlag = ref(false);
  28027. const moveStart = () => {
  28028. const array4 = props.allList.list.map((item) => item.model);
  28029. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  28030. const match = item.match(/plate(\d+)/);
  28031. return match ? match[1] : null;
  28032. });
  28033. const flag = plateNumbers.length < 5;
  28034. if (!flag && !moveFlag.value) {
  28035. moveFlag.value = true;
  28036. ElMessage.warning("\u6700\u591A\u6DFB\u52A0\u4E94\u4E2A");
  28037. return false;
  28038. }
  28039. return flag;
  28040. };
  28041. const stopMove = () => {
  28042. moveFlag.value = false;
  28043. };
  28044. return (_ctx, _cache) => {
  28045. return openBlock(), createElementBlock(Fragment, null, [
  28046. createElementVNode("div", _hoisted_1$5, toDisplayString(__props.title), 1),
  28047. createVNode(unref(Draggable), {
  28048. tag: "ul",
  28049. class: "m-0 p-3 pt-0 grid grid-cols-2 gap-1",
  28050. "item-key": "type",
  28051. group: { name: "form-design", pull: "clone", put: false },
  28052. clone: cloneWidget,
  28053. sort: false,
  28054. list: __props.list,
  28055. allList: __props.allList,
  28056. move: moveStart,
  28057. choose: setListIndex(__props.allList),
  28058. onAdd: _cache[0] || (_cache[0] = ($event) => stopMove())
  28059. }, {
  28060. item: withCtx(({ element }) => [
  28061. __props.fields.includes(element.type) ? (openBlock(), createElementBlock("li", _hoisted_2$4, [
  28062. createElementVNode("i", {
  28063. class: normalizeClass(["custom:" + element.type, "ml-2 mr-1"])
  28064. }, null, 2),
  28065. createElementVNode("span", null, toDisplayString(element.label), 1)
  28066. ])) : createCommentVNode("", true)
  28067. ]),
  28068. _: 1
  28069. }, 8, ["list", "allList", "choose"])
  28070. ], 64);
  28071. };
  28072. }
  28073. });
  28074. const _hoisted_1$4 = { key: 12 };
  28075. const _hoisted_2$3 = {
  28076. key: 1,
  28077. class: "custom:insert"
  28078. };
  28079. const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("i", {
  28080. "icon-class": "custom:img-upload",
  28081. style: { "margin-right": "10px" }
  28082. }, null, -1);
  28083. const _hoisted_4$3 = /* @__PURE__ */ createTextVNode(" \u70B9\u51FB\u4E0A\u4F20 ");
  28084. const _hoisted_5$3 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  28085. const _hoisted_6$3 = /* @__PURE__ */ createElementVNode("i", {
  28086. class: "eva:move-outline",
  28087. "text-lg": ""
  28088. }, null, -1);
  28089. const _hoisted_7$2 = [
  28090. _hoisted_6$3
  28091. ];
  28092. const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  28093. props: {
  28094. list: null,
  28095. element: null,
  28096. index: null,
  28097. selectWidget: null
  28098. },
  28099. emits: ["itemClick", "delete", "update:selectWidget"],
  28100. setup(__props) {
  28101. const props = createPropsRestProxy(__props, ["element", "index", "list"]);
  28102. let selectWidget = useVModel(props, "selectWidget");
  28103. const handleDeleteClick = () => {
  28104. __props.list.splice(__props.index, 1);
  28105. selectWidget.value = __props.list[__props.list.length === __props.index ? __props.index - 1 : __props.index];
  28106. };
  28107. return (_ctx, _cache) => {
  28108. var _a2, _b2;
  28109. const _component_WidgetFormItem = resolveComponent("WidgetFormItem", true);
  28110. const _component_el_table_column = ElTableColumn;
  28111. const _component_el_table = ElTable;
  28112. const _component_el_divider = ElDivider;
  28113. const _component_el_input = ElInput;
  28114. const _component_el_input_number = ElInputNumber;
  28115. const _component_el_radio = ElRadio;
  28116. const _component_el_radio_group = ElRadioGroup;
  28117. const _component_el_checkbox = ElCheckbox;
  28118. const _component_el_checkbox_group = ElCheckboxGroup$1;
  28119. const _component_el_time_picker = ElTimePicker;
  28120. const _component_el_date_picker = ElDatePicker;
  28121. const _component_el_rate = ElRate;
  28122. const _component_el_option = ElOption;
  28123. const _component_el_select = ElSelect;
  28124. const _component_el_switch = ElSwitch;
  28125. const _component_el_slider = ElSlider;
  28126. const _component_el_image = ElImage;
  28127. const _component_el_button = ElButton;
  28128. const _component_el_upload = ElUpload;
  28129. const _component_el_cascader = ElCascader;
  28130. const _component_el_form_item = ElFormItem;
  28131. return openBlock(), createElementBlock("div", {
  28132. class: normalizeClass(["widget-view", { active: ((_a2 = selectWidget.value) == null ? void 0 : _a2.key) === __props.element.key, col: __props.element.type === "grid" }]),
  28133. style: normalizeStyle(__props.element.type === "grid" ? `gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};` : ""),
  28134. onClick: _cache[3] || (_cache[3] = withModifiers(($event) => selectWidget.value = __props.element, ["stop"]))
  28135. }, [
  28136. __props.element.type === "grid" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.element.columns, (col, key) => {
  28137. return openBlock(), createBlock(unref(Draggable), {
  28138. key,
  28139. class: "bg-white min-h-12 border border-dashed border-gray-300",
  28140. style: normalizeStyle(`grid-column: span ${col.span}`),
  28141. "item-key": "key",
  28142. handle: "[cursor-move]",
  28143. animation: 200,
  28144. group: "form-design",
  28145. "no-transition-on-drag": true,
  28146. list: col.list,
  28147. onAdd: ($event) => selectWidget.value = col.list[$event.newIndex]
  28148. }, {
  28149. item: withCtx(({ element: colElement, index: colIndex }) => [
  28150. createVNode(_component_WidgetFormItem, {
  28151. selectWidget: selectWidget.value,
  28152. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => selectWidget.value = $event),
  28153. element: colElement,
  28154. list: col.list,
  28155. index: colIndex
  28156. }, null, 8, ["selectWidget", "element", "list", "index"])
  28157. ]),
  28158. _: 2
  28159. }, 1032, ["style", "list", "onAdd"]);
  28160. }), 128)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  28161. key: 1,
  28162. class: "w-0 flex-1",
  28163. border: "",
  28164. data: __props.element.options.defaultValue
  28165. }, {
  28166. default: withCtx(() => [
  28167. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  28168. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  28169. key: i.prop,
  28170. "header-align": __props.element.options.align,
  28171. align: __props.element.options.align
  28172. }, i), null, 16, ["header-align", "align"]);
  28173. }), 128))
  28174. ]),
  28175. _: 1
  28176. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  28177. key: 2,
  28178. class: "pb-0",
  28179. data: __props.element.options.defaultValue,
  28180. "content-position": "left"
  28181. }, {
  28182. default: withCtx(() => [
  28183. createTextVNode(toDisplayString(__props.element.label), 1)
  28184. ]),
  28185. _: 1
  28186. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  28187. key: __props.element.key,
  28188. label: __props.element.label,
  28189. "label-width": __props.element.labelWidth,
  28190. rules: __props.element.options.rules
  28191. }, {
  28192. default: withCtx(() => [
  28193. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  28194. key: 0,
  28195. readonly: "",
  28196. "model-value": __props.element.options.defaultValue,
  28197. style: normalizeStyle({ width: __props.element.options.width }),
  28198. placeholder: __props.element.options.placeholder,
  28199. maxlength: parseInt(__props.element.options.maxlength),
  28200. clearable: __props.element.options.clearable,
  28201. disabled: __props.element.options.disabled
  28202. }, createSlots({ _: 2 }, [
  28203. __props.element.options.prefix ? {
  28204. name: "prefix",
  28205. fn: withCtx(() => [
  28206. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28207. ])
  28208. } : void 0,
  28209. __props.element.options.suffix ? {
  28210. name: "suffix",
  28211. fn: withCtx(() => [
  28212. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28213. ])
  28214. } : void 0,
  28215. __props.element.options.prepend ? {
  28216. name: "prepend",
  28217. fn: withCtx(() => [
  28218. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28219. ])
  28220. } : void 0,
  28221. __props.element.options.append ? {
  28222. name: "append",
  28223. fn: withCtx(() => [
  28224. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28225. ])
  28226. } : void 0
  28227. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled"])) : createCommentVNode("", true),
  28228. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  28229. key: 1,
  28230. readonly: "",
  28231. "model-value": __props.element.options.defaultValue,
  28232. style: normalizeStyle({ width: __props.element.options.width }),
  28233. placeholder: __props.element.options.placeholder,
  28234. maxlength: parseInt(__props.element.options.maxlength),
  28235. clearable: __props.element.options.clearable,
  28236. disabled: __props.element.options.disabled,
  28237. "show-password": __props.element.options.showPassword
  28238. }, createSlots({ _: 2 }, [
  28239. __props.element.options.prefix ? {
  28240. name: "prefix",
  28241. fn: withCtx(() => [
  28242. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28243. ])
  28244. } : void 0,
  28245. __props.element.options.suffix ? {
  28246. name: "suffix",
  28247. fn: withCtx(() => [
  28248. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28249. ])
  28250. } : void 0,
  28251. __props.element.options.prepend ? {
  28252. name: "prepend",
  28253. fn: withCtx(() => [
  28254. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28255. ])
  28256. } : void 0,
  28257. __props.element.options.append ? {
  28258. name: "append",
  28259. fn: withCtx(() => [
  28260. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28261. ])
  28262. } : void 0
  28263. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled", "show-password"])) : createCommentVNode("", true),
  28264. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  28265. key: 2,
  28266. type: "textarea",
  28267. resize: "none",
  28268. readonly: "",
  28269. rows: __props.element.options.rows,
  28270. "model-value": __props.element.options.defaultValue,
  28271. style: normalizeStyle({ width: __props.element.options.width }),
  28272. placeholder: __props.element.options.placeholder,
  28273. maxlength: parseInt(__props.element.options.maxlength),
  28274. "show-word-limit": __props.element.options.showWordLimit,
  28275. autosize: __props.element.options.autosize,
  28276. clearable: __props.element.options.clearable,
  28277. disabled: __props.element.options.disabled
  28278. }, null, 8, ["rows", "model-value", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "disabled"])) : createCommentVNode("", true),
  28279. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  28280. key: 3,
  28281. "model-value": __props.element.options.defaultValue,
  28282. style: normalizeStyle({ width: __props.element.options.width }),
  28283. max: __props.element.options.max,
  28284. min: __props.element.options.min,
  28285. disabled: __props.element.options.disabled
  28286. }, null, 8, ["model-value", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  28287. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  28288. key: 4,
  28289. "model-value": __props.element.options.defaultValue,
  28290. style: normalizeStyle({ width: __props.element.options.width }),
  28291. disabled: __props.element.options.disabled
  28292. }, {
  28293. default: withCtx(() => [
  28294. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28295. return openBlock(), createBlock(_component_el_radio, {
  28296. key: item.value,
  28297. label: item.value,
  28298. style: normalizeStyle({
  28299. display: __props.element.options.inline ? "inline-block" : "block"
  28300. })
  28301. }, {
  28302. default: withCtx(() => [
  28303. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28304. ]),
  28305. _: 2
  28306. }, 1032, ["label", "style"]);
  28307. }), 128))
  28308. ]),
  28309. _: 1
  28310. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  28311. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  28312. key: 5,
  28313. "model-value": __props.element.options.defaultValue,
  28314. style: normalizeStyle({ width: __props.element.options.width }),
  28315. disabled: __props.element.options.disabled
  28316. }, {
  28317. default: withCtx(() => [
  28318. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28319. return openBlock(), createBlock(_component_el_checkbox, {
  28320. key: item.value,
  28321. label: item.value,
  28322. style: normalizeStyle({
  28323. display: __props.element.options.inline ? "inline-block" : "block"
  28324. })
  28325. }, {
  28326. default: withCtx(() => [
  28327. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28328. ]),
  28329. _: 2
  28330. }, 1032, ["label", "style"]);
  28331. }), 128))
  28332. ]),
  28333. _: 1
  28334. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  28335. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_time_picker, {
  28336. key: 6,
  28337. "model-value": __props.element.options.defaultValue,
  28338. placeholder: __props.element.options.placeholder,
  28339. readonly: __props.element.options.readonly,
  28340. editable: __props.element.options.editable,
  28341. clearable: __props.element.options.clearable,
  28342. format: __props.element.options.format,
  28343. disabled: __props.element.options.disabled,
  28344. style: normalizeStyle({ width: __props.element.options.width })
  28345. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  28346. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_date_picker, {
  28347. key: 7,
  28348. "model-value": __props.element.options.defaultValue,
  28349. placeholder: __props.element.options.placeholder,
  28350. readonly: __props.element.options.readonly,
  28351. editable: __props.element.options.editable,
  28352. clearable: __props.element.options.clearable,
  28353. format: __props.element.options.format,
  28354. disabled: __props.element.options.disabled,
  28355. style: normalizeStyle({ width: __props.element.options.width })
  28356. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  28357. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  28358. key: 8,
  28359. "model-value": __props.element.options.defaultValue,
  28360. max: __props.element.options.max,
  28361. "allow-half": __props.element.options.allowHalf,
  28362. disabled: __props.element.options.disabled
  28363. }, null, 8, ["model-value", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  28364. __props.element.type === "select" ? (openBlock(), createBlock(_component_el_select, {
  28365. key: 9,
  28366. "model-value": __props.element.options.defaultValue,
  28367. multiple: __props.element.options.multiple,
  28368. placeholder: __props.element.options.placeholder,
  28369. clearable: __props.element.options.clearable,
  28370. filterable: __props.element.options.filterable,
  28371. disabled: __props.element.options.disabled,
  28372. style: normalizeStyle({ width: __props.element.options.width })
  28373. }, {
  28374. default: withCtx(() => [
  28375. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28376. return openBlock(), createBlock(_component_el_option, {
  28377. key: item.value,
  28378. value: item.value,
  28379. label: __props.element.options.showLabel ? item.label : item.value
  28380. }, null, 8, ["value", "label"]);
  28381. }), 128))
  28382. ]),
  28383. _: 1
  28384. }, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"])) : createCommentVNode("", true),
  28385. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  28386. key: 10,
  28387. "model-value": __props.element.options.defaultValue,
  28388. "active-text": __props.element.options.activeText,
  28389. "inactive-text": __props.element.options.inactiveText,
  28390. disabled: __props.element.options.disabled
  28391. }, null, 8, ["model-value", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  28392. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  28393. key: 11,
  28394. "model-value": __props.element.options.defaultValue,
  28395. min: __props.element.options.min,
  28396. max: __props.element.options.max,
  28397. step: __props.element.options.step,
  28398. range: __props.element.options.range,
  28399. disabled: __props.element.options.disabled,
  28400. style: normalizeStyle({ width: __props.element.options.width })
  28401. }, null, 8, ["model-value", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  28402. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$4, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  28403. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  28404. key: 13,
  28405. name: __props.element.options.file,
  28406. action: __props.element.options.action,
  28407. accept: __props.element.options.accept,
  28408. "list-type": __props.element.options.listType,
  28409. multiple: __props.element.options.multiple,
  28410. limit: __props.element.options.limit,
  28411. disabled: __props.element.options.disabled
  28412. }, {
  28413. default: withCtx(() => {
  28414. var _a3;
  28415. return [
  28416. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  28417. ((_a3 = __props.element.options.defaultValue) == null ? void 0 : _a3.length) ? (openBlock(), createBlock(_component_el_image, {
  28418. key: 0,
  28419. style: { "width": "100%", "height": "100%" },
  28420. "preview-src-list": [
  28421. "/api/sys/common/static/" + __props.element.options.defaultValue
  28422. ],
  28423. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  28424. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$3))
  28425. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  28426. default: withCtx(() => [
  28427. _hoisted_3$3,
  28428. _hoisted_4$3
  28429. ]),
  28430. _: 1
  28431. }))
  28432. ];
  28433. }),
  28434. _: 1
  28435. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  28436. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  28437. key: 14,
  28438. type: "text",
  28439. style: { "margin-top": "-4px" }
  28440. }, {
  28441. default: withCtx(() => [
  28442. _hoisted_5$3
  28443. ]),
  28444. _: 1
  28445. })) : createCommentVNode("", true),
  28446. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  28447. key: 15,
  28448. "model-value": __props.element.options.defaultValue,
  28449. options: __props.element.options.remoteOptions,
  28450. placeholder: __props.element.options.placeholder,
  28451. filterable: __props.element.options.filterable,
  28452. clearable: __props.element.options.clearable,
  28453. disabled: __props.element.options.disabled,
  28454. style: normalizeStyle({ width: __props.element.options.width })
  28455. }, null, 8, ["model-value", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  28456. ]),
  28457. _: 1
  28458. }, 8, ["label", "label-width", "rules"])) : createCommentVNode("", true),
  28459. ((_b2 = selectWidget.value) == null ? void 0 : _b2.key) === __props.element.key ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  28460. createElementVNode("div", {
  28461. absolute: "",
  28462. "z-10": "",
  28463. "left-0": "",
  28464. top: "-.5",
  28465. "bg-blue-500": "",
  28466. "text-white": "",
  28467. p: ".5 l-0 t-0",
  28468. "cursor-move": "",
  28469. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  28470. }, _hoisted_7$2, 2),
  28471. createElementVNode("div", {
  28472. absolute: "",
  28473. "z-10": "",
  28474. "right-0": "",
  28475. bottom: "-0.5",
  28476. "bg-blue-500": "",
  28477. flex: "",
  28478. "gap-1": "",
  28479. p: "1 r-.5",
  28480. "text-white": "",
  28481. "cursor-pointer": "",
  28482. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  28483. }, [
  28484. createCommentVNode("", true),
  28485. !__props.element.allDisable ? (openBlock(), createElementBlock("i", {
  28486. key: 1,
  28487. class: "fa6-regular:trash-can",
  28488. onClick: _cache[2] || (_cache[2] = withModifiers(($event) => handleDeleteClick(), ["stop"]))
  28489. })) : createCommentVNode("", true)
  28490. ], 2)
  28491. ], 64)) : createCommentVNode("", true)
  28492. ], 6);
  28493. };
  28494. }
  28495. });
  28496. var WidgetForm_vue_vue_type_style_index_0_lang = "";
  28497. const _hoisted_1$3 = {
  28498. key: 0,
  28499. text: "gray-400 lg",
  28500. absolute: "",
  28501. "top-50": "",
  28502. left: "1/2",
  28503. "translate-x": "-1/2"
  28504. };
  28505. const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  28506. props: {
  28507. list: null,
  28508. config: null,
  28509. selectWidget: null
  28510. },
  28511. emits: ["update:selectWidget"],
  28512. setup(__props) {
  28513. const props = __props;
  28514. const selectWidget = useVModel(props, "selectWidget");
  28515. return (_ctx, _cache) => {
  28516. const _component_el_form = ElForm;
  28517. return openBlock(), createBlock(_component_el_form, mergeProps({
  28518. "label-suffix": ":",
  28519. "bg-gray-50": "",
  28520. relative: "",
  28521. flex: "~ 1"
  28522. }, __props.config, { class: "layoutForm" }), {
  28523. default: withCtx(() => {
  28524. var _a2;
  28525. return [
  28526. !((_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),
  28527. createVNode(unref(Draggable), {
  28528. class: "flex-1 m-2 bg-white shadow p-1",
  28529. "item-key": "key",
  28530. handle: "[cursor-move]",
  28531. animation: 200,
  28532. group: "form-design",
  28533. list: __props.list,
  28534. onAdd: _cache[1] || (_cache[1] = ($event) => selectWidget.value = __props.list[$event.newIndex])
  28535. }, {
  28536. item: withCtx(({ element, index }) => [
  28537. createVNode(_sfc_main$5, {
  28538. selectWidget: unref(selectWidget),
  28539. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => isRef(selectWidget) ? selectWidget.value = $event : null),
  28540. element,
  28541. index,
  28542. list: __props.list
  28543. }, null, 8, ["selectWidget", "element", "index", "list"])
  28544. ]),
  28545. _: 1
  28546. }, 8, ["list"])
  28547. ];
  28548. }),
  28549. _: 1
  28550. }, 16);
  28551. };
  28552. }
  28553. });
  28554. var elSpace = "";
  28555. var elRadioButton = "";
  28556. var WidgetConfig_vue_vue_type_style_index_0_lang = "";
  28557. const _sfc_main$3 = defineComponent({
  28558. name: "ElWidgetConfig",
  28559. components: {
  28560. Draggable
  28561. },
  28562. props: {
  28563. select: {
  28564. type: Object
  28565. }
  28566. },
  28567. emits: ["update:select"],
  28568. setup(props, context) {
  28569. const data2 = ref(props.select);
  28570. watch(() => props.select, (val) => data2.value = val);
  28571. watch(data2, (val) => context.emit("update:select", val), { deep: true });
  28572. const hasKey = (key) => Object.keys(data2.value.options).includes(key);
  28573. const handleInsertColumn = () => {
  28574. data2.value.columns.push({
  28575. span: 0,
  28576. list: []
  28577. });
  28578. };
  28579. const handleInsertOption = () => {
  28580. const index = data2.value.options.options.length + 1;
  28581. data2.value.options.options.push({
  28582. label: `Option ${index}`,
  28583. value: `Option ${index}`
  28584. });
  28585. };
  28586. const handleOptionsRemove = (index) => {
  28587. if (data2.value.type === "grid")
  28588. data2.value.columns.splice(index, 1);
  28589. else
  28590. data2.value.options.options.splice(index, 1);
  28591. };
  28592. const handleSliderModeChange = (checked) => {
  28593. checked ? data2.value.options.defaultValue = [10, 90] : data2.value.options.defaultValue = 0;
  28594. };
  28595. const handleSelectModeChange = (val) => {
  28596. if (data2.value.type === "img-upload")
  28597. return;
  28598. if (val) {
  28599. if (data2.value.options.defaultValue) {
  28600. if (!(data2.value.options.defaultValue instanceof Array))
  28601. data2.value.options.defaultValue = [data2.value.options.defaultValue];
  28602. } else {
  28603. data2.value.options.defaultValue = [];
  28604. }
  28605. } else {
  28606. data2.value.options.defaultValue.length ? data2.value.options.defaultValue = data2.value.options.defaultValue[0] : data2.value.options.defaultValue = null;
  28607. }
  28608. };
  28609. return {
  28610. data: data2,
  28611. hasKey,
  28612. handleInsertColumn,
  28613. handleInsertOption,
  28614. handleOptionsRemove,
  28615. handleSliderModeChange,
  28616. handleSelectModeChange
  28617. };
  28618. }
  28619. });
  28620. const _hoisted_1$2 = /* @__PURE__ */ createTextVNode(" \u884C\u5185 ");
  28621. const _hoisted_2$2 = /* @__PURE__ */ createTextVNode(" \u5757\u7EA7 ");
  28622. const _hoisted_3$2 = /* @__PURE__ */ createTextVNode(" \u9759\u6001\u6570\u636E ");
  28623. const _hoisted_4$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u6570\u636E ");
  28624. const _hoisted_5$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  28625. const _hoisted_6$2 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  28626. const _hoisted_7$1 = /* @__PURE__ */ createTextVNode(" \u503C ");
  28627. const _hoisted_8$1 = { class: "flex items-center" };
  28628. const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("i", {
  28629. style: { "margin": "0 5px", "cursor": "move" },
  28630. class: "drag-item custom:item"
  28631. }, null, -1);
  28632. const _hoisted_10$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28633. const _hoisted_11$1 = { class: "flex items-center justify-center gap-2 mb-2" };
  28634. const _hoisted_12$1 = /* @__PURE__ */ createTextVNode(/* @__PURE__ */ toDisplayString(""));
  28635. const _hoisted_13$1 = /* @__PURE__ */ createElementVNode("i", { class: "cursor-move text-sm custom:item" }, null, -1);
  28636. const _hoisted_14$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28637. const _hoisted_15 = { style: { "margin-top": "5px" } };
  28638. const _hoisted_16 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u9009\u9879 ");
  28639. const _hoisted_17 = /* @__PURE__ */ createTextVNode(" text ");
  28640. const _hoisted_18 = /* @__PURE__ */ createTextVNode(" picture ");
  28641. const _hoisted_19 = /* @__PURE__ */ createTextVNode(" picture-card ");
  28642. const _hoisted_20 = /* @__PURE__ */ createTextVNode(" POST ");
  28643. const _hoisted_21 = /* @__PURE__ */ createTextVNode(" PUT ");
  28644. const _hoisted_22 = /* @__PURE__ */ createTextVNode(" GET ");
  28645. const _hoisted_23 = /* @__PURE__ */ createTextVNode(" DELETE ");
  28646. const _hoisted_24 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  28647. const _hoisted_25 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  28648. const _hoisted_26 = /* @__PURE__ */ createTextVNode(" \u503C ");
  28649. const _hoisted_27 = /* @__PURE__ */ createTextVNode(" \u5B50\u9009\u9879 ");
  28650. const _hoisted_28 = { style: { "display": "flex", "gap": "5px", "margin-bottom": "5px" } };
  28651. const _hoisted_29 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  28652. const _hoisted_30 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28653. const _hoisted_31 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  28654. const _hoisted_32 = /* @__PURE__ */ createTextVNode(" \u5C45\u5DE6\u5BF9\u9F50 ");
  28655. const _hoisted_33 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  28656. const _hoisted_34 = /* @__PURE__ */ createTextVNode(" \u5DE8\u53F3\u5BF9\u9F50 ");
  28657. const _hoisted_35 = { style: { "margin-bottom": "5px" } };
  28658. const _hoisted_36 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  28659. const _hoisted_37 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28660. const _hoisted_38 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  28661. const _hoisted_39 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  28662. const _hoisted_40 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  28663. const _hoisted_41 = /* @__PURE__ */ createTextVNode(" \u5E95\u90E8\u5BF9\u9F50 ");
  28664. const _hoisted_42 = /* @__PURE__ */ createTextVNode(" \u5FC5\u586B ");
  28665. const _hoisted_43 = /* @__PURE__ */ createTextVNode(" \u53EA\u8BFB ");
  28666. const _hoisted_44 = /* @__PURE__ */ createTextVNode(" \u7981\u7528 ");
  28667. const _hoisted_45 = /* @__PURE__ */ createTextVNode(" \u6E05\u9664 ");
  28668. 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);
  28669. const _hoisted_47 = /* @__PURE__ */ createTextVNode(" Blur ");
  28670. const _hoisted_48 = /* @__PURE__ */ createTextVNode(" Change ");
  28671. const _hoisted_49 = /* @__PURE__ */ createTextVNode(" \u5B57\u7B26\u4E32 ");
  28672. const _hoisted_50 = /* @__PURE__ */ createTextVNode(" \u6570\u5B57 ");
  28673. const _hoisted_51 = /* @__PURE__ */ createTextVNode(" \u5E03\u5C14\u503C ");
  28674. const _hoisted_52 = /* @__PURE__ */ createTextVNode(" \u65B9\u6CD5 ");
  28675. const _hoisted_53 = /* @__PURE__ */ createTextVNode(" \u6B63\u5219\u8868\u8FBE\u5F0F ");
  28676. const _hoisted_54 = /* @__PURE__ */ createTextVNode(" \u6574\u6570 ");
  28677. const _hoisted_55 = /* @__PURE__ */ createTextVNode(" \u6D6E\u70B9\u6570 ");
  28678. const _hoisted_56 = /* @__PURE__ */ createTextVNode(" \u6570\u7EC4 ");
  28679. const _hoisted_57 = /* @__PURE__ */ createTextVNode(" \u5BF9\u8C61 ");
  28680. const _hoisted_58 = /* @__PURE__ */ createTextVNode(" \u679A\u4E3E ");
  28681. const _hoisted_59 = /* @__PURE__ */ createTextVNode(" \u65E5\u671F ");
  28682. const _hoisted_60 = /* @__PURE__ */ createTextVNode(" URL\u5730\u5740 ");
  28683. const _hoisted_61 = /* @__PURE__ */ createTextVNode(" \u5341\u516D\u8FDB\u5236 ");
  28684. const _hoisted_62 = /* @__PURE__ */ createTextVNode(" \u90AE\u7BB1\u5730\u5740 ");
  28685. const _hoisted_63 = /* @__PURE__ */ createTextVNode(" \u4EFB\u610F\u7C7B\u578B ");
  28686. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  28687. const _component_el_input = ElInput;
  28688. const _component_el_form_item = ElFormItem;
  28689. const _component_el_rate = ElRate;
  28690. const _component_el_switch = ElSwitch;
  28691. const _component_el_input_number = ElInputNumber;
  28692. const _component_el_radio_button = ElRadioButton;
  28693. const _component_el_radio_group = ElRadioGroup;
  28694. const _component_el_space = ElSpace;
  28695. const _component_el_radio = ElRadio;
  28696. const _component_el_button = ElButton;
  28697. const _component_Draggable = resolveComponent("Draggable");
  28698. const _component_el_checkbox = ElCheckbox;
  28699. const _component_el_checkbox_group = ElCheckboxGroup$1;
  28700. const _component_el_time_picker = ElTimePicker;
  28701. const _component_el_date_picker = ElDatePicker;
  28702. const _component_el_option = ElOption;
  28703. const _component_el_select = ElSelect;
  28704. const _component_el_form = ElForm;
  28705. return _ctx.data ? (openBlock(), createBlock(_component_el_form, {
  28706. key: _ctx.data.key,
  28707. "label-position": "top",
  28708. "p-2": "",
  28709. "flex-1": "",
  28710. "overflow-auto": ""
  28711. }, {
  28712. default: withCtx(() => [
  28713. !["grid"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  28714. key: 0,
  28715. label: "\u5B57\u6BB5\u6807\u8BC6"
  28716. }, {
  28717. default: withCtx(() => [
  28718. createVNode(_component_el_input, {
  28719. modelValue: _ctx.data.model,
  28720. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data.model = $event),
  28721. disabled: true
  28722. }, null, 8, ["modelValue"])
  28723. ]),
  28724. _: 1
  28725. })) : createCommentVNode("", true),
  28726. !["grid", "table"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  28727. key: 1,
  28728. label: "\u6807\u9898"
  28729. }, {
  28730. default: withCtx(() => [
  28731. createVNode(_component_el_input, {
  28732. modelValue: _ctx.data.label,
  28733. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data.label = $event),
  28734. disabled: _ctx.data.allDisable
  28735. }, null, 8, ["modelValue", "disabled"])
  28736. ]),
  28737. _: 1
  28738. })) : createCommentVNode("", true),
  28739. _ctx.hasKey("width") ? (openBlock(), createBlock(_component_el_form_item, {
  28740. key: 2,
  28741. label: "\u5BBD\u5EA6"
  28742. }, {
  28743. default: withCtx(() => [
  28744. createVNode(_component_el_input, {
  28745. modelValue: _ctx.data.options.width,
  28746. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.data.options.width = $event)
  28747. }, null, 8, ["modelValue"])
  28748. ]),
  28749. _: 1
  28750. })) : createCommentVNode("", true),
  28751. _ctx.hasKey("placeholder") ? (openBlock(), createBlock(_component_el_form_item, {
  28752. key: 3,
  28753. label: "\u5360\u4F4D\u5185\u5BB9"
  28754. }, {
  28755. default: withCtx(() => [
  28756. createVNode(_component_el_input, {
  28757. modelValue: _ctx.data.options.placeholder,
  28758. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.data.options.placeholder = $event),
  28759. disabled: _ctx.data.allDisable
  28760. }, null, 8, ["modelValue", "disabled"])
  28761. ]),
  28762. _: 1
  28763. })) : createCommentVNode("", true),
  28764. _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, {
  28765. key: 4,
  28766. label: "\u9ED8\u8BA4\u5185\u5BB9"
  28767. }, {
  28768. default: withCtx(() => [
  28769. _ctx.data.type === "input" || _ctx.data.type === "password" || _ctx.data.type === "text" ? (openBlock(), createBlock(_component_el_input, {
  28770. key: 0,
  28771. modelValue: _ctx.data.options.defaultValue,
  28772. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.data.options.defaultValue = $event)
  28773. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  28774. _ctx.data.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  28775. key: 1,
  28776. modelValue: _ctx.data.options.defaultValue,
  28777. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => _ctx.data.options.defaultValue = $event),
  28778. type: "textarea"
  28779. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  28780. _ctx.data.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  28781. key: 2,
  28782. modelValue: _ctx.data.options.defaultValue,
  28783. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.data.options.defaultValue = $event),
  28784. max: _ctx.data.options.max,
  28785. "allow-half": _ctx.data.options.allowHalf
  28786. }, null, 8, ["modelValue", "max", "allow-half"])) : createCommentVNode("", true),
  28787. _ctx.data.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  28788. key: 3,
  28789. modelValue: _ctx.data.options.defaultValue,
  28790. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.data.options.defaultValue = $event)
  28791. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  28792. _ctx.data.type === "slider" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  28793. !_ctx.data.options.range ? (openBlock(), createBlock(_component_el_input_number, {
  28794. key: 0,
  28795. modelValue: _ctx.data.options.defaultValue,
  28796. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => _ctx.data.options.defaultValue = $event),
  28797. modelModifiers: { number: true }
  28798. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  28799. _ctx.data.options.range ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  28800. createVNode(_component_el_input_number, {
  28801. modelValue: _ctx.data.options.defaultValue[0],
  28802. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => _ctx.data.options.defaultValue[0] = $event),
  28803. modelModifiers: { number: true },
  28804. max: _ctx.data.options.max
  28805. }, null, 8, ["modelValue", "max"]),
  28806. createVNode(_component_el_input_number, {
  28807. modelValue: _ctx.data.options.defaultValue[1],
  28808. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => _ctx.data.options.defaultValue[1] = $event),
  28809. modelModifiers: { number: true },
  28810. max: _ctx.data.options.max
  28811. }, null, 8, ["modelValue", "max"])
  28812. ], 64)) : createCommentVNode("", true)
  28813. ], 64)) : createCommentVNode("", true)
  28814. ]),
  28815. _: 1
  28816. })) : createCommentVNode("", true),
  28817. _ctx.hasKey("maxlength") ? (openBlock(), createBlock(_component_el_form_item, {
  28818. key: 5,
  28819. label: "\u6700\u5927\u957F\u5EA6"
  28820. }, {
  28821. default: withCtx(() => [
  28822. createVNode(_component_el_input, {
  28823. modelValue: _ctx.data.options.maxlength,
  28824. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => _ctx.data.options.maxlength = $event),
  28825. modelModifiers: { number: true },
  28826. disabled: _ctx.data.allDisable
  28827. }, null, 8, ["modelValue", "disabled"])
  28828. ]),
  28829. _: 1
  28830. })) : createCommentVNode("", true),
  28831. _ctx.hasKey("max") ? (openBlock(), createBlock(_component_el_form_item, {
  28832. key: 6,
  28833. label: "\u6700\u5927\u503C"
  28834. }, {
  28835. default: withCtx(() => [
  28836. createVNode(_component_el_input_number, {
  28837. modelValue: _ctx.data.options.max,
  28838. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => _ctx.data.options.max = $event),
  28839. modelModifiers: { number: true },
  28840. disabled: _ctx.data.allDisable
  28841. }, null, 8, ["modelValue", "disabled"])
  28842. ]),
  28843. _: 1
  28844. })) : createCommentVNode("", true),
  28845. _ctx.hasKey("min") ? (openBlock(), createBlock(_component_el_form_item, {
  28846. key: 7,
  28847. label: "\u6700\u5C0F\u503C"
  28848. }, {
  28849. default: withCtx(() => [
  28850. createVNode(_component_el_input_number, {
  28851. modelValue: _ctx.data.options.min,
  28852. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => _ctx.data.options.min = $event),
  28853. modelModifiers: { number: true },
  28854. disabled: _ctx.data.allDisable
  28855. }, null, 8, ["modelValue", "disabled"])
  28856. ]),
  28857. _: 1
  28858. })) : createCommentVNode("", true),
  28859. _ctx.hasKey("step") ? (openBlock(), createBlock(_component_el_form_item, {
  28860. key: 8,
  28861. label: "\u6B65\u957F"
  28862. }, {
  28863. default: withCtx(() => [
  28864. createVNode(_component_el_input_number, {
  28865. modelValue: _ctx.data.options.step,
  28866. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => _ctx.data.options.step = $event),
  28867. modelModifiers: { number: true },
  28868. min: 0,
  28869. disabled: _ctx.data.allDisable
  28870. }, null, 8, ["modelValue", "disabled"])
  28871. ]),
  28872. _: 1
  28873. })) : createCommentVNode("", true),
  28874. _ctx.hasKey("prefix") ? (openBlock(), createBlock(_component_el_form_item, {
  28875. key: 9,
  28876. label: "\u524D\u7F00"
  28877. }, {
  28878. default: withCtx(() => [
  28879. createVNode(_component_el_input, {
  28880. modelValue: _ctx.data.options.prefix,
  28881. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.data.options.prefix = $event),
  28882. disabled: _ctx.data.allDisable
  28883. }, null, 8, ["modelValue", "disabled"])
  28884. ]),
  28885. _: 1
  28886. })) : createCommentVNode("", true),
  28887. _ctx.hasKey("suffix") ? (openBlock(), createBlock(_component_el_form_item, {
  28888. key: 10,
  28889. label: "\u540E\u7F00"
  28890. }, {
  28891. default: withCtx(() => [
  28892. createVNode(_component_el_input, {
  28893. modelValue: _ctx.data.options.suffix,
  28894. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.data.options.suffix = $event),
  28895. disabled: _ctx.data.allDisable
  28896. }, null, 8, ["modelValue", "disabled"])
  28897. ]),
  28898. _: 1
  28899. })) : createCommentVNode("", true),
  28900. _ctx.hasKey("prepend") ? (openBlock(), createBlock(_component_el_form_item, {
  28901. key: 11,
  28902. label: "\u524D\u7F6E\u6807\u7B7E"
  28903. }, {
  28904. default: withCtx(() => [
  28905. createVNode(_component_el_input, {
  28906. modelValue: _ctx.data.options.prepend,
  28907. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => _ctx.data.options.prepend = $event),
  28908. disabled: _ctx.data.allDisable
  28909. }, null, 8, ["modelValue", "disabled"])
  28910. ]),
  28911. _: 1
  28912. })) : createCommentVNode("", true),
  28913. _ctx.hasKey("append") ? (openBlock(), createBlock(_component_el_form_item, {
  28914. key: 12,
  28915. label: "\u540E\u7F6E\u6807\u7B7E"
  28916. }, {
  28917. default: withCtx(() => [
  28918. createVNode(_component_el_input, {
  28919. modelValue: _ctx.data.options.append,
  28920. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => _ctx.data.options.append = $event),
  28921. disabled: _ctx.data.allDisable
  28922. }, null, 8, ["modelValue", "disabled"])
  28923. ]),
  28924. _: 1
  28925. })) : createCommentVNode("", true),
  28926. _ctx.hasKey("activeText") ? (openBlock(), createBlock(_component_el_form_item, {
  28927. key: 13,
  28928. label: "\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  28929. }, {
  28930. default: withCtx(() => [
  28931. createVNode(_component_el_input, {
  28932. modelValue: _ctx.data.options.activeText,
  28933. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => _ctx.data.options.activeText = $event)
  28934. }, null, 8, ["modelValue"])
  28935. ]),
  28936. _: 1
  28937. })) : createCommentVNode("", true),
  28938. _ctx.hasKey("inactiveText") ? (openBlock(), createBlock(_component_el_form_item, {
  28939. key: 14,
  28940. label: "\u975E\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  28941. }, {
  28942. default: withCtx(() => [
  28943. createVNode(_component_el_input, {
  28944. modelValue: _ctx.data.options.inactiveText,
  28945. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => _ctx.data.options.inactiveText = $event)
  28946. }, null, 8, ["modelValue"])
  28947. ]),
  28948. _: 1
  28949. })) : createCommentVNode("", true),
  28950. _ctx.hasKey("editable") ? (openBlock(), createBlock(_component_el_form_item, {
  28951. key: 15,
  28952. label: "\u6587\u672C\u6846\u53EF\u8F93\u5165"
  28953. }, {
  28954. default: withCtx(() => [
  28955. createVNode(_component_el_switch, {
  28956. modelValue: _ctx.data.options.editable,
  28957. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => _ctx.data.options.editable = $event)
  28958. }, null, 8, ["modelValue"])
  28959. ]),
  28960. _: 1
  28961. })) : createCommentVNode("", true),
  28962. _ctx.hasKey("range") ? (openBlock(), createBlock(_component_el_form_item, {
  28963. key: 16,
  28964. label: "\u8303\u56F4\u9009\u62E9"
  28965. }, {
  28966. default: withCtx(() => [
  28967. createVNode(_component_el_switch, {
  28968. modelValue: _ctx.data.options.range,
  28969. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => _ctx.data.options.range = $event),
  28970. onChange: _ctx.handleSliderModeChange
  28971. }, null, 8, ["modelValue", "onChange"])
  28972. ]),
  28973. _: 1
  28974. })) : createCommentVNode("", true),
  28975. _ctx.hasKey("showPassword") ? (openBlock(), createBlock(_component_el_form_item, {
  28976. key: 17,
  28977. label: "\u662F\u5426\u663E\u793A\u5207\u6362\u6309\u94AE"
  28978. }, {
  28979. default: withCtx(() => [
  28980. createVNode(_component_el_switch, {
  28981. modelValue: _ctx.data.options.showPassword,
  28982. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => _ctx.data.options.showPassword = $event)
  28983. }, null, 8, ["modelValue"])
  28984. ]),
  28985. _: 1
  28986. })) : createCommentVNode("", true),
  28987. _ctx.hasKey("showWordLimit") ? (openBlock(), createBlock(_component_el_form_item, {
  28988. key: 18,
  28989. label: "\u662F\u5426\u663E\u793A\u5B57\u6570"
  28990. }, {
  28991. default: withCtx(() => [
  28992. createVNode(_component_el_switch, {
  28993. modelValue: _ctx.data.options.showWordLimit,
  28994. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => _ctx.data.options.showWordLimit = $event)
  28995. }, null, 8, ["modelValue"])
  28996. ]),
  28997. _: 1
  28998. })) : createCommentVNode("", true),
  28999. _ctx.hasKey("autosize") ? (openBlock(), createBlock(_component_el_form_item, {
  29000. key: 19,
  29001. label: "\u662F\u5426\u81EA\u9002\u5E94\u5185\u5BB9\u9AD8\u5EA6"
  29002. }, {
  29003. default: withCtx(() => [
  29004. createVNode(_component_el_switch, {
  29005. modelValue: _ctx.data.options.autosize,
  29006. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => _ctx.data.options.autosize = $event)
  29007. }, null, 8, ["modelValue"])
  29008. ]),
  29009. _: 1
  29010. })) : createCommentVNode("", true),
  29011. _ctx.hasKey("rows") && !_ctx.data.options.autosize ? (openBlock(), createBlock(_component_el_form_item, {
  29012. key: 20,
  29013. label: "\u884C\u6570"
  29014. }, {
  29015. default: withCtx(() => [
  29016. createVNode(_component_el_input_number, {
  29017. modelValue: _ctx.data.options.rows,
  29018. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => _ctx.data.options.rows = $event),
  29019. min: 0
  29020. }, null, 8, ["modelValue"])
  29021. ]),
  29022. _: 1
  29023. })) : createCommentVNode("", true),
  29024. _ctx.hasKey("allowHalf") ? (openBlock(), createBlock(_component_el_form_item, {
  29025. key: 21,
  29026. label: "\u662F\u5426\u5141\u8BB8\u534A\u9009"
  29027. }, {
  29028. default: withCtx(() => [
  29029. createVNode(_component_el_switch, {
  29030. modelValue: _ctx.data.options.allowHalf,
  29031. "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => _ctx.data.options.allowHalf = $event)
  29032. }, null, 8, ["modelValue"])
  29033. ]),
  29034. _: 1
  29035. })) : createCommentVNode("", true),
  29036. _ctx.hasKey("inline") ? (openBlock(), createBlock(_component_el_form_item, {
  29037. key: 22,
  29038. label: "\u5E03\u5C40\u65B9\u5F0F"
  29039. }, {
  29040. default: withCtx(() => [
  29041. createVNode(_component_el_radio_group, {
  29042. modelValue: _ctx.data.options.inline,
  29043. "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => _ctx.data.options.inline = $event)
  29044. }, {
  29045. default: withCtx(() => [
  29046. createVNode(_component_el_radio_button, { label: true }, {
  29047. default: withCtx(() => [
  29048. _hoisted_1$2
  29049. ]),
  29050. _: 1
  29051. }),
  29052. createVNode(_component_el_radio_button, { label: false }, {
  29053. default: withCtx(() => [
  29054. _hoisted_2$2
  29055. ]),
  29056. _: 1
  29057. })
  29058. ]),
  29059. _: 1
  29060. }, 8, ["modelValue"])
  29061. ]),
  29062. _: 1
  29063. })) : createCommentVNode("", true),
  29064. _ctx.hasKey("multiple") ? (openBlock(), createBlock(_component_el_form_item, {
  29065. key: 23,
  29066. label: "\u662F\u5426\u591A\u9009"
  29067. }, {
  29068. default: withCtx(() => [
  29069. createVNode(_component_el_switch, {
  29070. modelValue: _ctx.data.options.multiple,
  29071. "onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => _ctx.data.options.multiple = $event),
  29072. onChange: _ctx.handleSelectModeChange,
  29073. disabled: _ctx.data.allDisable
  29074. }, null, 8, ["modelValue", "onChange", "disabled"])
  29075. ]),
  29076. _: 1
  29077. })) : createCommentVNode("", true),
  29078. _ctx.hasKey("filterable") ? (openBlock(), createBlock(_component_el_form_item, {
  29079. key: 24,
  29080. label: "\u662F\u5426\u53EF\u641C\u7D22"
  29081. }, {
  29082. default: withCtx(() => [
  29083. createVNode(_component_el_switch, {
  29084. modelValue: _ctx.data.options.filterable,
  29085. "onUpdate:modelValue": _cache[30] || (_cache[30] = ($event) => _ctx.data.options.filterable = $event),
  29086. disabled: _ctx.data.allDisable
  29087. }, null, 8, ["modelValue", "disabled"])
  29088. ]),
  29089. _: 1
  29090. })) : createCommentVNode("", true),
  29091. _ctx.hasKey("showLabel") ? (openBlock(), createBlock(_component_el_form_item, {
  29092. key: 25,
  29093. label: "\u662F\u5426\u663E\u793A\u6807\u7B7E"
  29094. }, {
  29095. default: withCtx(() => [
  29096. createVNode(_component_el_switch, {
  29097. modelValue: _ctx.data.options.showLabel,
  29098. "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => _ctx.data.options.showLabel = $event)
  29099. }, null, 8, ["modelValue"])
  29100. ]),
  29101. _: 1
  29102. })) : createCommentVNode("", true),
  29103. _ctx.hasKey("options") ? (openBlock(), createBlock(_component_el_form_item, {
  29104. key: 26,
  29105. label: "\u9009\u9879"
  29106. }, {
  29107. default: withCtx(() => [
  29108. createVNode(_component_el_radio_group, {
  29109. modelValue: _ctx.data.options.remote,
  29110. "onUpdate:modelValue": _cache[32] || (_cache[32] = ($event) => _ctx.data.options.remote = $event)
  29111. }, {
  29112. default: withCtx(() => [
  29113. createVNode(_component_el_radio_button, { label: false }, {
  29114. default: withCtx(() => [
  29115. _hoisted_3$2
  29116. ]),
  29117. _: 1
  29118. }),
  29119. createVNode(_component_el_radio_button, { label: true }, {
  29120. default: withCtx(() => [
  29121. _hoisted_4$2
  29122. ]),
  29123. _: 1
  29124. })
  29125. ]),
  29126. _: 1
  29127. }, 8, ["modelValue"]),
  29128. _ctx.data.options.remote ? (openBlock(), createBlock(_component_el_space, {
  29129. key: 0,
  29130. alignment: "start",
  29131. direction: "vertical",
  29132. style: { "margin-top": "10px" }
  29133. }, {
  29134. default: withCtx(() => [
  29135. createVNode(_component_el_input, {
  29136. modelValue: _ctx.data.options.remoteFunc,
  29137. "onUpdate:modelValue": _cache[33] || (_cache[33] = ($event) => _ctx.data.options.remoteFunc = $event)
  29138. }, {
  29139. prepend: withCtx(() => [
  29140. _hoisted_5$2
  29141. ]),
  29142. _: 1
  29143. }, 8, ["modelValue"]),
  29144. createVNode(_component_el_input, {
  29145. modelValue: _ctx.data.options.props.label,
  29146. "onUpdate:modelValue": _cache[34] || (_cache[34] = ($event) => _ctx.data.options.props.label = $event)
  29147. }, {
  29148. prepend: withCtx(() => [
  29149. _hoisted_6$2
  29150. ]),
  29151. _: 1
  29152. }, 8, ["modelValue"]),
  29153. createVNode(_component_el_input, {
  29154. modelValue: _ctx.data.options.props.value,
  29155. "onUpdate:modelValue": _cache[35] || (_cache[35] = ($event) => _ctx.data.options.props.value = $event)
  29156. }, {
  29157. prepend: withCtx(() => [
  29158. _hoisted_7$1
  29159. ]),
  29160. _: 1
  29161. }, 8, ["modelValue"])
  29162. ]),
  29163. _: 1
  29164. })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29165. _ctx.data.type === "radio" || _ctx.data.type === "select" && !_ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_radio_group, {
  29166. key: 0,
  29167. modelValue: _ctx.data.options.defaultValue,
  29168. "onUpdate:modelValue": _cache[36] || (_cache[36] = ($event) => _ctx.data.options.defaultValue = $event),
  29169. style: { "margin-top": "8px" }
  29170. }, {
  29171. default: withCtx(() => [
  29172. createVNode(_component_Draggable, {
  29173. "item-key": "index",
  29174. "ghost-class": "ghost",
  29175. handle: ".drag-item",
  29176. group: { name: "options" },
  29177. list: _ctx.data.options.options
  29178. }, {
  29179. item: withCtx(({ element, index }) => [
  29180. createElementVNode("div", _hoisted_8$1, [
  29181. createVNode(_component_el_radio, {
  29182. label: element.value,
  29183. style: { "margin-right": "0", "margin-bottom": "0" }
  29184. }, {
  29185. default: withCtx(() => [
  29186. createVNode(_component_el_input, {
  29187. modelValue: element.value,
  29188. "onUpdate:modelValue": ($event) => element.value = $event,
  29189. style: normalizeStyle({
  29190. width: _ctx.data.options.showLabel ? "90px" : "180px"
  29191. })
  29192. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  29193. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  29194. key: 0,
  29195. modelValue: element.label,
  29196. "onUpdate:modelValue": ($event) => element.label = $event,
  29197. class: "ml-1",
  29198. style: {
  29199. width: "90px"
  29200. }
  29201. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true)
  29202. ]),
  29203. _: 2
  29204. }, 1032, ["label"]),
  29205. _hoisted_9$1,
  29206. createVNode(_component_el_button, {
  29207. type: "primary",
  29208. circle: "",
  29209. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29210. }, {
  29211. default: withCtx(() => [
  29212. _hoisted_10$1
  29213. ]),
  29214. _: 2
  29215. }, 1032, ["onClick"])
  29216. ])
  29217. ]),
  29218. _: 1
  29219. }, 8, ["list"])
  29220. ]),
  29221. _: 1
  29222. }, 8, ["modelValue"])) : createCommentVNode("", true),
  29223. _ctx.data.type === "checkbox" || _ctx.data.type === "select" && _ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_checkbox_group, {
  29224. key: 1,
  29225. modelValue: _ctx.data.options.defaultValue,
  29226. "onUpdate:modelValue": _cache[37] || (_cache[37] = ($event) => _ctx.data.options.defaultValue = $event),
  29227. style: { "margin-top": "8px" }
  29228. }, {
  29229. default: withCtx(() => [
  29230. createVNode(_component_Draggable, {
  29231. "item-key": "index",
  29232. "ghost-class": "ghost",
  29233. handle: "[cursor-move]",
  29234. group: { name: "options" },
  29235. list: _ctx.data.options.options
  29236. }, {
  29237. item: withCtx(({ element, index }) => [
  29238. createElementVNode("div", _hoisted_11$1, [
  29239. createVNode(_component_el_checkbox, {
  29240. label: element.value
  29241. }, {
  29242. default: withCtx(() => [
  29243. _hoisted_12$1
  29244. ]),
  29245. _: 2
  29246. }, 1032, ["label"]),
  29247. createVNode(_component_el_input, {
  29248. modelValue: element.value,
  29249. "onUpdate:modelValue": ($event) => element.value = $event,
  29250. style: normalizeStyle({
  29251. width: _ctx.data.options.showLabel ? "90px" : "180px"
  29252. })
  29253. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  29254. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  29255. key: 0,
  29256. modelValue: element.label,
  29257. "onUpdate:modelValue": ($event) => element.label = $event,
  29258. style: { width: "90px" }
  29259. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true),
  29260. _hoisted_13$1,
  29261. createVNode(_component_el_button, {
  29262. type: "primary",
  29263. circle: "",
  29264. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29265. }, {
  29266. default: withCtx(() => [
  29267. _hoisted_14$1
  29268. ]),
  29269. _: 2
  29270. }, 1032, ["onClick"])
  29271. ])
  29272. ]),
  29273. _: 1
  29274. }, 8, ["list"])
  29275. ]),
  29276. _: 1
  29277. }, 8, ["modelValue"])) : createCommentVNode("", true),
  29278. createElementVNode("div", _hoisted_15, [
  29279. createVNode(_component_el_button, {
  29280. type: "text",
  29281. onClick: _ctx.handleInsertOption
  29282. }, {
  29283. default: withCtx(() => [
  29284. _hoisted_16
  29285. ]),
  29286. _: 1
  29287. }, 8, ["onClick"])
  29288. ])
  29289. ], 64))
  29290. ]),
  29291. _: 1
  29292. })) : createCommentVNode("", true),
  29293. _ctx.data.type === "time" ? (openBlock(), createBlock(_component_el_form_item, {
  29294. key: 27,
  29295. label: "\u9ED8\u8BA4\u503C"
  29296. }, {
  29297. default: withCtx(() => [
  29298. createVNode(_component_el_time_picker, {
  29299. modelValue: _ctx.data.options.defaultValue,
  29300. "onUpdate:modelValue": _cache[38] || (_cache[38] = ($event) => _ctx.data.options.defaultValue = $event),
  29301. style: { "width": "100%" },
  29302. format: _ctx.data.options.format,
  29303. placeholder: _ctx.data.options.placeholder
  29304. }, null, 8, ["modelValue", "format", "placeholder"])
  29305. ]),
  29306. _: 1
  29307. })) : createCommentVNode("", true),
  29308. _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  29309. key: 28,
  29310. label: "\u9ED8\u8BA4\u503C"
  29311. }, {
  29312. default: withCtx(() => [
  29313. createVNode(_component_el_date_picker, {
  29314. modelValue: _ctx.data.options.defaultValue,
  29315. "onUpdate:modelValue": _cache[39] || (_cache[39] = ($event) => _ctx.data.options.defaultValue = $event),
  29316. style: { "width": "100%" },
  29317. format: _ctx.data.options.format,
  29318. placeholder: _ctx.data.options.placeholder
  29319. }, null, 8, ["modelValue", "format", "placeholder"])
  29320. ]),
  29321. _: 1
  29322. })) : createCommentVNode("", true),
  29323. _ctx.data.type === "time" || _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  29324. key: 29,
  29325. label: "\u683C\u5F0F"
  29326. }, {
  29327. default: withCtx(() => [
  29328. createVNode(_component_el_input, {
  29329. modelValue: _ctx.data.options.format,
  29330. "onUpdate:modelValue": _cache[40] || (_cache[40] = ($event) => _ctx.data.options.format = $event)
  29331. }, null, 8, ["modelValue"])
  29332. ]),
  29333. _: 1
  29334. })) : createCommentVNode("", true),
  29335. _ctx.data.type === "download" ? (openBlock(), createBlock(_component_el_form_item, {
  29336. key: 30,
  29337. label: "\u5730\u5740"
  29338. }, {
  29339. default: withCtx(() => [
  29340. createVNode(_component_el_input, {
  29341. modelValue: _ctx.data.options.defaultValue,
  29342. "onUpdate:modelValue": _cache[41] || (_cache[41] = ($event) => _ctx.data.options.defaultValue = $event)
  29343. }, null, 8, ["modelValue"])
  29344. ]),
  29345. _: 1
  29346. })) : createCommentVNode("", true),
  29347. _ctx.data.type === "img-upload" ? (openBlock(), createElementBlock(Fragment, { key: 31 }, [
  29348. createVNode(_component_el_form_item, { label: "\u6A21\u5F0F" }, {
  29349. default: withCtx(() => [
  29350. createVNode(_component_el_radio_group, {
  29351. modelValue: _ctx.data.options.listType,
  29352. "onUpdate:modelValue": _cache[42] || (_cache[42] = ($event) => _ctx.data.options.listType = $event)
  29353. }, {
  29354. default: withCtx(() => [
  29355. createVNode(_component_el_radio_button, { label: "text" }, {
  29356. default: withCtx(() => [
  29357. _hoisted_17
  29358. ]),
  29359. _: 1
  29360. }),
  29361. createVNode(_component_el_radio_button, { label: "picture" }, {
  29362. default: withCtx(() => [
  29363. _hoisted_18
  29364. ]),
  29365. _: 1
  29366. }),
  29367. createVNode(_component_el_radio_button, { label: "picture-card" }, {
  29368. default: withCtx(() => [
  29369. _hoisted_19
  29370. ]),
  29371. _: 1
  29372. })
  29373. ]),
  29374. _: 1
  29375. }, 8, ["modelValue"])
  29376. ]),
  29377. _: 1
  29378. }),
  29379. createVNode(_component_el_form_item, { label: "\u6587\u4EF6\u53C2\u6570\u540D" }, {
  29380. default: withCtx(() => [
  29381. createVNode(_component_el_input, {
  29382. modelValue: _ctx.data.options.name,
  29383. "onUpdate:modelValue": _cache[43] || (_cache[43] = ($event) => _ctx.data.options.name = $event)
  29384. }, null, 8, ["modelValue"])
  29385. ]),
  29386. _: 1
  29387. }),
  29388. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u5730\u5740" }, {
  29389. default: withCtx(() => [
  29390. createVNode(_component_el_input, {
  29391. modelValue: _ctx.data.options.action,
  29392. "onUpdate:modelValue": _cache[44] || (_cache[44] = ($event) => _ctx.data.options.action = $event)
  29393. }, null, 8, ["modelValue"])
  29394. ]),
  29395. _: 1
  29396. }),
  29397. createVNode(_component_el_form_item, { label: "\u63A5\u53D7\u4E0A\u4F20\u7684\u6587\u4EF6\u7C7B\u578B(\u591A\u4E2A\u4F7F\u7528 , \u9694\u5F00)" }, {
  29398. default: withCtx(() => [
  29399. createVNode(_component_el_input, {
  29400. modelValue: _ctx.data.options.accept,
  29401. "onUpdate:modelValue": _cache[45] || (_cache[45] = ($event) => _ctx.data.options.accept = $event)
  29402. }, null, 8, ["modelValue"])
  29403. ]),
  29404. _: 1
  29405. }),
  29406. createVNode(_component_el_form_item, { label: "\u6700\u5927\u4E0A\u4F20\u6570\u91CF" }, {
  29407. default: withCtx(() => [
  29408. createVNode(_component_el_input_number, {
  29409. modelValue: _ctx.data.options.limit,
  29410. "onUpdate:modelValue": _cache[46] || (_cache[46] = ($event) => _ctx.data.options.limit = $event),
  29411. modelModifiers: { number: true },
  29412. min: 1
  29413. }, null, 8, ["modelValue"])
  29414. ]),
  29415. _: 1
  29416. }),
  29417. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u8BF7\u6C42\u65B9\u6CD5" }, {
  29418. default: withCtx(() => [
  29419. createVNode(_component_el_radio_group, {
  29420. modelValue: _ctx.data.options.method,
  29421. "onUpdate:modelValue": _cache[47] || (_cache[47] = ($event) => _ctx.data.options.method = $event)
  29422. }, {
  29423. default: withCtx(() => [
  29424. createVNode(_component_el_radio_button, { label: "post" }, {
  29425. default: withCtx(() => [
  29426. _hoisted_20
  29427. ]),
  29428. _: 1
  29429. }),
  29430. createVNode(_component_el_radio_button, { label: "put" }, {
  29431. default: withCtx(() => [
  29432. _hoisted_21
  29433. ]),
  29434. _: 1
  29435. }),
  29436. createVNode(_component_el_radio_button, { label: "get" }, {
  29437. default: withCtx(() => [
  29438. _hoisted_22
  29439. ]),
  29440. _: 1
  29441. }),
  29442. createVNode(_component_el_radio_button, { label: "delete" }, {
  29443. default: withCtx(() => [
  29444. _hoisted_23
  29445. ]),
  29446. _: 1
  29447. })
  29448. ]),
  29449. _: 1
  29450. }, 8, ["modelValue"])
  29451. ]),
  29452. _: 1
  29453. })
  29454. ], 64)) : createCommentVNode("", true),
  29455. _ctx.data.type === "cascader" ? (openBlock(), createBlock(_component_el_form_item, {
  29456. key: 32,
  29457. label: "\u8FDC\u7AEF\u6570\u636E"
  29458. }, {
  29459. default: withCtx(() => [
  29460. createVNode(_component_el_space, {
  29461. direction: "vertical",
  29462. alignment: "start"
  29463. }, {
  29464. default: withCtx(() => [
  29465. createVNode(_component_el_input, {
  29466. modelValue: _ctx.data.options.remoteFunc,
  29467. "onUpdate:modelValue": _cache[48] || (_cache[48] = ($event) => _ctx.data.options.remoteFunc = $event)
  29468. }, {
  29469. prepend: withCtx(() => [
  29470. _hoisted_24
  29471. ]),
  29472. _: 1
  29473. }, 8, ["modelValue"]),
  29474. createVNode(_component_el_input, {
  29475. modelValue: _ctx.data.options.props.label,
  29476. "onUpdate:modelValue": _cache[49] || (_cache[49] = ($event) => _ctx.data.options.props.label = $event)
  29477. }, {
  29478. prepend: withCtx(() => [
  29479. _hoisted_25
  29480. ]),
  29481. _: 1
  29482. }, 8, ["modelValue"]),
  29483. createVNode(_component_el_input, {
  29484. modelValue: _ctx.data.options.props.value,
  29485. "onUpdate:modelValue": _cache[50] || (_cache[50] = ($event) => _ctx.data.options.props.value = $event)
  29486. }, {
  29487. prepend: withCtx(() => [
  29488. _hoisted_26
  29489. ]),
  29490. _: 1
  29491. }, 8, ["modelValue"]),
  29492. createVNode(_component_el_input, {
  29493. modelValue: _ctx.data.options.props.children,
  29494. "onUpdate:modelValue": _cache[51] || (_cache[51] = ($event) => _ctx.data.options.props.children = $event)
  29495. }, {
  29496. prepend: withCtx(() => [
  29497. _hoisted_27
  29498. ]),
  29499. _: 1
  29500. }, 8, ["modelValue"])
  29501. ]),
  29502. _: 1
  29503. })
  29504. ]),
  29505. _: 1
  29506. })) : createCommentVNode("", true),
  29507. _ctx.data.type === "table" ? (openBlock(), createElementBlock(Fragment, { key: 33 }, [
  29508. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  29509. default: withCtx(() => [
  29510. createVNode(_component_Draggable, {
  29511. tag: "ul",
  29512. "item-key": "index",
  29513. "ghost-class": "ghost",
  29514. handle: ".drag-item",
  29515. group: { name: "options" },
  29516. list: _ctx.data.columns
  29517. }, {
  29518. item: withCtx(({ element, index }) => [
  29519. createElementVNode("li", _hoisted_28, [
  29520. _hoisted_29,
  29521. createVNode(_component_el_input, {
  29522. modelValue: element.label,
  29523. "onUpdate:modelValue": ($event) => element.label = $event,
  29524. placeholder: "\u663E\u793A\u540D\u79F0"
  29525. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  29526. createVNode(_component_el_input, {
  29527. modelValue: element.prop,
  29528. "onUpdate:modelValue": ($event) => element.prop = $event,
  29529. placeholder: "\u5B57\u6BB5\u5B57\u6BB5"
  29530. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  29531. createVNode(_component_el_button, {
  29532. type: "primary",
  29533. circle: "",
  29534. style: { "margin-left": "5px" },
  29535. onClick: ($event) => _ctx.data.columns.splice(index, 1)
  29536. }, {
  29537. default: withCtx(() => [
  29538. _hoisted_30
  29539. ]),
  29540. _: 2
  29541. }, 1032, ["onClick"])
  29542. ])
  29543. ]),
  29544. _: 1
  29545. }, 8, ["list"]),
  29546. createElementVNode("div", null, [
  29547. createVNode(_component_el_button, {
  29548. type: "text",
  29549. onClick: _cache[52] || (_cache[52] = ($event) => _ctx.data.columns.push({}))
  29550. }, {
  29551. default: withCtx(() => [
  29552. _hoisted_31
  29553. ]),
  29554. _: 1
  29555. })
  29556. ])
  29557. ]),
  29558. _: 1
  29559. }),
  29560. createVNode(_component_el_form_item, { label: "\u5BF9\u9F50\u65B9\u5F0F" }, {
  29561. default: withCtx(() => [
  29562. createVNode(_component_el_radio_group, {
  29563. modelValue: _ctx.data.options.align,
  29564. "onUpdate:modelValue": _cache[53] || (_cache[53] = ($event) => _ctx.data.options.align = $event)
  29565. }, {
  29566. default: withCtx(() => [
  29567. createVNode(_component_el_radio_button, { label: "left" }, {
  29568. default: withCtx(() => [
  29569. _hoisted_32
  29570. ]),
  29571. _: 1
  29572. }),
  29573. createVNode(_component_el_radio_button, { label: "center" }, {
  29574. default: withCtx(() => [
  29575. _hoisted_33
  29576. ]),
  29577. _: 1
  29578. }),
  29579. createVNode(_component_el_radio_button, { label: "right" }, {
  29580. default: withCtx(() => [
  29581. _hoisted_34
  29582. ]),
  29583. _: 1
  29584. })
  29585. ]),
  29586. _: 1
  29587. }, 8, ["modelValue"])
  29588. ]),
  29589. _: 1
  29590. })
  29591. ], 64)) : createCommentVNode("", true),
  29592. _ctx.data.type === "grid" ? (openBlock(), createElementBlock(Fragment, { key: 34 }, [
  29593. createVNode(_component_el_form_item, { label: "\u6805\u683C\u95F4\u9694" }, {
  29594. default: withCtx(() => [
  29595. createVNode(_component_el_input_number, {
  29596. modelValue: _ctx.data.options.gutter,
  29597. "onUpdate:modelValue": _cache[54] || (_cache[54] = ($event) => _ctx.data.options.gutter = $event),
  29598. modelModifiers: { number: true },
  29599. min: 0
  29600. }, null, 8, ["modelValue"])
  29601. ]),
  29602. _: 1
  29603. }),
  29604. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  29605. default: withCtx(() => [
  29606. createVNode(_component_Draggable, {
  29607. tag: "ul",
  29608. "item-key": "index",
  29609. "ghost-class": "ghost",
  29610. handle: ".drag-item",
  29611. group: { name: "options" },
  29612. list: _ctx.data.columns
  29613. }, {
  29614. item: withCtx(({ element, index }) => [
  29615. createElementVNode("li", _hoisted_35, [
  29616. _hoisted_36,
  29617. createVNode(_component_el_input_number, {
  29618. modelValue: element.span,
  29619. "onUpdate:modelValue": ($event) => element.span = $event,
  29620. modelModifiers: { number: true },
  29621. placeholder: "\u6805\u683C\u503C",
  29622. min: 0,
  29623. max: 24
  29624. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  29625. createVNode(_component_el_button, {
  29626. type: "primary",
  29627. circle: "",
  29628. style: { "margin-left": "5px" },
  29629. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29630. }, {
  29631. default: withCtx(() => [
  29632. _hoisted_37
  29633. ]),
  29634. _: 2
  29635. }, 1032, ["onClick"])
  29636. ])
  29637. ]),
  29638. _: 1
  29639. }, 8, ["list"]),
  29640. createElementVNode("div", null, [
  29641. createVNode(_component_el_button, {
  29642. type: "text",
  29643. onClick: _ctx.handleInsertColumn
  29644. }, {
  29645. default: withCtx(() => [
  29646. _hoisted_38
  29647. ]),
  29648. _: 1
  29649. }, 8, ["onClick"])
  29650. ])
  29651. ]),
  29652. _: 1
  29653. }),
  29654. createVNode(_component_el_form_item, { label: "\u5782\u76F4\u5BF9\u9F50\u65B9\u5F0F" }, {
  29655. default: withCtx(() => [
  29656. createVNode(_component_el_radio_group, {
  29657. modelValue: _ctx.data.options.align,
  29658. "onUpdate:modelValue": _cache[55] || (_cache[55] = ($event) => _ctx.data.options.align = $event)
  29659. }, {
  29660. default: withCtx(() => [
  29661. createVNode(_component_el_radio_button, { label: "initial" }, {
  29662. default: withCtx(() => [
  29663. _hoisted_39
  29664. ]),
  29665. _: 1
  29666. }),
  29667. createVNode(_component_el_radio_button, { label: "center" }, {
  29668. default: withCtx(() => [
  29669. _hoisted_40
  29670. ]),
  29671. _: 1
  29672. }),
  29673. createVNode(_component_el_radio_button, { label: "flex-end" }, {
  29674. default: withCtx(() => [
  29675. _hoisted_41
  29676. ]),
  29677. _: 1
  29678. })
  29679. ]),
  29680. _: 1
  29681. }, 8, ["modelValue"])
  29682. ]),
  29683. _: 1
  29684. })
  29685. ], 64)) : createCommentVNode("", true),
  29686. _ctx.data.type !== "grid" ? (openBlock(), createElementBlock(Fragment, { key: 35 }, [
  29687. _ctx.hasKey("rules") || _ctx.hasKey("readonly") || _ctx.hasKey("disabled") || _ctx.hasKey("allowClear") ? (openBlock(), createBlock(_component_el_form_item, {
  29688. key: 0,
  29689. label: "\u64CD\u4F5C\u5C5E\u6027"
  29690. }, {
  29691. default: withCtx(() => [
  29692. _ctx.hasKey("rules") ? (openBlock(), createBlock(_component_el_checkbox, {
  29693. key: 0,
  29694. modelValue: _ctx.data.options.rules.required,
  29695. "onUpdate:modelValue": _cache[56] || (_cache[56] = ($event) => _ctx.data.options.rules.required = $event),
  29696. disabled: _ctx.data.allDisable
  29697. }, {
  29698. default: withCtx(() => [
  29699. _hoisted_42
  29700. ]),
  29701. _: 1
  29702. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  29703. _ctx.hasKey("readonly") ? (openBlock(), createBlock(_component_el_checkbox, {
  29704. key: 1,
  29705. modelValue: _ctx.data.options.readonly,
  29706. "onUpdate:modelValue": _cache[57] || (_cache[57] = ($event) => _ctx.data.options.readonly = $event),
  29707. disabled: _ctx.data.allDisable
  29708. }, {
  29709. default: withCtx(() => [
  29710. _hoisted_43
  29711. ]),
  29712. _: 1
  29713. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  29714. _ctx.hasKey("disabled") ? (openBlock(), createBlock(_component_el_checkbox, {
  29715. key: 2,
  29716. modelValue: _ctx.data.options.disabled,
  29717. "onUpdate:modelValue": _cache[58] || (_cache[58] = ($event) => _ctx.data.options.disabled = $event),
  29718. disabled: _ctx.data.allDisable
  29719. }, {
  29720. default: withCtx(() => [
  29721. _hoisted_44
  29722. ]),
  29723. _: 1
  29724. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  29725. _ctx.hasKey("clearable") ? (openBlock(), createBlock(_component_el_checkbox, {
  29726. key: 3,
  29727. modelValue: _ctx.data.options.clearable,
  29728. "onUpdate:modelValue": _cache[59] || (_cache[59] = ($event) => _ctx.data.options.clearable = $event),
  29729. disabled: _ctx.data.allDisable
  29730. }, {
  29731. default: withCtx(() => [
  29732. _hoisted_45
  29733. ]),
  29734. _: 1
  29735. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true)
  29736. ]),
  29737. _: 1
  29738. })) : createCommentVNode("", true),
  29739. _ctx.hasKey("rules") ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29740. _hoisted_46,
  29741. createVNode(_component_el_form_item, { label: "\u89E6\u53D1\u65F6\u673A" }, {
  29742. default: withCtx(() => [
  29743. createVNode(_component_el_radio_group, {
  29744. modelValue: _ctx.data.options.rules.trigger,
  29745. "onUpdate:modelValue": _cache[60] || (_cache[60] = ($event) => _ctx.data.options.rules.trigger = $event)
  29746. }, {
  29747. default: withCtx(() => [
  29748. createVNode(_component_el_radio_button, { label: "blur" }, {
  29749. default: withCtx(() => [
  29750. _hoisted_47
  29751. ]),
  29752. _: 1
  29753. }),
  29754. createVNode(_component_el_radio_button, { label: "change" }, {
  29755. default: withCtx(() => [
  29756. _hoisted_48
  29757. ]),
  29758. _: 1
  29759. })
  29760. ]),
  29761. _: 1
  29762. }, 8, ["modelValue"])
  29763. ]),
  29764. _: 1
  29765. }),
  29766. createVNode(_component_el_form_item, { label: "\u679A\u4E3E\u7C7B\u578B" }, {
  29767. default: withCtx(() => [
  29768. createVNode(_component_el_input, {
  29769. value: _ctx.data.options.rules.enum,
  29770. "onUpdate:value": _cache[61] || (_cache[61] = ($event) => _ctx.data.options.rules.enum = $event)
  29771. }, null, 8, ["value"])
  29772. ]),
  29773. _: 1
  29774. }),
  29775. createVNode(_component_el_form_item, { label: "\u5B57\u6BB5\u957F\u5EA6" }, {
  29776. default: withCtx(() => [
  29777. createVNode(_component_el_input, {
  29778. modelValue: _ctx.data.options.rules.len,
  29779. "onUpdate:modelValue": _cache[62] || (_cache[62] = ($event) => _ctx.data.options.rules.len = $event),
  29780. modelModifiers: { number: true }
  29781. }, null, 8, ["modelValue"])
  29782. ]),
  29783. _: 1
  29784. }),
  29785. createVNode(_component_el_form_item, { label: "\u6700\u5927\u957F\u5EA6" }, {
  29786. default: withCtx(() => [
  29787. createVNode(_component_el_input, {
  29788. modelValue: _ctx.data.options.rules.max,
  29789. "onUpdate:modelValue": _cache[63] || (_cache[63] = ($event) => _ctx.data.options.rules.max = $event),
  29790. modelModifiers: { number: true }
  29791. }, null, 8, ["modelValue"])
  29792. ]),
  29793. _: 1
  29794. }),
  29795. createVNode(_component_el_form_item, { label: "\u6700\u5C0F\u957F\u5EA6" }, {
  29796. default: withCtx(() => [
  29797. createVNode(_component_el_input, {
  29798. modelValue: _ctx.data.options.rules.min,
  29799. "onUpdate:modelValue": _cache[64] || (_cache[64] = ($event) => _ctx.data.options.rules.min = $event),
  29800. modelModifiers: { number: true }
  29801. }, null, 8, ["modelValue"])
  29802. ]),
  29803. _: 1
  29804. }),
  29805. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u6587\u6848" }, {
  29806. default: withCtx(() => [
  29807. createVNode(_component_el_input, {
  29808. modelValue: _ctx.data.options.rules.message,
  29809. "onUpdate:modelValue": _cache[65] || (_cache[65] = ($event) => _ctx.data.options.rules.message = $event)
  29810. }, null, 8, ["modelValue"])
  29811. ]),
  29812. _: 1
  29813. }),
  29814. createVNode(_component_el_form_item, { label: "\u6B63\u5219\u8868\u8FBE\u5F0F" }, {
  29815. default: withCtx(() => [
  29816. createVNode(_component_el_input, {
  29817. modelValue: _ctx.data.options.rules.pattern,
  29818. "onUpdate:modelValue": _cache[66] || (_cache[66] = ($event) => _ctx.data.options.rules.pattern = $event)
  29819. }, null, 8, ["modelValue"])
  29820. ]),
  29821. _: 1
  29822. }),
  29823. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u7C7B\u578B" }, {
  29824. default: withCtx(() => [
  29825. createVNode(_component_el_select, {
  29826. modelValue: _ctx.data.options.rules.type,
  29827. "onUpdate:modelValue": _cache[67] || (_cache[67] = ($event) => _ctx.data.options.rules.type = $event)
  29828. }, {
  29829. default: withCtx(() => [
  29830. createVNode(_component_el_option, { value: "string" }, {
  29831. default: withCtx(() => [
  29832. _hoisted_49
  29833. ]),
  29834. _: 1
  29835. }),
  29836. createVNode(_component_el_option, { value: "number" }, {
  29837. default: withCtx(() => [
  29838. _hoisted_50
  29839. ]),
  29840. _: 1
  29841. }),
  29842. createVNode(_component_el_option, { value: "boolean" }, {
  29843. default: withCtx(() => [
  29844. _hoisted_51
  29845. ]),
  29846. _: 1
  29847. }),
  29848. createVNode(_component_el_option, { value: "method" }, {
  29849. default: withCtx(() => [
  29850. _hoisted_52
  29851. ]),
  29852. _: 1
  29853. }),
  29854. createVNode(_component_el_option, { value: "regexp" }, {
  29855. default: withCtx(() => [
  29856. _hoisted_53
  29857. ]),
  29858. _: 1
  29859. }),
  29860. createVNode(_component_el_option, { value: "integer" }, {
  29861. default: withCtx(() => [
  29862. _hoisted_54
  29863. ]),
  29864. _: 1
  29865. }),
  29866. createVNode(_component_el_option, { value: "float" }, {
  29867. default: withCtx(() => [
  29868. _hoisted_55
  29869. ]),
  29870. _: 1
  29871. }),
  29872. createVNode(_component_el_option, { value: "array" }, {
  29873. default: withCtx(() => [
  29874. _hoisted_56
  29875. ]),
  29876. _: 1
  29877. }),
  29878. createVNode(_component_el_option, { value: "object" }, {
  29879. default: withCtx(() => [
  29880. _hoisted_57
  29881. ]),
  29882. _: 1
  29883. }),
  29884. createVNode(_component_el_option, { value: "enum" }, {
  29885. default: withCtx(() => [
  29886. _hoisted_58
  29887. ]),
  29888. _: 1
  29889. }),
  29890. createVNode(_component_el_option, { value: "date" }, {
  29891. default: withCtx(() => [
  29892. _hoisted_59
  29893. ]),
  29894. _: 1
  29895. }),
  29896. createVNode(_component_el_option, { value: "url" }, {
  29897. default: withCtx(() => [
  29898. _hoisted_60
  29899. ]),
  29900. _: 1
  29901. }),
  29902. createVNode(_component_el_option, { value: "hex" }, {
  29903. default: withCtx(() => [
  29904. _hoisted_61
  29905. ]),
  29906. _: 1
  29907. }),
  29908. createVNode(_component_el_option, { value: "email" }, {
  29909. default: withCtx(() => [
  29910. _hoisted_62
  29911. ]),
  29912. _: 1
  29913. }),
  29914. createVNode(_component_el_option, { value: "any" }, {
  29915. default: withCtx(() => [
  29916. _hoisted_63
  29917. ]),
  29918. _: 1
  29919. })
  29920. ]),
  29921. _: 1
  29922. }, 8, ["modelValue"])
  29923. ]),
  29924. _: 1
  29925. })
  29926. ], 64)) : createCommentVNode("", true)
  29927. ], 64)) : createCommentVNode("", true)
  29928. ]),
  29929. _: 1
  29930. })) : createCommentVNode("", true);
  29931. }
  29932. var WidgetConfig = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
  29933. const _hoisted_1$1 = /* @__PURE__ */ createTextVNode(" \u5DE6\u5BF9\u9F50 ");
  29934. const _hoisted_2$1 = /* @__PURE__ */ createTextVNode(" \u53F3\u5BF9\u9F50 ");
  29935. const _hoisted_3$1 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  29936. const _hoisted_4$1 = /* @__PURE__ */ createTextVNode(" \u5927 ");
  29937. const _hoisted_5$1 = /* @__PURE__ */ createTextVNode(" \u9ED8\u8BA4 ");
  29938. const _hoisted_6$1 = /* @__PURE__ */ createTextVNode(" \u5C0F ");
  29939. const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  29940. props: {
  29941. config: null
  29942. },
  29943. setup(__props) {
  29944. return (_ctx, _cache) => {
  29945. const _component_el_radio_button = ElRadioButton;
  29946. const _component_el_radio_group = ElRadioGroup;
  29947. const _component_el_form_item = ElFormItem;
  29948. const _component_el_input_number = ElInputNumber;
  29949. const _component_el_switch = ElSwitch;
  29950. const _component_el_form = ElForm;
  29951. return openBlock(), createBlock(_component_el_form, {
  29952. "p-2": "",
  29953. "label-position": "top",
  29954. onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
  29955. }, ["prevent"]))
  29956. }, {
  29957. default: withCtx(() => [
  29958. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BF9\u9F50\u65B9\u5F0F" }, {
  29959. default: withCtx(() => [
  29960. createVNode(_component_el_radio_group, {
  29961. modelValue: __props.config.labelPosition,
  29962. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.config.labelPosition = $event)
  29963. }, {
  29964. default: withCtx(() => [
  29965. createVNode(_component_el_radio_button, { label: "left" }, {
  29966. default: withCtx(() => [
  29967. _hoisted_1$1
  29968. ]),
  29969. _: 1
  29970. }),
  29971. createVNode(_component_el_radio_button, { label: "right" }, {
  29972. default: withCtx(() => [
  29973. _hoisted_2$1
  29974. ]),
  29975. _: 1
  29976. }),
  29977. createVNode(_component_el_radio_button, { label: "top" }, {
  29978. default: withCtx(() => [
  29979. _hoisted_3$1
  29980. ]),
  29981. _: 1
  29982. })
  29983. ]),
  29984. _: 1
  29985. }, 8, ["modelValue"])
  29986. ]),
  29987. _: 1
  29988. }),
  29989. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BBD\u5EA6" }, {
  29990. default: withCtx(() => [
  29991. createVNode(_component_el_input_number, {
  29992. modelValue: __props.config.labelWidth,
  29993. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => __props.config.labelWidth = $event),
  29994. modelModifiers: { number: true },
  29995. min: 0
  29996. }, null, 8, ["modelValue"])
  29997. ]),
  29998. _: 1
  29999. }),
  30000. createVNode(_component_el_form_item, { label: "\u7EC4\u4EF6\u5C3A\u5BF8" }, {
  30001. default: withCtx(() => [
  30002. createVNode(_component_el_radio_group, {
  30003. modelValue: __props.config.size,
  30004. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => __props.config.size = $event)
  30005. }, {
  30006. default: withCtx(() => [
  30007. createVNode(_component_el_radio_button, { label: "large" }, {
  30008. default: withCtx(() => [
  30009. _hoisted_4$1
  30010. ]),
  30011. _: 1
  30012. }),
  30013. createVNode(_component_el_radio_button, { label: "default" }, {
  30014. default: withCtx(() => [
  30015. _hoisted_5$1
  30016. ]),
  30017. _: 1
  30018. }),
  30019. createVNode(_component_el_radio_button, { label: "small" }, {
  30020. default: withCtx(() => [
  30021. _hoisted_6$1
  30022. ]),
  30023. _: 1
  30024. })
  30025. ]),
  30026. _: 1
  30027. }, 8, ["modelValue"])
  30028. ]),
  30029. _: 1
  30030. }),
  30031. createVNode(_component_el_form_item, { label: "\u9690\u85CF\u5FC5\u9009\u6807\u8BB0" }, {
  30032. default: withCtx(() => [
  30033. createVNode(_component_el_switch, {
  30034. modelValue: __props.config.hideRequiredAsterisk,
  30035. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => __props.config.hideRequiredAsterisk = $event)
  30036. }, null, 8, ["modelValue"])
  30037. ]),
  30038. _: 1
  30039. })
  30040. ]),
  30041. _: 1
  30042. });
  30043. };
  30044. }
  30045. });
  30046. function _extends() {
  30047. _extends = Object.assign || function(target) {
  30048. for (var i = 1; i < arguments.length; i++) {
  30049. var source = arguments[i];
  30050. for (var key in source) {
  30051. if (Object.prototype.hasOwnProperty.call(source, key)) {
  30052. target[key] = source[key];
  30053. }
  30054. }
  30055. }
  30056. return target;
  30057. };
  30058. return _extends.apply(this, arguments);
  30059. }
  30060. var KEYCODE_ENTER = 13;
  30061. var KEYCODE_TAB = 9;
  30062. var KEYCODE_BACKSPACE = 8;
  30063. var KEYCODE_Y = 89;
  30064. var KEYCODE_Z = 90;
  30065. var KEYCODE_M = 77;
  30066. var KEYCODE_PARENS = 57;
  30067. var KEYCODE_BRACKETS = 219;
  30068. var KEYCODE_QUOTE = 222;
  30069. var KEYCODE_BACK_QUOTE = 192;
  30070. var KEYCODE_ESCAPE = 27;
  30071. var HISTORY_LIMIT = 100;
  30072. var HISTORY_TIME_GAP = 3e3;
  30073. var isWindows = typeof window !== "undefined" && navigator && /* @__PURE__ */ /Win/i.test(navigator.platform);
  30074. var isMacLike = typeof window !== "undefined" && navigator && /* @__PURE__ */ /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
  30075. var PrismEditor = /* @__PURE__ */ defineComponent({
  30076. props: {
  30077. lineNumbers: {
  30078. type: Boolean,
  30079. "default": false
  30080. },
  30081. autoStyleLineNumbers: {
  30082. type: Boolean,
  30083. "default": true
  30084. },
  30085. readonly: {
  30086. type: Boolean,
  30087. "default": false
  30088. },
  30089. modelValue: {
  30090. type: String,
  30091. "default": ""
  30092. },
  30093. highlight: {
  30094. type: Function,
  30095. required: true
  30096. },
  30097. tabSize: {
  30098. type: Number,
  30099. "default": 2
  30100. },
  30101. insertSpaces: {
  30102. type: Boolean,
  30103. "default": true
  30104. },
  30105. ignoreTabKey: {
  30106. type: Boolean,
  30107. "default": false
  30108. },
  30109. placeholder: {
  30110. type: String,
  30111. "default": ""
  30112. }
  30113. },
  30114. data: function data() {
  30115. return {
  30116. capture: true,
  30117. history: {
  30118. stack: [],
  30119. offset: -1
  30120. },
  30121. lineNumbersHeight: "20px",
  30122. codeData: ""
  30123. };
  30124. },
  30125. watch: {
  30126. modelValue: {
  30127. immediate: true,
  30128. handler: function handler(newVal) {
  30129. if (!newVal) {
  30130. this.codeData = "";
  30131. } else {
  30132. this.codeData = newVal;
  30133. }
  30134. }
  30135. },
  30136. content: {
  30137. immediate: true,
  30138. handler: function handler2() {
  30139. var _this = this;
  30140. if (this.lineNumbers) {
  30141. this.$nextTick(function() {
  30142. _this.setLineNumbersHeight();
  30143. });
  30144. }
  30145. }
  30146. },
  30147. lineNumbers: function lineNumbers() {
  30148. var _this2 = this;
  30149. this.$nextTick(function() {
  30150. _this2.styleLineNumbers();
  30151. _this2.setLineNumbersHeight();
  30152. });
  30153. }
  30154. },
  30155. computed: {
  30156. isEmpty: function isEmpty2() {
  30157. return this.codeData.length === 0;
  30158. },
  30159. content: function content() {
  30160. var result = this.highlight(this.codeData) + "<br />";
  30161. return result;
  30162. },
  30163. lineNumbersCount: function lineNumbersCount() {
  30164. var totalLines = this.codeData.split(/\r\n|\n/).length;
  30165. return totalLines;
  30166. }
  30167. },
  30168. mounted: function mounted() {
  30169. this._recordCurrentState();
  30170. this.styleLineNumbers();
  30171. },
  30172. methods: {
  30173. setLineNumbersHeight: function setLineNumbersHeight() {
  30174. this.lineNumbersHeight = getComputedStyle(this.$refs.pre).height;
  30175. },
  30176. styleLineNumbers: function styleLineNumbers() {
  30177. if (!this.lineNumbers || !this.autoStyleLineNumbers)
  30178. return;
  30179. var $editor = this.$refs.pre;
  30180. var $lineNumbers = this.$el.querySelector(".prism-editor__line-numbers");
  30181. var editorStyles = window.getComputedStyle($editor);
  30182. this.$nextTick(function() {
  30183. var btlr = "border-top-left-radius";
  30184. var bblr = "border-bottom-left-radius";
  30185. if (!$lineNumbers)
  30186. return;
  30187. $lineNumbers.style[btlr] = editorStyles[btlr];
  30188. $lineNumbers.style[bblr] = editorStyles[bblr];
  30189. $editor.style[btlr] = "0";
  30190. $editor.style[bblr] = "0";
  30191. var stylesList = ["background-color", "margin-top", "padding-top", "font-family", "font-size", "line-height"];
  30192. stylesList.forEach(function(style) {
  30193. $lineNumbers.style[style] = editorStyles[style];
  30194. });
  30195. $lineNumbers.style["margin-bottom"] = "-" + editorStyles["padding-top"];
  30196. });
  30197. },
  30198. _recordCurrentState: function _recordCurrentState() {
  30199. var input = this.$refs.textarea;
  30200. if (!input)
  30201. return;
  30202. var value = input.value, selectionStart = input.selectionStart, selectionEnd = input.selectionEnd;
  30203. this._recordChange({
  30204. value,
  30205. selectionStart,
  30206. selectionEnd
  30207. });
  30208. },
  30209. _getLines: function _getLines(text, position) {
  30210. return text.substring(0, position).split("\n");
  30211. },
  30212. _applyEdits: function _applyEdits(record) {
  30213. var input = this.$refs.textarea;
  30214. var last = this.history.stack[this.history.offset];
  30215. if (last && input) {
  30216. this.history.stack[this.history.offset] = _extends({}, last, {
  30217. selectionStart: input.selectionStart,
  30218. selectionEnd: input.selectionEnd
  30219. });
  30220. }
  30221. this._recordChange(record);
  30222. this._updateInput(record);
  30223. },
  30224. _recordChange: function _recordChange(record, overwrite) {
  30225. if (overwrite === void 0) {
  30226. overwrite = false;
  30227. }
  30228. var _this$history = this.history, stack = _this$history.stack, offset2 = _this$history.offset;
  30229. if (stack.length && offset2 > -1) {
  30230. this.history.stack = stack.slice(0, offset2 + 1);
  30231. var count = this.history.stack.length;
  30232. if (count > HISTORY_LIMIT) {
  30233. var extras = count - HISTORY_LIMIT;
  30234. this.history.stack = stack.slice(extras, count);
  30235. this.history.offset = Math.max(this.history.offset - extras, 0);
  30236. }
  30237. }
  30238. var timestamp = Date.now();
  30239. if (overwrite) {
  30240. var last = this.history.stack[this.history.offset];
  30241. if (last && timestamp - last.timestamp < HISTORY_TIME_GAP) {
  30242. var _this$_getLines$pop, _this$_getLines$pop2;
  30243. var re = /[^a-z0-9]([a-z0-9]+)$/i;
  30244. 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);
  30245. 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);
  30246. if (previous && current && current[1].startsWith(previous[1])) {
  30247. this.history.stack[this.history.offset] = _extends({}, record, {
  30248. timestamp
  30249. });
  30250. return;
  30251. }
  30252. }
  30253. }
  30254. this.history.stack.push(_extends({}, record, {
  30255. timestamp
  30256. }));
  30257. this.history.offset++;
  30258. },
  30259. _updateInput: function _updateInput(record) {
  30260. var input = this.$refs.textarea;
  30261. if (!input)
  30262. return;
  30263. input.value = record.value;
  30264. input.selectionStart = record.selectionStart;
  30265. input.selectionEnd = record.selectionEnd;
  30266. this.$emit("update:modelValue", record.value);
  30267. },
  30268. handleChange: function handleChange(e) {
  30269. var _e$target = e.target, value = _e$target.value, selectionStart = _e$target.selectionStart, selectionEnd = _e$target.selectionEnd;
  30270. this._recordChange({
  30271. value,
  30272. selectionStart,
  30273. selectionEnd
  30274. }, true);
  30275. this.$emit("update:modelValue", value);
  30276. },
  30277. _undoEdit: function _undoEdit() {
  30278. var _this$history2 = this.history, stack = _this$history2.stack, offset2 = _this$history2.offset;
  30279. var record = stack[offset2 - 1];
  30280. if (record) {
  30281. this._updateInput(record);
  30282. this.history.offset = Math.max(offset2 - 1, 0);
  30283. }
  30284. },
  30285. _redoEdit: function _redoEdit() {
  30286. var _this$history3 = this.history, stack = _this$history3.stack, offset2 = _this$history3.offset;
  30287. var record = stack[offset2 + 1];
  30288. if (record) {
  30289. this._updateInput(record);
  30290. this.history.offset = Math.min(offset2 + 1, stack.length - 1);
  30291. }
  30292. },
  30293. handleKeyDown: function handleKeyDown(e) {
  30294. var tabSize = this.tabSize, insertSpaces = this.insertSpaces, ignoreTabKey = this.ignoreTabKey;
  30295. this.$emit("keydown", e);
  30296. if (e.defaultPrevented) {
  30297. return;
  30298. }
  30299. if (e.keyCode === KEYCODE_ESCAPE) {
  30300. e.target.blur();
  30301. this.$emit("blur", e);
  30302. }
  30303. var _e$target2 = e.target, value = _e$target2.value, selectionStart = _e$target2.selectionStart, selectionEnd = _e$target2.selectionEnd;
  30304. var tabCharacter = (insertSpaces ? " " : " ").repeat(tabSize);
  30305. if (e.keyCode === KEYCODE_TAB && !ignoreTabKey && this.capture) {
  30306. e.preventDefault();
  30307. if (e.shiftKey) {
  30308. var linesBeforeCaret = this._getLines(value, selectionStart);
  30309. var startLine = linesBeforeCaret.length - 1;
  30310. var endLine = this._getLines(value, selectionEnd).length - 1;
  30311. var nextValue = value.split("\n").map(function(line2, i) {
  30312. if (i >= startLine && i <= endLine && line2.startsWith(tabCharacter)) {
  30313. return line2.substring(tabCharacter.length);
  30314. }
  30315. return line2;
  30316. }).join("\n");
  30317. if (value !== nextValue) {
  30318. var startLineText = linesBeforeCaret[startLine];
  30319. this._applyEdits({
  30320. value: nextValue,
  30321. selectionStart: startLineText.startsWith(tabCharacter) ? selectionStart - tabCharacter.length : selectionStart,
  30322. selectionEnd: selectionEnd - (value.length - nextValue.length)
  30323. });
  30324. }
  30325. } else if (selectionStart !== selectionEnd) {
  30326. var _linesBeforeCaret = this._getLines(value, selectionStart);
  30327. var _startLine = _linesBeforeCaret.length - 1;
  30328. var _endLine = this._getLines(value, selectionEnd).length - 1;
  30329. var _startLineText = _linesBeforeCaret[_startLine];
  30330. this._applyEdits({
  30331. value: value.split("\n").map(function(line2, i) {
  30332. if (i >= _startLine && i <= _endLine) {
  30333. return tabCharacter + line2;
  30334. }
  30335. return line2;
  30336. }).join("\n"),
  30337. selectionStart: /\S/.test(_startLineText) ? selectionStart + tabCharacter.length : selectionStart,
  30338. selectionEnd: selectionEnd + tabCharacter.length * (_endLine - _startLine + 1)
  30339. });
  30340. } else {
  30341. var updatedSelection = selectionStart + tabCharacter.length;
  30342. this._applyEdits({
  30343. value: value.substring(0, selectionStart) + tabCharacter + value.substring(selectionEnd),
  30344. selectionStart: updatedSelection,
  30345. selectionEnd: updatedSelection
  30346. });
  30347. }
  30348. } else if (e.keyCode === KEYCODE_BACKSPACE) {
  30349. var hasSelection = selectionStart !== selectionEnd;
  30350. var textBeforeCaret = value.substring(0, selectionStart);
  30351. if (textBeforeCaret.endsWith(tabCharacter) && !hasSelection) {
  30352. e.preventDefault();
  30353. var _updatedSelection = selectionStart - tabCharacter.length;
  30354. this._applyEdits({
  30355. value: value.substring(0, selectionStart - tabCharacter.length) + value.substring(selectionEnd),
  30356. selectionStart: _updatedSelection,
  30357. selectionEnd: _updatedSelection
  30358. });
  30359. }
  30360. } else if (e.keyCode === KEYCODE_ENTER) {
  30361. if (selectionStart === selectionEnd) {
  30362. var line = this._getLines(value, selectionStart).pop();
  30363. var matches = line === null || line === void 0 ? void 0 : line.match(/^\s+/);
  30364. if (matches && matches[0]) {
  30365. e.preventDefault();
  30366. var indent = "\n" + matches[0];
  30367. var _updatedSelection2 = selectionStart + indent.length;
  30368. this._applyEdits({
  30369. value: value.substring(0, selectionStart) + indent + value.substring(selectionEnd),
  30370. selectionStart: _updatedSelection2,
  30371. selectionEnd: _updatedSelection2
  30372. });
  30373. }
  30374. }
  30375. } else if (e.keyCode === KEYCODE_PARENS || e.keyCode === KEYCODE_BRACKETS || e.keyCode === KEYCODE_QUOTE || e.keyCode === KEYCODE_BACK_QUOTE) {
  30376. var chars;
  30377. if (e.keyCode === KEYCODE_PARENS && e.shiftKey) {
  30378. chars = ["(", ")"];
  30379. } else if (e.keyCode === KEYCODE_BRACKETS) {
  30380. if (e.shiftKey) {
  30381. chars = ["{", "}"];
  30382. } else {
  30383. chars = ["[", "]"];
  30384. }
  30385. } else if (e.keyCode === KEYCODE_QUOTE) {
  30386. if (e.shiftKey) {
  30387. chars = ['"', '"'];
  30388. } else {
  30389. chars = ["'", "'"];
  30390. }
  30391. } else if (e.keyCode === KEYCODE_BACK_QUOTE && !e.shiftKey) {
  30392. chars = ["`", "`"];
  30393. }
  30394. if (selectionStart !== selectionEnd && chars) {
  30395. e.preventDefault();
  30396. this._applyEdits({
  30397. value: value.substring(0, selectionStart) + chars[0] + value.substring(selectionStart, selectionEnd) + chars[1] + value.substring(selectionEnd),
  30398. selectionStart,
  30399. selectionEnd: selectionEnd + 2
  30400. });
  30401. }
  30402. } else if ((isMacLike ? e.metaKey && e.keyCode === KEYCODE_Z : e.ctrlKey && e.keyCode === KEYCODE_Z) && !e.shiftKey && !e.altKey) {
  30403. e.preventDefault();
  30404. this._undoEdit();
  30405. } 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) {
  30406. e.preventDefault();
  30407. this._redoEdit();
  30408. } else if (e.keyCode === KEYCODE_M && e.ctrlKey && (isMacLike ? e.shiftKey : true)) {
  30409. e.preventDefault();
  30410. this.capture = !this.capture;
  30411. }
  30412. }
  30413. },
  30414. render: function render() {
  30415. var _this3 = this;
  30416. var lineNumberWidthCalculator = h$1("div", {
  30417. "class": "prism-editor__line-width-calc",
  30418. style: "height: 0px; visibility: hidden; pointer-events: none;"
  30419. }, "999");
  30420. var lineNumbers2 = h$1("div", {
  30421. "class": "prism-editor__line-numbers",
  30422. style: {
  30423. "min-height": this.lineNumbersHeight
  30424. },
  30425. "aria-hidden": "true"
  30426. }, [lineNumberWidthCalculator, Array.from(Array(this.lineNumbersCount).keys()).map(function(_2, index) {
  30427. return h$1("div", {
  30428. "class": "prism-editor__line-number token comment"
  30429. }, "" + ++index);
  30430. })]);
  30431. var textarea = h$1("textarea", {
  30432. ref: "textarea",
  30433. onInput: this.handleChange,
  30434. onKeydown: this.handleKeyDown,
  30435. onClick: function onClick($event) {
  30436. _this3.$emit("click", $event);
  30437. },
  30438. onKeyup: function onKeyup($event) {
  30439. _this3.$emit("keyup", $event);
  30440. },
  30441. onFocus: function onFocus($event) {
  30442. _this3.$emit("focus", $event);
  30443. },
  30444. onBlur: function onBlur($event) {
  30445. _this3.$emit("blur", $event);
  30446. },
  30447. "class": {
  30448. "prism-editor__textarea": true,
  30449. "prism-editor__textarea--empty": this.isEmpty
  30450. },
  30451. spellCheck: "false",
  30452. autocapitalize: "off",
  30453. autocomplete: "off",
  30454. autocorrect: "off",
  30455. "data-gramm": "false",
  30456. placeholder: this.placeholder,
  30457. "data-testid": "textarea",
  30458. readonly: this.readonly,
  30459. value: this.codeData
  30460. });
  30461. var preview = h$1("pre", {
  30462. ref: "pre",
  30463. "class": "prism-editor__editor",
  30464. "data-testid": "preview",
  30465. innerHTML: this.content
  30466. });
  30467. var editorContainer = h$1("div", {
  30468. "class": "prism-editor__container"
  30469. }, [textarea, preview]);
  30470. return h$1("div", {
  30471. "class": "prism-editor-wrapper"
  30472. }, [this.lineNumbers && lineNumbers2, editorContainer]);
  30473. }
  30474. });
  30475. var prismeditor_min = "";
  30476. var prismCore = { exports: {} };
  30477. (function(module2) {
  30478. var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
  30479. /**
  30480. * Prism: Lightweight, robust, elegant syntax highlighting
  30481. *
  30482. * @license MIT <https://opensource.org/licenses/MIT>
  30483. * @author Lea Verou <https://lea.verou.me>
  30484. * @namespace
  30485. * @public
  30486. */
  30487. var Prism2 = function(_self2) {
  30488. var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
  30489. var uniqueId = 0;
  30490. var plainTextGrammar = {};
  30491. var _2 = {
  30492. manual: _self2.Prism && _self2.Prism.manual,
  30493. disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
  30494. util: {
  30495. encode: function encode(tokens) {
  30496. if (tokens instanceof Token) {
  30497. return new Token(tokens.type, encode(tokens.content), tokens.alias);
  30498. } else if (Array.isArray(tokens)) {
  30499. return tokens.map(encode);
  30500. } else {
  30501. return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
  30502. }
  30503. },
  30504. type: function(o2) {
  30505. return Object.prototype.toString.call(o2).slice(8, -1);
  30506. },
  30507. objId: function(obj) {
  30508. if (!obj["__id"]) {
  30509. Object.defineProperty(obj, "__id", { value: ++uniqueId });
  30510. }
  30511. return obj["__id"];
  30512. },
  30513. clone: function deepClone(o2, visited) {
  30514. visited = visited || {};
  30515. var clone2;
  30516. var id;
  30517. switch (_2.util.type(o2)) {
  30518. case "Object":
  30519. id = _2.util.objId(o2);
  30520. if (visited[id]) {
  30521. return visited[id];
  30522. }
  30523. clone2 = {};
  30524. visited[id] = clone2;
  30525. for (var key in o2) {
  30526. if (o2.hasOwnProperty(key)) {
  30527. clone2[key] = deepClone(o2[key], visited);
  30528. }
  30529. }
  30530. return clone2;
  30531. case "Array":
  30532. id = _2.util.objId(o2);
  30533. if (visited[id]) {
  30534. return visited[id];
  30535. }
  30536. clone2 = [];
  30537. visited[id] = clone2;
  30538. o2.forEach(function(v2, i) {
  30539. clone2[i] = deepClone(v2, visited);
  30540. });
  30541. return clone2;
  30542. default:
  30543. return o2;
  30544. }
  30545. },
  30546. getLanguage: function(element) {
  30547. while (element) {
  30548. var m2 = lang.exec(element.className);
  30549. if (m2) {
  30550. return m2[1].toLowerCase();
  30551. }
  30552. element = element.parentElement;
  30553. }
  30554. return "none";
  30555. },
  30556. setLanguage: function(element, language) {
  30557. element.className = element.className.replace(RegExp(lang, "gi"), "");
  30558. element.classList.add("language-" + language);
  30559. },
  30560. currentScript: function() {
  30561. if (typeof document === "undefined") {
  30562. return null;
  30563. }
  30564. if ("currentScript" in document && 1 < 2) {
  30565. return document.currentScript;
  30566. }
  30567. try {
  30568. throw new Error();
  30569. } catch (err) {
  30570. var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
  30571. if (src) {
  30572. var scripts = document.getElementsByTagName("script");
  30573. for (var i in scripts) {
  30574. if (scripts[i].src == src) {
  30575. return scripts[i];
  30576. }
  30577. }
  30578. }
  30579. return null;
  30580. }
  30581. },
  30582. isActive: function(element, className, defaultActivation) {
  30583. var no = "no-" + className;
  30584. while (element) {
  30585. var classList = element.classList;
  30586. if (classList.contains(className)) {
  30587. return true;
  30588. }
  30589. if (classList.contains(no)) {
  30590. return false;
  30591. }
  30592. element = element.parentElement;
  30593. }
  30594. return !!defaultActivation;
  30595. }
  30596. },
  30597. languages: {
  30598. plain: plainTextGrammar,
  30599. plaintext: plainTextGrammar,
  30600. text: plainTextGrammar,
  30601. txt: plainTextGrammar,
  30602. extend: function(id, redef) {
  30603. var lang2 = _2.util.clone(_2.languages[id]);
  30604. for (var key in redef) {
  30605. lang2[key] = redef[key];
  30606. }
  30607. return lang2;
  30608. },
  30609. insertBefore: function(inside, before, insert, root2) {
  30610. root2 = root2 || _2.languages;
  30611. var grammar = root2[inside];
  30612. var ret = {};
  30613. for (var token in grammar) {
  30614. if (grammar.hasOwnProperty(token)) {
  30615. if (token == before) {
  30616. for (var newToken in insert) {
  30617. if (insert.hasOwnProperty(newToken)) {
  30618. ret[newToken] = insert[newToken];
  30619. }
  30620. }
  30621. }
  30622. if (!insert.hasOwnProperty(token)) {
  30623. ret[token] = grammar[token];
  30624. }
  30625. }
  30626. }
  30627. var old = root2[inside];
  30628. root2[inside] = ret;
  30629. _2.languages.DFS(_2.languages, function(key, value) {
  30630. if (value === old && key != inside) {
  30631. this[key] = ret;
  30632. }
  30633. });
  30634. return ret;
  30635. },
  30636. DFS: function DFS(o2, callback, type4, visited) {
  30637. visited = visited || {};
  30638. var objId = _2.util.objId;
  30639. for (var i in o2) {
  30640. if (o2.hasOwnProperty(i)) {
  30641. callback.call(o2, i, o2[i], type4 || i);
  30642. var property = o2[i];
  30643. var propertyType = _2.util.type(property);
  30644. if (propertyType === "Object" && !visited[objId(property)]) {
  30645. visited[objId(property)] = true;
  30646. DFS(property, callback, null, visited);
  30647. } else if (propertyType === "Array" && !visited[objId(property)]) {
  30648. visited[objId(property)] = true;
  30649. DFS(property, callback, i, visited);
  30650. }
  30651. }
  30652. }
  30653. }
  30654. },
  30655. plugins: {},
  30656. highlightAll: function(async, callback) {
  30657. _2.highlightAllUnder(document, async, callback);
  30658. },
  30659. highlightAllUnder: function(container, async, callback) {
  30660. var env = {
  30661. callback,
  30662. container,
  30663. selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
  30664. };
  30665. _2.hooks.run("before-highlightall", env);
  30666. env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
  30667. _2.hooks.run("before-all-elements-highlight", env);
  30668. for (var i = 0, element; element = env.elements[i++]; ) {
  30669. _2.highlightElement(element, async === true, env.callback);
  30670. }
  30671. },
  30672. highlightElement: function(element, async, callback) {
  30673. var language = _2.util.getLanguage(element);
  30674. var grammar = _2.languages[language];
  30675. _2.util.setLanguage(element, language);
  30676. var parent = element.parentElement;
  30677. if (parent && parent.nodeName.toLowerCase() === "pre") {
  30678. _2.util.setLanguage(parent, language);
  30679. }
  30680. var code = element.textContent;
  30681. var env = {
  30682. element,
  30683. language,
  30684. grammar,
  30685. code
  30686. };
  30687. function insertHighlightedCode(highlightedCode) {
  30688. env.highlightedCode = highlightedCode;
  30689. _2.hooks.run("before-insert", env);
  30690. env.element.innerHTML = env.highlightedCode;
  30691. _2.hooks.run("after-highlight", env);
  30692. _2.hooks.run("complete", env);
  30693. callback && callback.call(env.element);
  30694. }
  30695. _2.hooks.run("before-sanity-check", env);
  30696. parent = env.element.parentElement;
  30697. if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
  30698. parent.setAttribute("tabindex", "0");
  30699. }
  30700. if (!env.code) {
  30701. _2.hooks.run("complete", env);
  30702. callback && callback.call(env.element);
  30703. return;
  30704. }
  30705. _2.hooks.run("before-highlight", env);
  30706. if (!env.grammar) {
  30707. insertHighlightedCode(_2.util.encode(env.code));
  30708. return;
  30709. }
  30710. if (async && _self2.Worker) {
  30711. var worker = new Worker(_2.filename);
  30712. worker.onmessage = function(evt) {
  30713. insertHighlightedCode(evt.data);
  30714. };
  30715. worker.postMessage(JSON.stringify({
  30716. language: env.language,
  30717. code: env.code,
  30718. immediateClose: true
  30719. }));
  30720. } else {
  30721. insertHighlightedCode(_2.highlight(env.code, env.grammar, env.language));
  30722. }
  30723. },
  30724. highlight: function(text, grammar, language) {
  30725. var env = {
  30726. code: text,
  30727. grammar,
  30728. language
  30729. };
  30730. _2.hooks.run("before-tokenize", env);
  30731. if (!env.grammar) {
  30732. throw new Error('The language "' + env.language + '" has no grammar.');
  30733. }
  30734. env.tokens = _2.tokenize(env.code, env.grammar);
  30735. _2.hooks.run("after-tokenize", env);
  30736. return Token.stringify(_2.util.encode(env.tokens), env.language);
  30737. },
  30738. tokenize: function(text, grammar) {
  30739. var rest = grammar.rest;
  30740. if (rest) {
  30741. for (var token in rest) {
  30742. grammar[token] = rest[token];
  30743. }
  30744. delete grammar.rest;
  30745. }
  30746. var tokenList = new LinkedList();
  30747. addAfter(tokenList, tokenList.head, text);
  30748. matchGrammar(text, tokenList, grammar, tokenList.head, 0);
  30749. return toArray(tokenList);
  30750. },
  30751. hooks: {
  30752. all: {},
  30753. add: function(name, callback) {
  30754. var hooks = _2.hooks.all;
  30755. hooks[name] = hooks[name] || [];
  30756. hooks[name].push(callback);
  30757. },
  30758. run: function(name, env) {
  30759. var callbacks = _2.hooks.all[name];
  30760. if (!callbacks || !callbacks.length) {
  30761. return;
  30762. }
  30763. for (var i = 0, callback; callback = callbacks[i++]; ) {
  30764. callback(env);
  30765. }
  30766. }
  30767. },
  30768. Token
  30769. };
  30770. _self2.Prism = _2;
  30771. function Token(type4, content2, alias, matchedStr) {
  30772. this.type = type4;
  30773. this.content = content2;
  30774. this.alias = alias;
  30775. this.length = (matchedStr || "").length | 0;
  30776. }
  30777. Token.stringify = function stringify(o2, language) {
  30778. if (typeof o2 == "string") {
  30779. return o2;
  30780. }
  30781. if (Array.isArray(o2)) {
  30782. var s2 = "";
  30783. o2.forEach(function(e) {
  30784. s2 += stringify(e, language);
  30785. });
  30786. return s2;
  30787. }
  30788. var env = {
  30789. type: o2.type,
  30790. content: stringify(o2.content, language),
  30791. tag: "span",
  30792. classes: ["token", o2.type],
  30793. attributes: {},
  30794. language
  30795. };
  30796. var aliases = o2.alias;
  30797. if (aliases) {
  30798. if (Array.isArray(aliases)) {
  30799. Array.prototype.push.apply(env.classes, aliases);
  30800. } else {
  30801. env.classes.push(aliases);
  30802. }
  30803. }
  30804. _2.hooks.run("wrap", env);
  30805. var attributes = "";
  30806. for (var name in env.attributes) {
  30807. attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
  30808. }
  30809. return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
  30810. };
  30811. function matchPattern(pattern4, pos, text, lookbehind) {
  30812. pattern4.lastIndex = pos;
  30813. var match = pattern4.exec(text);
  30814. if (match && lookbehind && match[1]) {
  30815. var lookbehindLength = match[1].length;
  30816. match.index += lookbehindLength;
  30817. match[0] = match[0].slice(lookbehindLength);
  30818. }
  30819. return match;
  30820. }
  30821. function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
  30822. for (var token in grammar) {
  30823. if (!grammar.hasOwnProperty(token) || !grammar[token]) {
  30824. continue;
  30825. }
  30826. var patterns = grammar[token];
  30827. patterns = Array.isArray(patterns) ? patterns : [patterns];
  30828. for (var j = 0; j < patterns.length; ++j) {
  30829. if (rematch && rematch.cause == token + "," + j) {
  30830. return;
  30831. }
  30832. var patternObj = patterns[j];
  30833. var inside = patternObj.inside;
  30834. var lookbehind = !!patternObj.lookbehind;
  30835. var greedy = !!patternObj.greedy;
  30836. var alias = patternObj.alias;
  30837. if (greedy && !patternObj.pattern.global) {
  30838. var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
  30839. patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
  30840. }
  30841. var pattern4 = patternObj.pattern || patternObj;
  30842. for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
  30843. if (rematch && pos >= rematch.reach) {
  30844. break;
  30845. }
  30846. var str = currentNode.value;
  30847. if (tokenList.length > text.length) {
  30848. return;
  30849. }
  30850. if (str instanceof Token) {
  30851. continue;
  30852. }
  30853. var removeCount = 1;
  30854. var match;
  30855. if (greedy) {
  30856. match = matchPattern(pattern4, pos, text, lookbehind);
  30857. if (!match || match.index >= text.length) {
  30858. break;
  30859. }
  30860. var from = match.index;
  30861. var to = match.index + match[0].length;
  30862. var p2 = pos;
  30863. p2 += currentNode.value.length;
  30864. while (from >= p2) {
  30865. currentNode = currentNode.next;
  30866. p2 += currentNode.value.length;
  30867. }
  30868. p2 -= currentNode.value.length;
  30869. pos = p2;
  30870. if (currentNode.value instanceof Token) {
  30871. continue;
  30872. }
  30873. for (var k = currentNode; k !== tokenList.tail && (p2 < to || typeof k.value === "string"); k = k.next) {
  30874. removeCount++;
  30875. p2 += k.value.length;
  30876. }
  30877. removeCount--;
  30878. str = text.slice(pos, p2);
  30879. match.index -= pos;
  30880. } else {
  30881. match = matchPattern(pattern4, 0, str, lookbehind);
  30882. if (!match) {
  30883. continue;
  30884. }
  30885. }
  30886. var from = match.index;
  30887. var matchStr = match[0];
  30888. var before = str.slice(0, from);
  30889. var after = str.slice(from + matchStr.length);
  30890. var reach = pos + str.length;
  30891. if (rematch && reach > rematch.reach) {
  30892. rematch.reach = reach;
  30893. }
  30894. var removeFrom = currentNode.prev;
  30895. if (before) {
  30896. removeFrom = addAfter(tokenList, removeFrom, before);
  30897. pos += before.length;
  30898. }
  30899. removeRange(tokenList, removeFrom, removeCount);
  30900. var wrapped = new Token(token, inside ? _2.tokenize(matchStr, inside) : matchStr, alias, matchStr);
  30901. currentNode = addAfter(tokenList, removeFrom, wrapped);
  30902. if (after) {
  30903. addAfter(tokenList, currentNode, after);
  30904. }
  30905. if (removeCount > 1) {
  30906. var nestedRematch = {
  30907. cause: token + "," + j,
  30908. reach
  30909. };
  30910. matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
  30911. if (rematch && nestedRematch.reach > rematch.reach) {
  30912. rematch.reach = nestedRematch.reach;
  30913. }
  30914. }
  30915. }
  30916. }
  30917. }
  30918. }
  30919. function LinkedList() {
  30920. var head = { value: null, prev: null, next: null };
  30921. var tail = { value: null, prev: head, next: null };
  30922. head.next = tail;
  30923. this.head = head;
  30924. this.tail = tail;
  30925. this.length = 0;
  30926. }
  30927. function addAfter(list, node, value) {
  30928. var next = node.next;
  30929. var newNode = { value, prev: node, next };
  30930. node.next = newNode;
  30931. next.prev = newNode;
  30932. list.length++;
  30933. return newNode;
  30934. }
  30935. function removeRange(list, node, count) {
  30936. var next = node.next;
  30937. for (var i = 0; i < count && next !== list.tail; i++) {
  30938. next = next.next;
  30939. }
  30940. node.next = next;
  30941. next.prev = node;
  30942. list.length -= i;
  30943. }
  30944. function toArray(list) {
  30945. var array4 = [];
  30946. var node = list.head.next;
  30947. while (node !== list.tail) {
  30948. array4.push(node.value);
  30949. node = node.next;
  30950. }
  30951. return array4;
  30952. }
  30953. if (!_self2.document) {
  30954. if (!_self2.addEventListener) {
  30955. return _2;
  30956. }
  30957. if (!_2.disableWorkerMessageHandler) {
  30958. _self2.addEventListener("message", function(evt) {
  30959. var message = JSON.parse(evt.data);
  30960. var lang2 = message.language;
  30961. var code = message.code;
  30962. var immediateClose = message.immediateClose;
  30963. _self2.postMessage(_2.highlight(code, _2.languages[lang2], lang2));
  30964. if (immediateClose) {
  30965. _self2.close();
  30966. }
  30967. }, false);
  30968. }
  30969. return _2;
  30970. }
  30971. var script = _2.util.currentScript();
  30972. if (script) {
  30973. _2.filename = script.src;
  30974. if (script.hasAttribute("data-manual")) {
  30975. _2.manual = true;
  30976. }
  30977. }
  30978. function highlightAutomaticallyCallback() {
  30979. if (!_2.manual) {
  30980. _2.highlightAll();
  30981. }
  30982. }
  30983. if (!_2.manual) {
  30984. var readyState = document.readyState;
  30985. if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
  30986. document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
  30987. } else {
  30988. if (window.requestAnimationFrame) {
  30989. window.requestAnimationFrame(highlightAutomaticallyCallback);
  30990. } else {
  30991. window.setTimeout(highlightAutomaticallyCallback, 16);
  30992. }
  30993. }
  30994. }
  30995. return _2;
  30996. }(_self);
  30997. if (module2.exports) {
  30998. module2.exports = Prism2;
  30999. }
  31000. if (typeof commonjsGlobal !== "undefined") {
  31001. commonjsGlobal.Prism = Prism2;
  31002. }
  31003. })(prismCore);
  31004. Prism.languages.clike = {
  31005. "comment": [
  31006. {
  31007. pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
  31008. lookbehind: true,
  31009. greedy: true
  31010. },
  31011. {
  31012. pattern: /(^|[^\\:])\/\/.*/,
  31013. lookbehind: true,
  31014. greedy: true
  31015. }
  31016. ],
  31017. "string": {
  31018. pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  31019. greedy: true
  31020. },
  31021. "class-name": {
  31022. pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
  31023. lookbehind: true,
  31024. inside: {
  31025. "punctuation": /[.\\]/
  31026. }
  31027. },
  31028. "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
  31029. "boolean": /\b(?:false|true)\b/,
  31030. "function": /\b\w+(?=\()/,
  31031. "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
  31032. "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
  31033. "punctuation": /[{}[\];(),.:]/
  31034. };
  31035. Prism.languages.json = {
  31036. "property": {
  31037. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
  31038. lookbehind: true,
  31039. greedy: true
  31040. },
  31041. "string": {
  31042. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
  31043. lookbehind: true,
  31044. greedy: true
  31045. },
  31046. "comment": {
  31047. pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
  31048. greedy: true
  31049. },
  31050. "number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
  31051. "punctuation": /[{}[\],]/,
  31052. "operator": /:/,
  31053. "boolean": /\b(?:false|true)\b/,
  31054. "null": {
  31055. pattern: /\bnull\b/,
  31056. alias: "keyword"
  31057. }
  31058. };
  31059. Prism.languages.webmanifest = Prism.languages.json;
  31060. var prismTomorrow = "";
  31061. var CodeEditor_vue_vue_type_style_index_0_lang = "";
  31062. const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  31063. props: {
  31064. modelValue: { default: "" },
  31065. language: { default: "json" },
  31066. readonly: { type: Boolean, default: false }
  31067. },
  31068. emits: ["update:modelValue"],
  31069. setup(__props, { emit }) {
  31070. const code = computed({
  31071. get() {
  31072. return __props.modelValue;
  31073. },
  31074. set(val) {
  31075. emit("update:modelValue", val);
  31076. }
  31077. });
  31078. return (_ctx, _cache) => {
  31079. return openBlock(), createBlock(unref(PrismEditor), {
  31080. modelValue: code.value,
  31081. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => code.value = $event),
  31082. "max-h-xl": "",
  31083. class: "form-design-editor",
  31084. highlight: (code2) => {
  31085. return unref(prismCore.exports.highlight)(code2, unref(prismCore.exports.languages)[__props.language]);
  31086. },
  31087. readonly: __props.readonly,
  31088. "line-numbers": ""
  31089. }, null, 8, ["modelValue", "highlight", "readonly"]);
  31090. };
  31091. }
  31092. });
  31093. var DesignForm_vue_vue_type_style_index_0_lang = "";
  31094. const _hoisted_1 = {
  31095. "h-full": "",
  31096. "bg-white": "",
  31097. flex: ""
  31098. };
  31099. const _hoisted_2 = {
  31100. "pt-2": "",
  31101. "w-62": ""
  31102. };
  31103. const _hoisted_3 = {
  31104. border: "0 x solid gray-200",
  31105. flex: "~ 1 col nowrap"
  31106. };
  31107. const _hoisted_4 = {
  31108. border: "0 b solid gray-200",
  31109. flex: "",
  31110. "gap-2": "",
  31111. "items-center": "",
  31112. "justify-end": "",
  31113. "h-11": "",
  31114. "py-0": "",
  31115. "px-2": ""
  31116. };
  31117. const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "ep:edit" }, null, -1);
  31118. const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u4FEE\u6539 ");
  31119. const _hoisted_7 = /* @__PURE__ */ createElementVNode("i", { class: "custom:clearable" }, null, -1);
  31120. const _hoisted_8 = /* @__PURE__ */ createTextVNode("\u6E05\u7A7A ");
  31121. const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "custom:preview" }, null, -1);
  31122. const _hoisted_10 = /* @__PURE__ */ createTextVNode("\u9884\u89C8 ");
  31123. const _hoisted_11 = {
  31124. relative: "",
  31125. "w-75": "",
  31126. flex: "~ col"
  31127. };
  31128. const _hoisted_12 = {
  31129. border: "0 b-1 gray-200",
  31130. grid: "~ cols-2",
  31131. "min-h-11": "",
  31132. "px-2": ""
  31133. };
  31134. const _hoisted_13 = /* @__PURE__ */ createTextVNode(" \u590D\u5236 ");
  31135. const _hoisted_14 = /* @__PURE__ */ createTextVNode(" \u786E\u8BA4\u4FEE\u6539 ");
  31136. const __default__ = { name: "DesignForm" };
  31137. const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
  31138. props: {
  31139. preview: {
  31140. type: Boolean,
  31141. default: true
  31142. },
  31143. generateJson: {
  31144. type: Boolean,
  31145. default: true
  31146. },
  31147. clearable: {
  31148. type: Boolean,
  31149. default: true
  31150. },
  31151. basicFieldsList: {
  31152. type: Array,
  31153. default: () => basicFields
  31154. },
  31155. advanceFieldsList: {
  31156. type: Array,
  31157. default: () => advanceFields
  31158. },
  31159. layoutFieldsList: {
  31160. type: Array,
  31161. default: () => layoutFields
  31162. },
  31163. request: {
  31164. type: Function
  31165. }
  31166. },
  31167. setup(__props, { expose }) {
  31168. let tab = ref(0);
  31169. let selectWidget = ref();
  31170. watch(() => selectWidget.value, (val) => {
  31171. tab.value = val ? 0 : 1;
  31172. });
  31173. let widgetForm = ref(getWidgetForm());
  31174. let generateJsonVisible = ref(false);
  31175. let generateJsonTemplate = ref(JSON.stringify(getWidgetForm(), null, 2));
  31176. const handleUploadJson = () => {
  31177. var _a2;
  31178. try {
  31179. widgetForm.value = JSON.parse(generateJsonTemplate.value);
  31180. selectWidget.value = (_a2 = widgetForm.value.list) == null ? void 0 : _a2[0];
  31181. generateJsonVisible.value = false;
  31182. ElMessage.success("\u4FEE\u6539\u6210\u529F");
  31183. } catch (error) {
  31184. ElMessage.error("\u4FEE\u6539\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5JSON\u683C\u5F0F\u662F\u5426\u6B63\u786E\u3002");
  31185. }
  31186. };
  31187. const handleGenerateJson = () => (generateJsonTemplate.value = JSON.stringify(widgetForm.value, null, 2)) && (generateJsonVisible.value = true);
  31188. const handleClearable = () => {
  31189. widgetForm.value = getWidgetForm();
  31190. selectWidget.value = void 0;
  31191. };
  31192. let dataVisible = ref(false);
  31193. const generateFormRef = ref(null);
  31194. const handleGetData = async () => {
  31195. var _a2;
  31196. dataVisible.value = !dataVisible.value;
  31197. if (!dataVisible.value)
  31198. return;
  31199. const res = await ((_a2 = generateFormRef.value) == null ? void 0 : _a2.getData());
  31200. generateJsonTemplate.value = JSON.stringify(res, null, 2);
  31201. };
  31202. const handleReset = () => {
  31203. var _a2;
  31204. return (_a2 = generateFormRef.value) == null ? void 0 : _a2.reset();
  31205. };
  31206. const handleCopyClick = (text) => {
  31207. navigator.clipboard.writeText(text);
  31208. ElMessage.success({ message: "Copy\u6210\u529F" });
  31209. };
  31210. const previewVisible = ref(false);
  31211. expose({
  31212. getJson: () => widgetForm.value,
  31213. setJson: (json) => {
  31214. var _a2;
  31215. widgetForm.value = json;
  31216. selectWidget.value = (_a2 = json.list) == null ? void 0 : _a2[0];
  31217. },
  31218. clear: handleClearable
  31219. });
  31220. return (_ctx, _cache) => {
  31221. const _component_el_button = ElButton;
  31222. const _component_el_dialog = ElDialog;
  31223. return openBlock(), createElementBlock("section", _hoisted_1, [
  31224. createElementVNode("aside", _hoisted_2, [
  31225. createVNode(_sfc_main$6, {
  31226. title: "\u57FA\u7840\u5B57\u6BB5",
  31227. fields: __props.basicFieldsList,
  31228. list: unref(basicComponents),
  31229. allList: widgetForm.value
  31230. }, null, 8, ["fields", "list", "allList"]),
  31231. createVNode(_sfc_main$6, {
  31232. title: "\u9AD8\u7EA7\u5B57\u6BB5",
  31233. fields: __props.advanceFieldsList,
  31234. list: unref(advanceComponents),
  31235. allList: widgetForm.value
  31236. }, null, 8, ["fields", "list", "allList"]),
  31237. createVNode(_sfc_main$6, {
  31238. title: "\u5E03\u5C40\u5B57\u6BB5",
  31239. fields: __props.layoutFieldsList,
  31240. list: unref(layoutComponents),
  31241. allList: widgetForm.value
  31242. }, null, 8, ["fields", "list", "allList"])
  31243. ]),
  31244. createElementVNode("main", _hoisted_3, [
  31245. createElementVNode("header", _hoisted_4, [
  31246. renderSlot(_ctx.$slots, "default"),
  31247. __props.generateJson ? (openBlock(), createBlock(_component_el_button, {
  31248. key: 0,
  31249. type: "text",
  31250. onClick: handleGenerateJson
  31251. }, {
  31252. icon: withCtx(() => [
  31253. _hoisted_5
  31254. ]),
  31255. default: withCtx(() => [
  31256. _hoisted_6
  31257. ]),
  31258. _: 1
  31259. })) : createCommentVNode("", true),
  31260. __props.clearable ? (openBlock(), createBlock(_component_el_button, {
  31261. key: 1,
  31262. type: "text",
  31263. onClick: handleClearable
  31264. }, {
  31265. icon: withCtx(() => [
  31266. _hoisted_7
  31267. ]),
  31268. default: withCtx(() => [
  31269. _hoisted_8
  31270. ]),
  31271. _: 1
  31272. })) : createCommentVNode("", true),
  31273. __props.preview ? (openBlock(), createBlock(_component_el_button, {
  31274. key: 2,
  31275. type: "text",
  31276. onClick: _cache[0] || (_cache[0] = ($event) => previewVisible.value = true)
  31277. }, {
  31278. icon: withCtx(() => [
  31279. _hoisted_9
  31280. ]),
  31281. default: withCtx(() => [
  31282. _hoisted_10
  31283. ]),
  31284. _: 1
  31285. })) : createCommentVNode("", true)
  31286. ]),
  31287. createVNode(_sfc_main$4, mergeProps({ ref: "widgetFormRef" }, widgetForm.value, {
  31288. selectWidget: selectWidget.value,
  31289. "onUpdate:selectWidget": _cache[1] || (_cache[1] = ($event) => selectWidget.value = $event)
  31290. }), null, 16, ["selectWidget"])
  31291. ]),
  31292. createElementVNode("aside", _hoisted_11, [
  31293. createElementVNode("header", _hoisted_12, [
  31294. createElementVNode("div", {
  31295. class: normalizeClass([{ active: !tab.value }, "config-tab"]),
  31296. onClick: _cache[2] || (_cache[2] = ($event) => tab.value = 0)
  31297. }, " \u5B57\u6BB5\u5C5E\u6027 ", 2),
  31298. createElementVNode("div", {
  31299. class: normalizeClass([{ active: tab.value }, "config-tab"]),
  31300. onClick: _cache[3] || (_cache[3] = ($event) => tab.value = 1)
  31301. }, " \u8868\u5355\u5C5E\u6027 ", 2)
  31302. ]),
  31303. withDirectives(createVNode(WidgetConfig, {
  31304. select: selectWidget.value,
  31305. "onUpdate:select": _cache[4] || (_cache[4] = ($event) => selectWidget.value = $event)
  31306. }, null, 8, ["select"]), [
  31307. [vShow, !tab.value]
  31308. ]),
  31309. withDirectives(createVNode(_sfc_main$2, {
  31310. config: widgetForm.value.config,
  31311. "onUpdate:config": _cache[5] || (_cache[5] = ($event) => widgetForm.value.config = $event)
  31312. }, null, 8, ["config"]), [
  31313. [vShow, tab.value]
  31314. ])
  31315. ]),
  31316. createVNode(_component_el_dialog, {
  31317. modelValue: previewVisible.value,
  31318. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => previewVisible.value = $event),
  31319. "destroy-on-close": "",
  31320. title: "\u9884\u89C8",
  31321. "z-index": 2e3,
  31322. width: 800,
  31323. onClose: _cache[9] || (_cache[9] = ($event) => dataVisible.value = false)
  31324. }, {
  31325. footer: withCtx(() => [
  31326. createVNode(_component_el_button, {
  31327. onClick: _cache[7] || (_cache[7] = ($event) => dataVisible.value ? handleCopyClick(generateJsonTemplate.value) : handleReset())
  31328. }, {
  31329. default: withCtx(() => [
  31330. createTextVNode(toDisplayString(dataVisible.value ? "\u590D\u5236" : "\u91CD\u7F6E"), 1)
  31331. ]),
  31332. _: 1
  31333. }),
  31334. createVNode(_component_el_button, {
  31335. type: "primary",
  31336. onClick: handleGetData
  31337. }, {
  31338. default: withCtx(() => [
  31339. createTextVNode(toDisplayString(dataVisible.value ? "\u8FD4\u56DE\u9884\u89C8" : "\u83B7\u53D6\u6570\u636E"), 1)
  31340. ]),
  31341. _: 1
  31342. })
  31343. ]),
  31344. default: withCtx(() => [
  31345. withDirectives(createVNode(_sfc_main$1, {
  31346. modelValue: generateJsonTemplate.value,
  31347. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => generateJsonTemplate.value = $event)
  31348. }, null, 8, ["modelValue"]), [
  31349. [vShow, dataVisible.value]
  31350. ]),
  31351. withDirectives(createVNode(GenerateForm, {
  31352. ref_key: "generateFormRef",
  31353. ref: generateFormRef,
  31354. request: __props.request,
  31355. data: widgetForm.value
  31356. }, null, 8, ["request", "data"]), [
  31357. [vShow, !dataVisible.value]
  31358. ])
  31359. ]),
  31360. _: 1
  31361. }, 8, ["modelValue"]),
  31362. createVNode(_component_el_dialog, {
  31363. modelValue: generateJsonVisible.value,
  31364. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => generateJsonVisible.value = $event),
  31365. "append-to-body": "",
  31366. title: "\u4FEE\u6539JSON",
  31367. "z-index": 2e4,
  31368. width: 800
  31369. }, {
  31370. footer: withCtx(() => [
  31371. createVNode(_component_el_button, {
  31372. onClick: _cache[11] || (_cache[11] = ($event) => handleCopyClick(generateJsonTemplate.value))
  31373. }, {
  31374. default: withCtx(() => [
  31375. _hoisted_13
  31376. ]),
  31377. _: 1
  31378. }),
  31379. createVNode(_component_el_button, {
  31380. type: "primary",
  31381. onClick: handleUploadJson
  31382. }, {
  31383. default: withCtx(() => [
  31384. _hoisted_14
  31385. ]),
  31386. _: 1
  31387. })
  31388. ]),
  31389. default: withCtx(() => [
  31390. createVNode(_sfc_main$1, {
  31391. modelValue: generateJsonTemplate.value,
  31392. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => generateJsonTemplate.value = $event)
  31393. }, null, 8, ["modelValue"])
  31394. ]),
  31395. _: 1
  31396. }, 8, ["modelValue"])
  31397. ]);
  31398. };
  31399. }
  31400. }));
  31401. export { _sfc_main as DesignForm, GenerateForm, advanceFields, basicFields, layoutFields };
  31402. //# sourceMappingURL=index.es.js.map