index.es.js 1.1 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616
  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, provide, onMounted, watchEffect, onBeforeUnmount, isRef, onBeforeMount, mergeProps, renderSlot, useAttrs as useAttrs$1, useSlots, shallowRef, nextTick, onUpdated, toRef, withDirectives, normalizeClass, normalizeStyle, createCommentVNode, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, vShow, Transition, resolveComponent, reactive, cloneVNode, Text, Teleport, createTextVNode, readonly, resolveDirective, renderList, h as h$1, vModelCheckbox, toRefs, withKeys, vModelRadio, onBeforeUpdate, vModelText, createSlots, markRaw, effectScope, toRaw, triggerRef, normalizeProps, guardReactiveProps, onUnmounted, TransitionGroup, pushScopeId, popScopeId, createPropsRestProxy } from "vue";
  34. import { ElMessage } from "element-plus";
  35. import Draggable from "vuedraggable";
  36. var elMessage = "";
  37. const rules$1 = {
  38. trigger: "blur",
  39. enum: "",
  40. len: void 0,
  41. max: void 0,
  42. message: "",
  43. min: void 0,
  44. pattern: "",
  45. required: false,
  46. type: "any"
  47. };
  48. const getWidgetForm = () => ({
  49. list: [],
  50. config: {
  51. size: "default",
  52. hideRequiredAsterisk: false,
  53. labelWidth: 100,
  54. labelPosition: "right"
  55. }
  56. });
  57. const basicComponents = [
  58. {
  59. label: "\u5355\u884C\u6587\u672C",
  60. type: "input",
  61. options: {
  62. width: "100%",
  63. defaultValue: "",
  64. placeholder: "",
  65. maxlength: null,
  66. prefix: "",
  67. suffix: "",
  68. prepend: "",
  69. append: "",
  70. disabled: false,
  71. clearable: false,
  72. readonly: false,
  73. rules: rules$1
  74. }
  75. },
  76. {
  77. label: "\u5BC6\u7801\u6846",
  78. type: "password",
  79. options: {
  80. width: "100%",
  81. defaultValue: "",
  82. placeholder: "",
  83. maxlength: null,
  84. prefix: "",
  85. suffix: "",
  86. prepend: "",
  87. append: "",
  88. showPassword: true,
  89. disabled: false,
  90. clearable: false,
  91. readonly: false,
  92. rules: rules$1
  93. }
  94. },
  95. {
  96. label: "\u591A\u884C\u6587\u672C",
  97. type: "textarea",
  98. options: {
  99. width: "100%",
  100. defaultValue: "",
  101. placeholder: "",
  102. maxlength: null,
  103. rows: 4,
  104. autosize: false,
  105. showWordLimit: false,
  106. disabled: false,
  107. clearable: false,
  108. readonly: false,
  109. rules: rules$1
  110. }
  111. },
  112. {
  113. label: "\u8BA1\u6570\u5668",
  114. type: "number",
  115. options: {
  116. width: "",
  117. defaultValue: 0,
  118. min: 0,
  119. max: 100,
  120. step: 1,
  121. disabled: false,
  122. rules: rules$1
  123. }
  124. },
  125. {
  126. label: "\u5355\u9009\u6846\u7EC4",
  127. type: "radio",
  128. options: {
  129. defaultValue: "",
  130. width: "",
  131. inline: true,
  132. remote: false,
  133. showLabel: true,
  134. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  135. options: [
  136. {
  137. value: "Option 1",
  138. label: "Option 1"
  139. },
  140. {
  141. value: "Option 2",
  142. label: "Option 2"
  143. },
  144. {
  145. value: "Option 3",
  146. label: "Option 3"
  147. }
  148. ],
  149. remoteOptions: [],
  150. props: {
  151. value: "value",
  152. label: "label"
  153. },
  154. disabled: false,
  155. rules: rules$1
  156. }
  157. },
  158. {
  159. label: "\u591A\u9009\u6846\u7EC4",
  160. type: "checkbox",
  161. options: {
  162. defaultValue: [],
  163. width: "",
  164. inline: true,
  165. remote: false,
  166. showLabel: true,
  167. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  168. options: [
  169. {
  170. label: "Option 1",
  171. value: "Option 1"
  172. },
  173. {
  174. label: "Option 2",
  175. value: "Option 2"
  176. },
  177. {
  178. label: "Option 3",
  179. value: "Option 3"
  180. }
  181. ],
  182. remoteOptions: [],
  183. props: {
  184. value: "value",
  185. label: "label"
  186. },
  187. disabled: false,
  188. rules: rules$1
  189. }
  190. },
  191. {
  192. label: "\u65F6\u95F4\u9009\u62E9\u5668",
  193. type: "time",
  194. options: {
  195. defaultValue: "",
  196. width: "",
  197. placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
  198. format: "HH:mm:ss",
  199. valueFormat: "HH:mm:ss",
  200. readonly: false,
  201. editable: true,
  202. clearable: true,
  203. disabled: false,
  204. rules: rules$1
  205. }
  206. },
  207. {
  208. label: "\u65E5\u671F\u9009\u62E9\u5668",
  209. type: "date",
  210. options: {
  211. defaultValue: "",
  212. width: "",
  213. placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
  214. format: "YYYY-MM-DD",
  215. readonly: false,
  216. editable: true,
  217. clearable: true,
  218. disabled: false,
  219. rules: rules$1
  220. }
  221. },
  222. {
  223. label: "\u8BC4\u5206",
  224. type: "rate",
  225. options: {
  226. defaultValue: 0,
  227. max: 5,
  228. allowHalf: false,
  229. disabled: false,
  230. rules: rules$1
  231. }
  232. },
  233. {
  234. label: "\u4E0B\u62C9\u9009\u62E9\u6846",
  235. type: "select",
  236. options: {
  237. defaultValue: "",
  238. width: "200px",
  239. multiple: false,
  240. placeholder: "",
  241. remote: false,
  242. showLabel: true,
  243. filterable: false,
  244. clearable: false,
  245. disabled: false,
  246. props: {
  247. label: "label",
  248. value: "value"
  249. },
  250. options: [
  251. {
  252. label: "Option 1",
  253. value: "Option 1"
  254. },
  255. {
  256. label: "Option 2",
  257. value: "Option 2"
  258. },
  259. {
  260. label: "Option 3",
  261. value: "Option 3"
  262. }
  263. ],
  264. remoteOptions: [],
  265. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  266. rules: rules$1
  267. }
  268. },
  269. {
  270. label: "\u5F00\u5173",
  271. type: "switch",
  272. options: {
  273. defaultValue: false,
  274. disabled: false,
  275. activeText: "",
  276. inactiveText: "",
  277. rules: rules$1
  278. }
  279. },
  280. {
  281. label: "\u6ED1\u5757",
  282. type: "slider",
  283. options: {
  284. defaultValue: 0,
  285. width: "",
  286. min: 0,
  287. max: 100,
  288. step: 1,
  289. disabled: false,
  290. range: false,
  291. rules: rules$1
  292. }
  293. },
  294. {
  295. label: "\u6587\u5B57",
  296. type: "text",
  297. options: {
  298. defaultValue: "This is a text"
  299. }
  300. }
  301. ];
  302. const basicFields = basicComponents.map((i) => i.type);
  303. const advanceComponents = [
  304. {
  305. label: "\u56FE\u7247",
  306. type: "img-upload",
  307. options: {
  308. defaultValue: [],
  309. name: "file",
  310. action: "http://example.com/upload",
  311. method: "post",
  312. listType: "text",
  313. accept: "image/*",
  314. limit: 1,
  315. multiple: false,
  316. disabled: true,
  317. rules: rules$1
  318. }
  319. },
  320. {
  321. label: "\u4E0B\u8F7D",
  322. type: "download",
  323. labelWidth: "auto",
  324. options: {
  325. defaultValue: "",
  326. name: "file"
  327. }
  328. },
  329. {
  330. label: "\u7EA7\u8054\u9009\u62E9\u5668",
  331. type: "cascader",
  332. options: {
  333. defaultValue: [],
  334. width: "200px",
  335. placeholder: "",
  336. disabled: false,
  337. clearable: false,
  338. filterable: false,
  339. remote: true,
  340. remoteOptions: [],
  341. props: {
  342. label: "label",
  343. value: "value",
  344. children: "children"
  345. },
  346. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  347. rules: rules$1
  348. }
  349. }
  350. ];
  351. const advanceFields = advanceComponents.map((i) => i.type);
  352. const layoutComponents = [
  353. {
  354. label: "\u6805\u683C\u5E03\u5C40",
  355. type: "grid",
  356. columns: [
  357. {
  358. span: 12,
  359. list: []
  360. },
  361. {
  362. span: 12,
  363. list: []
  364. }
  365. ],
  366. options: {
  367. gutter: 0,
  368. align: "initial"
  369. }
  370. },
  371. {
  372. label: "\u6570\u636E\u8868\u683C",
  373. type: "table",
  374. columns: [
  375. { label: "\u540D\u79F0", prop: "name" },
  376. { label: "\u521B\u5EFA\u65F6\u95F4", prop: "createTime" }
  377. ],
  378. options: {
  379. defaultValue: [],
  380. disabled: false,
  381. size: "",
  382. align: "center"
  383. }
  384. },
  385. {
  386. label: "\u5206\u5272\u7EBF",
  387. type: "divider",
  388. options: {}
  389. }
  390. ];
  391. const layoutFields = layoutComponents.map((i) => i.type);
  392. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  393. var freeGlobal$1 = freeGlobal;
  394. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  395. var root = freeGlobal$1 || freeSelf || Function("return this")();
  396. var root$1 = root;
  397. var Symbol$1 = root$1.Symbol;
  398. var Symbol$2 = Symbol$1;
  399. var objectProto$e = Object.prototype;
  400. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  401. var nativeObjectToString$1 = objectProto$e.toString;
  402. var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
  403. function getRawTag(value) {
  404. var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  405. try {
  406. value[symToStringTag$1] = void 0;
  407. var unmasked = true;
  408. } catch (e) {
  409. }
  410. var result = nativeObjectToString$1.call(value);
  411. if (unmasked) {
  412. if (isOwn) {
  413. value[symToStringTag$1] = tag;
  414. } else {
  415. delete value[symToStringTag$1];
  416. }
  417. }
  418. return result;
  419. }
  420. var objectProto$d = Object.prototype;
  421. var nativeObjectToString = objectProto$d.toString;
  422. function objectToString$1(value) {
  423. return nativeObjectToString.call(value);
  424. }
  425. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  426. var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
  427. function baseGetTag(value) {
  428. if (value == null) {
  429. return value === void 0 ? undefinedTag : nullTag;
  430. }
  431. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString$1(value);
  432. }
  433. function isObjectLike(value) {
  434. return value != null && typeof value == "object";
  435. }
  436. var symbolTag$3 = "[object Symbol]";
  437. function isSymbol(value) {
  438. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  439. }
  440. function arrayMap(array4, iteratee) {
  441. var index = -1, length = array4 == null ? 0 : array4.length, result = Array(length);
  442. while (++index < length) {
  443. result[index] = iteratee(array4[index], index, array4);
  444. }
  445. return result;
  446. }
  447. var isArray$1 = Array.isArray;
  448. var isArray$2 = isArray$1;
  449. var INFINITY$3 = 1 / 0;
  450. var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  451. function baseToString(value) {
  452. if (typeof value == "string") {
  453. return value;
  454. }
  455. if (isArray$2(value)) {
  456. return arrayMap(value, baseToString) + "";
  457. }
  458. if (isSymbol(value)) {
  459. return symbolToString ? symbolToString.call(value) : "";
  460. }
  461. var result = value + "";
  462. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  463. }
  464. var reWhitespace = /\s/;
  465. function trimmedEndIndex(string3) {
  466. var index = string3.length;
  467. while (index-- && reWhitespace.test(string3.charAt(index))) {
  468. }
  469. return index;
  470. }
  471. var reTrimStart = /^\s+/;
  472. function baseTrim(string3) {
  473. return string3 ? string3.slice(0, trimmedEndIndex(string3) + 1).replace(reTrimStart, "") : string3;
  474. }
  475. function isObject$2(value) {
  476. var type4 = typeof value;
  477. return value != null && (type4 == "object" || type4 == "function");
  478. }
  479. var NAN = 0 / 0;
  480. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  481. var reIsBinary = /^0b[01]+$/i;
  482. var reIsOctal = /^0o[0-7]+$/i;
  483. var freeParseInt = parseInt;
  484. function toNumber(value) {
  485. if (typeof value == "number") {
  486. return value;
  487. }
  488. if (isSymbol(value)) {
  489. return NAN;
  490. }
  491. if (isObject$2(value)) {
  492. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  493. value = isObject$2(other) ? other + "" : other;
  494. }
  495. if (typeof value != "string") {
  496. return value === 0 ? value : +value;
  497. }
  498. value = baseTrim(value);
  499. var isBinary = reIsBinary.test(value);
  500. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  501. }
  502. function identity(value) {
  503. return value;
  504. }
  505. var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  506. function isFunction$1(value) {
  507. if (!isObject$2(value)) {
  508. return false;
  509. }
  510. var tag = baseGetTag(value);
  511. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  512. }
  513. var coreJsData = root$1["__core-js_shared__"];
  514. var coreJsData$1 = coreJsData;
  515. var maskSrcKey = function() {
  516. var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  517. return uid2 ? "Symbol(src)_1." + uid2 : "";
  518. }();
  519. function isMasked(func) {
  520. return !!maskSrcKey && maskSrcKey in func;
  521. }
  522. var funcProto$1 = Function.prototype;
  523. var funcToString$1 = funcProto$1.toString;
  524. function toSource(func) {
  525. if (func != null) {
  526. try {
  527. return funcToString$1.call(func);
  528. } catch (e) {
  529. }
  530. try {
  531. return func + "";
  532. } catch (e) {
  533. }
  534. }
  535. return "";
  536. }
  537. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  538. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  539. var funcProto = Function.prototype, objectProto$c = Object.prototype;
  540. var funcToString = funcProto.toString;
  541. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  542. var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  543. function baseIsNative(value) {
  544. if (!isObject$2(value) || isMasked(value)) {
  545. return false;
  546. }
  547. var pattern4 = isFunction$1(value) ? reIsNative : reIsHostCtor;
  548. return pattern4.test(toSource(value));
  549. }
  550. function getValue$1(object4, key) {
  551. return object4 == null ? void 0 : object4[key];
  552. }
  553. function getNative(object4, key) {
  554. var value = getValue$1(object4, key);
  555. return baseIsNative(value) ? value : void 0;
  556. }
  557. var WeakMap = getNative(root$1, "WeakMap");
  558. var WeakMap$1 = WeakMap;
  559. var objectCreate = Object.create;
  560. var baseCreate = function() {
  561. function object4() {
  562. }
  563. return function(proto) {
  564. if (!isObject$2(proto)) {
  565. return {};
  566. }
  567. if (objectCreate) {
  568. return objectCreate(proto);
  569. }
  570. object4.prototype = proto;
  571. var result = new object4();
  572. object4.prototype = void 0;
  573. return result;
  574. };
  575. }();
  576. var baseCreate$1 = baseCreate;
  577. function apply(func, thisArg, args) {
  578. switch (args.length) {
  579. case 0:
  580. return func.call(thisArg);
  581. case 1:
  582. return func.call(thisArg, args[0]);
  583. case 2:
  584. return func.call(thisArg, args[0], args[1]);
  585. case 3:
  586. return func.call(thisArg, args[0], args[1], args[2]);
  587. }
  588. return func.apply(thisArg, args);
  589. }
  590. function noop$1() {
  591. }
  592. function copyArray(source, array4) {
  593. var index = -1, length = source.length;
  594. array4 || (array4 = Array(length));
  595. while (++index < length) {
  596. array4[index] = source[index];
  597. }
  598. return array4;
  599. }
  600. var HOT_COUNT = 800, HOT_SPAN = 16;
  601. var nativeNow = Date.now;
  602. function shortOut(func) {
  603. var count = 0, lastCalled = 0;
  604. return function() {
  605. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  606. lastCalled = stamp;
  607. if (remaining > 0) {
  608. if (++count >= HOT_COUNT) {
  609. return arguments[0];
  610. }
  611. } else {
  612. count = 0;
  613. }
  614. return func.apply(void 0, arguments);
  615. };
  616. }
  617. function constant(value) {
  618. return function() {
  619. return value;
  620. };
  621. }
  622. var defineProperty = function() {
  623. try {
  624. var func = getNative(Object, "defineProperty");
  625. func({}, "", {});
  626. return func;
  627. } catch (e) {
  628. }
  629. }();
  630. var defineProperty$1 = defineProperty;
  631. var baseSetToString = !defineProperty$1 ? identity : function(func, string3) {
  632. return defineProperty$1(func, "toString", {
  633. "configurable": true,
  634. "enumerable": false,
  635. "value": constant(string3),
  636. "writable": true
  637. });
  638. };
  639. var baseSetToString$1 = baseSetToString;
  640. var setToString = shortOut(baseSetToString$1);
  641. var setToString$1 = setToString;
  642. function arrayEach(array4, iteratee) {
  643. var index = -1, length = array4 == null ? 0 : array4.length;
  644. while (++index < length) {
  645. if (iteratee(array4[index], index, array4) === false) {
  646. break;
  647. }
  648. }
  649. return array4;
  650. }
  651. function baseFindIndex(array4, predicate, fromIndex, fromRight) {
  652. var length = array4.length, index = fromIndex + (fromRight ? 1 : -1);
  653. while (fromRight ? index-- : ++index < length) {
  654. if (predicate(array4[index], index, array4)) {
  655. return index;
  656. }
  657. }
  658. return -1;
  659. }
  660. function baseIsNaN(value) {
  661. return value !== value;
  662. }
  663. function strictIndexOf(array4, value, fromIndex) {
  664. var index = fromIndex - 1, length = array4.length;
  665. while (++index < length) {
  666. if (array4[index] === value) {
  667. return index;
  668. }
  669. }
  670. return -1;
  671. }
  672. function baseIndexOf(array4, value, fromIndex) {
  673. return value === value ? strictIndexOf(array4, value, fromIndex) : baseFindIndex(array4, baseIsNaN, fromIndex);
  674. }
  675. function arrayIncludes(array4, value) {
  676. var length = array4 == null ? 0 : array4.length;
  677. return !!length && baseIndexOf(array4, value, 0) > -1;
  678. }
  679. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  680. var reIsUint = /^(?:0|[1-9]\d*)$/;
  681. function isIndex(value, length) {
  682. var type4 = typeof value;
  683. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  684. return !!length && (type4 == "number" || type4 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  685. }
  686. function baseAssignValue(object4, key, value) {
  687. if (key == "__proto__" && defineProperty$1) {
  688. defineProperty$1(object4, key, {
  689. "configurable": true,
  690. "enumerable": true,
  691. "value": value,
  692. "writable": true
  693. });
  694. } else {
  695. object4[key] = value;
  696. }
  697. }
  698. function eq(value, other) {
  699. return value === other || value !== value && other !== other;
  700. }
  701. var objectProto$b = Object.prototype;
  702. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  703. function assignValue(object4, key, value) {
  704. var objValue = object4[key];
  705. if (!(hasOwnProperty$a.call(object4, key) && eq(objValue, value)) || value === void 0 && !(key in object4)) {
  706. baseAssignValue(object4, key, value);
  707. }
  708. }
  709. function copyObject(source, props, object4, customizer) {
  710. var isNew = !object4;
  711. object4 || (object4 = {});
  712. var index = -1, length = props.length;
  713. while (++index < length) {
  714. var key = props[index];
  715. var newValue = customizer ? customizer(object4[key], source[key], key, object4, source) : void 0;
  716. if (newValue === void 0) {
  717. newValue = source[key];
  718. }
  719. if (isNew) {
  720. baseAssignValue(object4, key, newValue);
  721. } else {
  722. assignValue(object4, key, newValue);
  723. }
  724. }
  725. return object4;
  726. }
  727. var nativeMax$1 = Math.max;
  728. function overRest(func, start2, transform) {
  729. start2 = nativeMax$1(start2 === void 0 ? func.length - 1 : start2, 0);
  730. return function() {
  731. var args = arguments, index = -1, length = nativeMax$1(args.length - start2, 0), array4 = Array(length);
  732. while (++index < length) {
  733. array4[index] = args[start2 + index];
  734. }
  735. index = -1;
  736. var otherArgs = Array(start2 + 1);
  737. while (++index < start2) {
  738. otherArgs[index] = args[index];
  739. }
  740. otherArgs[start2] = transform(array4);
  741. return apply(func, this, otherArgs);
  742. };
  743. }
  744. function baseRest(func, start2) {
  745. return setToString$1(overRest(func, start2, identity), func + "");
  746. }
  747. var MAX_SAFE_INTEGER = 9007199254740991;
  748. function isLength(value) {
  749. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  750. }
  751. function isArrayLike(value) {
  752. return value != null && isLength(value.length) && !isFunction$1(value);
  753. }
  754. var objectProto$a = Object.prototype;
  755. function isPrototype(value) {
  756. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$a;
  757. return value === proto;
  758. }
  759. function baseTimes(n, iteratee) {
  760. var index = -1, result = Array(n);
  761. while (++index < n) {
  762. result[index] = iteratee(index);
  763. }
  764. return result;
  765. }
  766. var argsTag$3 = "[object Arguments]";
  767. function baseIsArguments(value) {
  768. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  769. }
  770. var objectProto$9 = Object.prototype;
  771. var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
  772. var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
  773. var isArguments = baseIsArguments(function() {
  774. return arguments;
  775. }()) ? baseIsArguments : function(value) {
  776. return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  777. };
  778. var isArguments$1 = isArguments;
  779. function stubFalse() {
  780. return false;
  781. }
  782. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  783. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  784. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  785. var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
  786. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  787. var isBuffer = nativeIsBuffer || stubFalse;
  788. var isBuffer$1 = isBuffer;
  789. var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$3 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
  790. var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
  791. var typedArrayTags = {};
  792. typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
  793. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
  794. function baseIsTypedArray(value) {
  795. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  796. }
  797. function baseUnary(func) {
  798. return function(value) {
  799. return func(value);
  800. };
  801. }
  802. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  803. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  804. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  805. var freeProcess = moduleExports$1 && freeGlobal$1.process;
  806. var nodeUtil = function() {
  807. try {
  808. var types2 = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  809. if (types2) {
  810. return types2;
  811. }
  812. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  813. } catch (e) {
  814. }
  815. }();
  816. var nodeUtil$1 = nodeUtil;
  817. var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
  818. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  819. var isTypedArray$1 = isTypedArray;
  820. var objectProto$8 = Object.prototype;
  821. var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
  822. function arrayLikeKeys(value, inherited) {
  823. var isArr = isArray$2(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  824. for (var key in value) {
  825. if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  826. result.push(key);
  827. }
  828. }
  829. return result;
  830. }
  831. function overArg(func, transform) {
  832. return function(arg) {
  833. return func(transform(arg));
  834. };
  835. }
  836. var nativeKeys = overArg(Object.keys, Object);
  837. var nativeKeys$1 = nativeKeys;
  838. var objectProto$7 = Object.prototype;
  839. var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
  840. function baseKeys(object4) {
  841. if (!isPrototype(object4)) {
  842. return nativeKeys$1(object4);
  843. }
  844. var result = [];
  845. for (var key in Object(object4)) {
  846. if (hasOwnProperty$7.call(object4, key) && key != "constructor") {
  847. result.push(key);
  848. }
  849. }
  850. return result;
  851. }
  852. function keys(object4) {
  853. return isArrayLike(object4) ? arrayLikeKeys(object4) : baseKeys(object4);
  854. }
  855. function nativeKeysIn(object4) {
  856. var result = [];
  857. if (object4 != null) {
  858. for (var key in Object(object4)) {
  859. result.push(key);
  860. }
  861. }
  862. return result;
  863. }
  864. var objectProto$6 = Object.prototype;
  865. var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
  866. function baseKeysIn(object4) {
  867. if (!isObject$2(object4)) {
  868. return nativeKeysIn(object4);
  869. }
  870. var isProto = isPrototype(object4), result = [];
  871. for (var key in object4) {
  872. if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object4, key)))) {
  873. result.push(key);
  874. }
  875. }
  876. return result;
  877. }
  878. function keysIn(object4) {
  879. return isArrayLike(object4) ? arrayLikeKeys(object4, true) : baseKeysIn(object4);
  880. }
  881. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  882. function isKey(value, object4) {
  883. if (isArray$2(value)) {
  884. return false;
  885. }
  886. var type4 = typeof value;
  887. if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value == null || isSymbol(value)) {
  888. return true;
  889. }
  890. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object4 != null && value in Object(object4);
  891. }
  892. var nativeCreate = getNative(Object, "create");
  893. var nativeCreate$1 = nativeCreate;
  894. function hashClear() {
  895. this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  896. this.size = 0;
  897. }
  898. function hashDelete(key) {
  899. var result = this.has(key) && delete this.__data__[key];
  900. this.size -= result ? 1 : 0;
  901. return result;
  902. }
  903. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  904. var objectProto$5 = Object.prototype;
  905. var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
  906. function hashGet(key) {
  907. var data2 = this.__data__;
  908. if (nativeCreate$1) {
  909. var result = data2[key];
  910. return result === HASH_UNDEFINED$2 ? void 0 : result;
  911. }
  912. return hasOwnProperty$5.call(data2, key) ? data2[key] : void 0;
  913. }
  914. var objectProto$4 = Object.prototype;
  915. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  916. function hashHas(key) {
  917. var data2 = this.__data__;
  918. return nativeCreate$1 ? data2[key] !== void 0 : hasOwnProperty$4.call(data2, key);
  919. }
  920. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  921. function hashSet(key, value) {
  922. var data2 = this.__data__;
  923. this.size += this.has(key) ? 0 : 1;
  924. data2[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
  925. return this;
  926. }
  927. function Hash(entries) {
  928. var index = -1, length = entries == null ? 0 : entries.length;
  929. this.clear();
  930. while (++index < length) {
  931. var entry = entries[index];
  932. this.set(entry[0], entry[1]);
  933. }
  934. }
  935. Hash.prototype.clear = hashClear;
  936. Hash.prototype["delete"] = hashDelete;
  937. Hash.prototype.get = hashGet;
  938. Hash.prototype.has = hashHas;
  939. Hash.prototype.set = hashSet;
  940. function listCacheClear() {
  941. this.__data__ = [];
  942. this.size = 0;
  943. }
  944. function assocIndexOf(array4, key) {
  945. var length = array4.length;
  946. while (length--) {
  947. if (eq(array4[length][0], key)) {
  948. return length;
  949. }
  950. }
  951. return -1;
  952. }
  953. var arrayProto = Array.prototype;
  954. var splice = arrayProto.splice;
  955. function listCacheDelete(key) {
  956. var data2 = this.__data__, index = assocIndexOf(data2, key);
  957. if (index < 0) {
  958. return false;
  959. }
  960. var lastIndex = data2.length - 1;
  961. if (index == lastIndex) {
  962. data2.pop();
  963. } else {
  964. splice.call(data2, index, 1);
  965. }
  966. --this.size;
  967. return true;
  968. }
  969. function listCacheGet(key) {
  970. var data2 = this.__data__, index = assocIndexOf(data2, key);
  971. return index < 0 ? void 0 : data2[index][1];
  972. }
  973. function listCacheHas(key) {
  974. return assocIndexOf(this.__data__, key) > -1;
  975. }
  976. function listCacheSet(key, value) {
  977. var data2 = this.__data__, index = assocIndexOf(data2, key);
  978. if (index < 0) {
  979. ++this.size;
  980. data2.push([key, value]);
  981. } else {
  982. data2[index][1] = value;
  983. }
  984. return this;
  985. }
  986. function ListCache(entries) {
  987. var index = -1, length = entries == null ? 0 : entries.length;
  988. this.clear();
  989. while (++index < length) {
  990. var entry = entries[index];
  991. this.set(entry[0], entry[1]);
  992. }
  993. }
  994. ListCache.prototype.clear = listCacheClear;
  995. ListCache.prototype["delete"] = listCacheDelete;
  996. ListCache.prototype.get = listCacheGet;
  997. ListCache.prototype.has = listCacheHas;
  998. ListCache.prototype.set = listCacheSet;
  999. var Map$1 = getNative(root$1, "Map");
  1000. var Map$2 = Map$1;
  1001. function mapCacheClear() {
  1002. this.size = 0;
  1003. this.__data__ = {
  1004. "hash": new Hash(),
  1005. "map": new (Map$2 || ListCache)(),
  1006. "string": new Hash()
  1007. };
  1008. }
  1009. function isKeyable(value) {
  1010. var type4 = typeof value;
  1011. return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value !== "__proto__" : value === null;
  1012. }
  1013. function getMapData(map, key) {
  1014. var data2 = map.__data__;
  1015. return isKeyable(key) ? data2[typeof key == "string" ? "string" : "hash"] : data2.map;
  1016. }
  1017. function mapCacheDelete(key) {
  1018. var result = getMapData(this, key)["delete"](key);
  1019. this.size -= result ? 1 : 0;
  1020. return result;
  1021. }
  1022. function mapCacheGet(key) {
  1023. return getMapData(this, key).get(key);
  1024. }
  1025. function mapCacheHas(key) {
  1026. return getMapData(this, key).has(key);
  1027. }
  1028. function mapCacheSet(key, value) {
  1029. var data2 = getMapData(this, key), size = data2.size;
  1030. data2.set(key, value);
  1031. this.size += data2.size == size ? 0 : 1;
  1032. return this;
  1033. }
  1034. function MapCache(entries) {
  1035. var index = -1, length = entries == null ? 0 : entries.length;
  1036. this.clear();
  1037. while (++index < length) {
  1038. var entry = entries[index];
  1039. this.set(entry[0], entry[1]);
  1040. }
  1041. }
  1042. MapCache.prototype.clear = mapCacheClear;
  1043. MapCache.prototype["delete"] = mapCacheDelete;
  1044. MapCache.prototype.get = mapCacheGet;
  1045. MapCache.prototype.has = mapCacheHas;
  1046. MapCache.prototype.set = mapCacheSet;
  1047. var FUNC_ERROR_TEXT$2 = "Expected a function";
  1048. function memoize(func, resolver) {
  1049. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1050. throw new TypeError(FUNC_ERROR_TEXT$2);
  1051. }
  1052. var memoized = function() {
  1053. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1054. if (cache.has(key)) {
  1055. return cache.get(key);
  1056. }
  1057. var result = func.apply(this, args);
  1058. memoized.cache = cache.set(key, result) || cache;
  1059. return result;
  1060. };
  1061. memoized.cache = new (memoize.Cache || MapCache)();
  1062. return memoized;
  1063. }
  1064. memoize.Cache = MapCache;
  1065. var MAX_MEMOIZE_SIZE = 500;
  1066. function memoizeCapped(func) {
  1067. var result = memoize(func, function(key) {
  1068. if (cache.size === MAX_MEMOIZE_SIZE) {
  1069. cache.clear();
  1070. }
  1071. return key;
  1072. });
  1073. var cache = result.cache;
  1074. return result;
  1075. }
  1076. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1077. var reEscapeChar = /\\(\\)?/g;
  1078. var stringToPath = memoizeCapped(function(string3) {
  1079. var result = [];
  1080. if (string3.charCodeAt(0) === 46) {
  1081. result.push("");
  1082. }
  1083. string3.replace(rePropName, function(match, number4, quote, subString) {
  1084. result.push(quote ? subString.replace(reEscapeChar, "$1") : number4 || match);
  1085. });
  1086. return result;
  1087. });
  1088. var stringToPath$1 = stringToPath;
  1089. function toString(value) {
  1090. return value == null ? "" : baseToString(value);
  1091. }
  1092. function castPath(value, object4) {
  1093. if (isArray$2(value)) {
  1094. return value;
  1095. }
  1096. return isKey(value, object4) ? [value] : stringToPath$1(toString(value));
  1097. }
  1098. var INFINITY$2 = 1 / 0;
  1099. function toKey(value) {
  1100. if (typeof value == "string" || isSymbol(value)) {
  1101. return value;
  1102. }
  1103. var result = value + "";
  1104. return result == "0" && 1 / value == -INFINITY$2 ? "-0" : result;
  1105. }
  1106. function baseGet(object4, path) {
  1107. path = castPath(path, object4);
  1108. var index = 0, length = path.length;
  1109. while (object4 != null && index < length) {
  1110. object4 = object4[toKey(path[index++])];
  1111. }
  1112. return index && index == length ? object4 : void 0;
  1113. }
  1114. function get(object4, path, defaultValue) {
  1115. var result = object4 == null ? void 0 : baseGet(object4, path);
  1116. return result === void 0 ? defaultValue : result;
  1117. }
  1118. function arrayPush(array4, values) {
  1119. var index = -1, length = values.length, offset2 = array4.length;
  1120. while (++index < length) {
  1121. array4[offset2 + index] = values[index];
  1122. }
  1123. return array4;
  1124. }
  1125. var spreadableSymbol = Symbol$2 ? Symbol$2.isConcatSpreadable : void 0;
  1126. function isFlattenable(value) {
  1127. return isArray$2(value) || isArguments$1(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  1128. }
  1129. function baseFlatten(array4, depth, predicate, isStrict, result) {
  1130. var index = -1, length = array4.length;
  1131. predicate || (predicate = isFlattenable);
  1132. result || (result = []);
  1133. while (++index < length) {
  1134. var value = array4[index];
  1135. if (depth > 0 && predicate(value)) {
  1136. if (depth > 1) {
  1137. baseFlatten(value, depth - 1, predicate, isStrict, result);
  1138. } else {
  1139. arrayPush(result, value);
  1140. }
  1141. } else if (!isStrict) {
  1142. result[result.length] = value;
  1143. }
  1144. }
  1145. return result;
  1146. }
  1147. var getPrototype = overArg(Object.getPrototypeOf, Object);
  1148. var getPrototype$1 = getPrototype;
  1149. function castArray$1() {
  1150. if (!arguments.length) {
  1151. return [];
  1152. }
  1153. var value = arguments[0];
  1154. return isArray$2(value) ? value : [value];
  1155. }
  1156. function stackClear() {
  1157. this.__data__ = new ListCache();
  1158. this.size = 0;
  1159. }
  1160. function stackDelete(key) {
  1161. var data2 = this.__data__, result = data2["delete"](key);
  1162. this.size = data2.size;
  1163. return result;
  1164. }
  1165. function stackGet(key) {
  1166. return this.__data__.get(key);
  1167. }
  1168. function stackHas(key) {
  1169. return this.__data__.has(key);
  1170. }
  1171. var LARGE_ARRAY_SIZE$1 = 200;
  1172. function stackSet(key, value) {
  1173. var data2 = this.__data__;
  1174. if (data2 instanceof ListCache) {
  1175. var pairs = data2.__data__;
  1176. if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
  1177. pairs.push([key, value]);
  1178. this.size = ++data2.size;
  1179. return this;
  1180. }
  1181. data2 = this.__data__ = new MapCache(pairs);
  1182. }
  1183. data2.set(key, value);
  1184. this.size = data2.size;
  1185. return this;
  1186. }
  1187. function Stack(entries) {
  1188. var data2 = this.__data__ = new ListCache(entries);
  1189. this.size = data2.size;
  1190. }
  1191. Stack.prototype.clear = stackClear;
  1192. Stack.prototype["delete"] = stackDelete;
  1193. Stack.prototype.get = stackGet;
  1194. Stack.prototype.has = stackHas;
  1195. Stack.prototype.set = stackSet;
  1196. function baseAssign(object4, source) {
  1197. return object4 && copyObject(source, keys(source), object4);
  1198. }
  1199. function baseAssignIn(object4, source) {
  1200. return object4 && copyObject(source, keysIn(source), object4);
  1201. }
  1202. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  1203. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  1204. var moduleExports = freeModule && freeModule.exports === freeExports;
  1205. var Buffer2 = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
  1206. function cloneBuffer(buffer, isDeep) {
  1207. if (isDeep) {
  1208. return buffer.slice();
  1209. }
  1210. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  1211. buffer.copy(result);
  1212. return result;
  1213. }
  1214. function arrayFilter(array4, predicate) {
  1215. var index = -1, length = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
  1216. while (++index < length) {
  1217. var value = array4[index];
  1218. if (predicate(value, index, array4)) {
  1219. result[resIndex++] = value;
  1220. }
  1221. }
  1222. return result;
  1223. }
  1224. function stubArray() {
  1225. return [];
  1226. }
  1227. var objectProto$3 = Object.prototype;
  1228. var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
  1229. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  1230. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object4) {
  1231. if (object4 == null) {
  1232. return [];
  1233. }
  1234. object4 = Object(object4);
  1235. return arrayFilter(nativeGetSymbols$1(object4), function(symbol) {
  1236. return propertyIsEnumerable.call(object4, symbol);
  1237. });
  1238. };
  1239. var getSymbols$1 = getSymbols;
  1240. function copySymbols(source, object4) {
  1241. return copyObject(source, getSymbols$1(source), object4);
  1242. }
  1243. var nativeGetSymbols = Object.getOwnPropertySymbols;
  1244. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object4) {
  1245. var result = [];
  1246. while (object4) {
  1247. arrayPush(result, getSymbols$1(object4));
  1248. object4 = getPrototype$1(object4);
  1249. }
  1250. return result;
  1251. };
  1252. var getSymbolsIn$1 = getSymbolsIn;
  1253. function copySymbolsIn(source, object4) {
  1254. return copyObject(source, getSymbolsIn$1(source), object4);
  1255. }
  1256. function baseGetAllKeys(object4, keysFunc, symbolsFunc) {
  1257. var result = keysFunc(object4);
  1258. return isArray$2(object4) ? result : arrayPush(result, symbolsFunc(object4));
  1259. }
  1260. function getAllKeys(object4) {
  1261. return baseGetAllKeys(object4, keys, getSymbols$1);
  1262. }
  1263. function getAllKeysIn(object4) {
  1264. return baseGetAllKeys(object4, keysIn, getSymbolsIn$1);
  1265. }
  1266. var DataView = getNative(root$1, "DataView");
  1267. var DataView$1 = DataView;
  1268. var Promise$1 = getNative(root$1, "Promise");
  1269. var Promise$2 = Promise$1;
  1270. var Set$1 = getNative(root$1, "Set");
  1271. var Set$2 = Set$1;
  1272. var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
  1273. var dataViewTag$3 = "[object DataView]";
  1274. var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$1);
  1275. var getTag = baseGetTag;
  1276. if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 || Map$2 && getTag(new Map$2()) != mapTag$4 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$4 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) {
  1277. getTag = function(value) {
  1278. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  1279. if (ctorString) {
  1280. switch (ctorString) {
  1281. case dataViewCtorString:
  1282. return dataViewTag$3;
  1283. case mapCtorString:
  1284. return mapTag$4;
  1285. case promiseCtorString:
  1286. return promiseTag;
  1287. case setCtorString:
  1288. return setTag$4;
  1289. case weakMapCtorString:
  1290. return weakMapTag$1;
  1291. }
  1292. }
  1293. return result;
  1294. };
  1295. }
  1296. var getTag$1 = getTag;
  1297. var objectProto$2 = Object.prototype;
  1298. var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
  1299. function initCloneArray(array4) {
  1300. var length = array4.length, result = new array4.constructor(length);
  1301. if (length && typeof array4[0] == "string" && hasOwnProperty$3.call(array4, "index")) {
  1302. result.index = array4.index;
  1303. result.input = array4.input;
  1304. }
  1305. return result;
  1306. }
  1307. var Uint8Array2 = root$1.Uint8Array;
  1308. var Uint8Array$1 = Uint8Array2;
  1309. function cloneArrayBuffer(arrayBuffer) {
  1310. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  1311. new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
  1312. return result;
  1313. }
  1314. function cloneDataView(dataView, isDeep) {
  1315. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  1316. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  1317. }
  1318. var reFlags = /\w*$/;
  1319. function cloneRegExp(regexp4) {
  1320. var result = new regexp4.constructor(regexp4.source, reFlags.exec(regexp4));
  1321. result.lastIndex = regexp4.lastIndex;
  1322. return result;
  1323. }
  1324. var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  1325. function cloneSymbol(symbol) {
  1326. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  1327. }
  1328. function cloneTypedArray(typedArray, isDeep) {
  1329. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  1330. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  1331. }
  1332. var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
  1333. var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
  1334. function initCloneByTag(object4, tag, isDeep) {
  1335. var Ctor = object4.constructor;
  1336. switch (tag) {
  1337. case arrayBufferTag$2:
  1338. return cloneArrayBuffer(object4);
  1339. case boolTag$2:
  1340. case dateTag$2:
  1341. return new Ctor(+object4);
  1342. case dataViewTag$2:
  1343. return cloneDataView(object4, isDeep);
  1344. case float32Tag$1:
  1345. case float64Tag$1:
  1346. case int8Tag$1:
  1347. case int16Tag$1:
  1348. case int32Tag$1:
  1349. case uint8Tag$1:
  1350. case uint8ClampedTag$1:
  1351. case uint16Tag$1:
  1352. case uint32Tag$1:
  1353. return cloneTypedArray(object4, isDeep);
  1354. case mapTag$3:
  1355. return new Ctor();
  1356. case numberTag$2:
  1357. case stringTag$2:
  1358. return new Ctor(object4);
  1359. case regexpTag$2:
  1360. return cloneRegExp(object4);
  1361. case setTag$3:
  1362. return new Ctor();
  1363. case symbolTag$2:
  1364. return cloneSymbol(object4);
  1365. }
  1366. }
  1367. function initCloneObject(object4) {
  1368. return typeof object4.constructor == "function" && !isPrototype(object4) ? baseCreate$1(getPrototype$1(object4)) : {};
  1369. }
  1370. var mapTag$2 = "[object Map]";
  1371. function baseIsMap(value) {
  1372. return isObjectLike(value) && getTag$1(value) == mapTag$2;
  1373. }
  1374. var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
  1375. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  1376. var isMap$1 = isMap;
  1377. var setTag$2 = "[object Set]";
  1378. function baseIsSet(value) {
  1379. return isObjectLike(value) && getTag$1(value) == setTag$2;
  1380. }
  1381. var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
  1382. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  1383. var isSet$1 = isSet;
  1384. var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$2 = 4;
  1385. var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
  1386. var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
  1387. var cloneableTags = {};
  1388. cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  1389. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
  1390. function baseClone(value, bitmask, customizer, key, object4, stack) {
  1391. var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
  1392. if (customizer) {
  1393. result = object4 ? customizer(value, key, object4, stack) : customizer(value);
  1394. }
  1395. if (result !== void 0) {
  1396. return result;
  1397. }
  1398. if (!isObject$2(value)) {
  1399. return value;
  1400. }
  1401. var isArr = isArray$2(value);
  1402. if (isArr) {
  1403. result = initCloneArray(value);
  1404. if (!isDeep) {
  1405. return copyArray(value, result);
  1406. }
  1407. } else {
  1408. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  1409. if (isBuffer$1(value)) {
  1410. return cloneBuffer(value, isDeep);
  1411. }
  1412. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object4) {
  1413. result = isFlat || isFunc ? {} : initCloneObject(value);
  1414. if (!isDeep) {
  1415. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  1416. }
  1417. } else {
  1418. if (!cloneableTags[tag]) {
  1419. return object4 ? value : {};
  1420. }
  1421. result = initCloneByTag(value, tag, isDeep);
  1422. }
  1423. }
  1424. stack || (stack = new Stack());
  1425. var stacked = stack.get(value);
  1426. if (stacked) {
  1427. return stacked;
  1428. }
  1429. stack.set(value, result);
  1430. if (isSet$1(value)) {
  1431. value.forEach(function(subValue) {
  1432. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  1433. });
  1434. } else if (isMap$1(value)) {
  1435. value.forEach(function(subValue, key2) {
  1436. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  1437. });
  1438. }
  1439. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  1440. var props = isArr ? void 0 : keysFunc(value);
  1441. arrayEach(props || value, function(subValue, key2) {
  1442. if (props) {
  1443. key2 = subValue;
  1444. subValue = value[key2];
  1445. }
  1446. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  1447. });
  1448. return result;
  1449. }
  1450. var CLONE_SYMBOLS_FLAG$1 = 4;
  1451. function clone(value) {
  1452. return baseClone(value, CLONE_SYMBOLS_FLAG$1);
  1453. }
  1454. var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
  1455. function cloneDeep(value) {
  1456. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  1457. }
  1458. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  1459. function setCacheAdd(value) {
  1460. this.__data__.set(value, HASH_UNDEFINED);
  1461. return this;
  1462. }
  1463. function setCacheHas(value) {
  1464. return this.__data__.has(value);
  1465. }
  1466. function SetCache(values) {
  1467. var index = -1, length = values == null ? 0 : values.length;
  1468. this.__data__ = new MapCache();
  1469. while (++index < length) {
  1470. this.add(values[index]);
  1471. }
  1472. }
  1473. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  1474. SetCache.prototype.has = setCacheHas;
  1475. function arraySome(array4, predicate) {
  1476. var index = -1, length = array4 == null ? 0 : array4.length;
  1477. while (++index < length) {
  1478. if (predicate(array4[index], index, array4)) {
  1479. return true;
  1480. }
  1481. }
  1482. return false;
  1483. }
  1484. function cacheHas(cache, key) {
  1485. return cache.has(key);
  1486. }
  1487. var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  1488. function equalArrays(array4, other, bitmask, customizer, equalFunc, stack) {
  1489. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array4.length, othLength = other.length;
  1490. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  1491. return false;
  1492. }
  1493. var arrStacked = stack.get(array4);
  1494. var othStacked = stack.get(other);
  1495. if (arrStacked && othStacked) {
  1496. return arrStacked == other && othStacked == array4;
  1497. }
  1498. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
  1499. stack.set(array4, other);
  1500. stack.set(other, array4);
  1501. while (++index < arrLength) {
  1502. var arrValue = array4[index], othValue = other[index];
  1503. if (customizer) {
  1504. var compared = isPartial ? customizer(othValue, arrValue, index, other, array4, stack) : customizer(arrValue, othValue, index, array4, other, stack);
  1505. }
  1506. if (compared !== void 0) {
  1507. if (compared) {
  1508. continue;
  1509. }
  1510. result = false;
  1511. break;
  1512. }
  1513. if (seen) {
  1514. if (!arraySome(other, function(othValue2, othIndex) {
  1515. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  1516. return seen.push(othIndex);
  1517. }
  1518. })) {
  1519. result = false;
  1520. break;
  1521. }
  1522. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  1523. result = false;
  1524. break;
  1525. }
  1526. }
  1527. stack["delete"](array4);
  1528. stack["delete"](other);
  1529. return result;
  1530. }
  1531. function mapToArray(map) {
  1532. var index = -1, result = Array(map.size);
  1533. map.forEach(function(value, key) {
  1534. result[++index] = [key, value];
  1535. });
  1536. return result;
  1537. }
  1538. function setToArray(set2) {
  1539. var index = -1, result = Array(set2.size);
  1540. set2.forEach(function(value) {
  1541. result[++index] = value;
  1542. });
  1543. return result;
  1544. }
  1545. var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
  1546. var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
  1547. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  1548. var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  1549. function equalByTag(object4, other, tag, bitmask, customizer, equalFunc, stack) {
  1550. switch (tag) {
  1551. case dataViewTag:
  1552. if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
  1553. return false;
  1554. }
  1555. object4 = object4.buffer;
  1556. other = other.buffer;
  1557. case arrayBufferTag:
  1558. if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object4), new Uint8Array$1(other))) {
  1559. return false;
  1560. }
  1561. return true;
  1562. case boolTag:
  1563. case dateTag:
  1564. case numberTag:
  1565. return eq(+object4, +other);
  1566. case errorTag:
  1567. return object4.name == other.name && object4.message == other.message;
  1568. case regexpTag:
  1569. case stringTag:
  1570. return object4 == other + "";
  1571. case mapTag:
  1572. var convert = mapToArray;
  1573. case setTag:
  1574. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
  1575. convert || (convert = setToArray);
  1576. if (object4.size != other.size && !isPartial) {
  1577. return false;
  1578. }
  1579. var stacked = stack.get(object4);
  1580. if (stacked) {
  1581. return stacked == other;
  1582. }
  1583. bitmask |= COMPARE_UNORDERED_FLAG;
  1584. stack.set(object4, other);
  1585. var result = equalArrays(convert(object4), convert(other), bitmask, customizer, equalFunc, stack);
  1586. stack["delete"](object4);
  1587. return result;
  1588. case symbolTag:
  1589. if (symbolValueOf) {
  1590. return symbolValueOf.call(object4) == symbolValueOf.call(other);
  1591. }
  1592. }
  1593. return false;
  1594. }
  1595. var COMPARE_PARTIAL_FLAG$1 = 1;
  1596. var objectProto$1 = Object.prototype;
  1597. var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
  1598. function equalObjects(object4, other, bitmask, customizer, equalFunc, stack) {
  1599. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object4), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  1600. if (objLength != othLength && !isPartial) {
  1601. return false;
  1602. }
  1603. var index = objLength;
  1604. while (index--) {
  1605. var key = objProps[index];
  1606. if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
  1607. return false;
  1608. }
  1609. }
  1610. var objStacked = stack.get(object4);
  1611. var othStacked = stack.get(other);
  1612. if (objStacked && othStacked) {
  1613. return objStacked == other && othStacked == object4;
  1614. }
  1615. var result = true;
  1616. stack.set(object4, other);
  1617. stack.set(other, object4);
  1618. var skipCtor = isPartial;
  1619. while (++index < objLength) {
  1620. key = objProps[index];
  1621. var objValue = object4[key], othValue = other[key];
  1622. if (customizer) {
  1623. var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
  1624. }
  1625. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  1626. result = false;
  1627. break;
  1628. }
  1629. skipCtor || (skipCtor = key == "constructor");
  1630. }
  1631. if (result && !skipCtor) {
  1632. var objCtor = object4.constructor, othCtor = other.constructor;
  1633. if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  1634. result = false;
  1635. }
  1636. }
  1637. stack["delete"](object4);
  1638. stack["delete"](other);
  1639. return result;
  1640. }
  1641. var COMPARE_PARTIAL_FLAG = 1;
  1642. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  1643. var objectProto = Object.prototype;
  1644. var hasOwnProperty$1 = objectProto.hasOwnProperty;
  1645. function baseIsEqualDeep(object4, other, bitmask, customizer, equalFunc, stack) {
  1646. var objIsArr = isArray$2(object4), othIsArr = isArray$2(other), objTag = objIsArr ? arrayTag : getTag$1(object4), othTag = othIsArr ? arrayTag : getTag$1(other);
  1647. objTag = objTag == argsTag ? objectTag : objTag;
  1648. othTag = othTag == argsTag ? objectTag : othTag;
  1649. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  1650. if (isSameTag && isBuffer$1(object4)) {
  1651. if (!isBuffer$1(other)) {
  1652. return false;
  1653. }
  1654. objIsArr = true;
  1655. objIsObj = false;
  1656. }
  1657. if (isSameTag && !objIsObj) {
  1658. stack || (stack = new Stack());
  1659. return objIsArr || isTypedArray$1(object4) ? equalArrays(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag(object4, other, objTag, bitmask, customizer, equalFunc, stack);
  1660. }
  1661. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  1662. var objIsWrapped = objIsObj && hasOwnProperty$1.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
  1663. if (objIsWrapped || othIsWrapped) {
  1664. var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
  1665. stack || (stack = new Stack());
  1666. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  1667. }
  1668. }
  1669. if (!isSameTag) {
  1670. return false;
  1671. }
  1672. stack || (stack = new Stack());
  1673. return equalObjects(object4, other, bitmask, customizer, equalFunc, stack);
  1674. }
  1675. function baseIsEqual(value, other, bitmask, customizer, stack) {
  1676. if (value === other) {
  1677. return true;
  1678. }
  1679. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  1680. return value !== value && other !== other;
  1681. }
  1682. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  1683. }
  1684. var now = function() {
  1685. return root$1.Date.now();
  1686. };
  1687. var now$1 = now;
  1688. var FUNC_ERROR_TEXT$1 = "Expected a function";
  1689. var nativeMax = Math.max, nativeMin = Math.min;
  1690. function debounce$1(func, wait, options) {
  1691. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  1692. if (typeof func != "function") {
  1693. throw new TypeError(FUNC_ERROR_TEXT$1);
  1694. }
  1695. wait = toNumber(wait) || 0;
  1696. if (isObject$2(options)) {
  1697. leading = !!options.leading;
  1698. maxing = "maxWait" in options;
  1699. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  1700. trailing = "trailing" in options ? !!options.trailing : trailing;
  1701. }
  1702. function invokeFunc(time) {
  1703. var args = lastArgs, thisArg = lastThis;
  1704. lastArgs = lastThis = void 0;
  1705. lastInvokeTime = time;
  1706. result = func.apply(thisArg, args);
  1707. return result;
  1708. }
  1709. function leadingEdge(time) {
  1710. lastInvokeTime = time;
  1711. timerId = setTimeout(timerExpired, wait);
  1712. return leading ? invokeFunc(time) : result;
  1713. }
  1714. function remainingWait(time) {
  1715. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  1716. return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  1717. }
  1718. function shouldInvoke(time) {
  1719. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  1720. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  1721. }
  1722. function timerExpired() {
  1723. var time = now$1();
  1724. if (shouldInvoke(time)) {
  1725. return trailingEdge(time);
  1726. }
  1727. timerId = setTimeout(timerExpired, remainingWait(time));
  1728. }
  1729. function trailingEdge(time) {
  1730. timerId = void 0;
  1731. if (trailing && lastArgs) {
  1732. return invokeFunc(time);
  1733. }
  1734. lastArgs = lastThis = void 0;
  1735. return result;
  1736. }
  1737. function cancel() {
  1738. if (timerId !== void 0) {
  1739. clearTimeout(timerId);
  1740. }
  1741. lastInvokeTime = 0;
  1742. lastArgs = lastCallTime = lastThis = timerId = void 0;
  1743. }
  1744. function flush() {
  1745. return timerId === void 0 ? result : trailingEdge(now$1());
  1746. }
  1747. function debounced() {
  1748. var time = now$1(), isInvoking = shouldInvoke(time);
  1749. lastArgs = arguments;
  1750. lastThis = this;
  1751. lastCallTime = time;
  1752. if (isInvoking) {
  1753. if (timerId === void 0) {
  1754. return leadingEdge(lastCallTime);
  1755. }
  1756. if (maxing) {
  1757. clearTimeout(timerId);
  1758. timerId = setTimeout(timerExpired, wait);
  1759. return invokeFunc(lastCallTime);
  1760. }
  1761. }
  1762. if (timerId === void 0) {
  1763. timerId = setTimeout(timerExpired, wait);
  1764. }
  1765. return result;
  1766. }
  1767. debounced.cancel = cancel;
  1768. debounced.flush = flush;
  1769. return debounced;
  1770. }
  1771. function isArrayLikeObject(value) {
  1772. return isObjectLike(value) && isArrayLike(value);
  1773. }
  1774. function arrayIncludesWith(array4, value, comparator) {
  1775. var index = -1, length = array4 == null ? 0 : array4.length;
  1776. while (++index < length) {
  1777. if (comparator(value, array4[index])) {
  1778. return true;
  1779. }
  1780. }
  1781. return false;
  1782. }
  1783. var INFINITY$1 = 1 / 0;
  1784. function flattenDeep(array4) {
  1785. var length = array4 == null ? 0 : array4.length;
  1786. return length ? baseFlatten(array4, INFINITY$1) : [];
  1787. }
  1788. function fromPairs(pairs) {
  1789. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  1790. while (++index < length) {
  1791. var pair = pairs[index];
  1792. result[pair[0]] = pair[1];
  1793. }
  1794. return result;
  1795. }
  1796. function isEqual(value, other) {
  1797. return baseIsEqual(value, other);
  1798. }
  1799. function isNil(value) {
  1800. return value == null;
  1801. }
  1802. function baseSet(object4, path, value, customizer) {
  1803. if (!isObject$2(object4)) {
  1804. return object4;
  1805. }
  1806. path = castPath(path, object4);
  1807. var index = -1, length = path.length, lastIndex = length - 1, nested = object4;
  1808. while (nested != null && ++index < length) {
  1809. var key = toKey(path[index]), newValue = value;
  1810. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  1811. return object4;
  1812. }
  1813. if (index != lastIndex) {
  1814. var objValue = nested[key];
  1815. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  1816. if (newValue === void 0) {
  1817. newValue = isObject$2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  1818. }
  1819. }
  1820. assignValue(nested, key, newValue);
  1821. nested = nested[key];
  1822. }
  1823. return object4;
  1824. }
  1825. function set(object4, path, value) {
  1826. return object4 == null ? object4 : baseSet(object4, path, value);
  1827. }
  1828. var FUNC_ERROR_TEXT = "Expected a function";
  1829. function throttle(func, wait, options) {
  1830. var leading = true, trailing = true;
  1831. if (typeof func != "function") {
  1832. throw new TypeError(FUNC_ERROR_TEXT);
  1833. }
  1834. if (isObject$2(options)) {
  1835. leading = "leading" in options ? !!options.leading : leading;
  1836. trailing = "trailing" in options ? !!options.trailing : trailing;
  1837. }
  1838. return debounce$1(func, wait, {
  1839. "leading": leading,
  1840. "maxWait": wait,
  1841. "trailing": trailing
  1842. });
  1843. }
  1844. var INFINITY = 1 / 0;
  1845. var createSet = !(Set$2 && 1 / setToArray(new Set$2([, -0]))[1] == INFINITY) ? noop$1 : function(values) {
  1846. return new Set$2(values);
  1847. };
  1848. var createSet$1 = createSet;
  1849. var LARGE_ARRAY_SIZE = 200;
  1850. function baseUniq(array4, iteratee, comparator) {
  1851. var index = -1, includes = arrayIncludes, length = array4.length, isCommon = true, result = [], seen = result;
  1852. if (comparator) {
  1853. isCommon = false;
  1854. includes = arrayIncludesWith;
  1855. } else if (length >= LARGE_ARRAY_SIZE) {
  1856. var set2 = iteratee ? null : createSet$1(array4);
  1857. if (set2) {
  1858. return setToArray(set2);
  1859. }
  1860. isCommon = false;
  1861. includes = cacheHas;
  1862. seen = new SetCache();
  1863. } else {
  1864. seen = iteratee ? [] : result;
  1865. }
  1866. outer:
  1867. while (++index < length) {
  1868. var value = array4[index], computed2 = iteratee ? iteratee(value) : value;
  1869. value = comparator || value !== 0 ? value : 0;
  1870. if (isCommon && computed2 === computed2) {
  1871. var seenIndex = seen.length;
  1872. while (seenIndex--) {
  1873. if (seen[seenIndex] === computed2) {
  1874. continue outer;
  1875. }
  1876. }
  1877. if (iteratee) {
  1878. seen.push(computed2);
  1879. }
  1880. result.push(value);
  1881. } else if (!includes(seen, computed2, comparator)) {
  1882. if (seen !== result) {
  1883. seen.push(computed2);
  1884. }
  1885. result.push(value);
  1886. }
  1887. }
  1888. return result;
  1889. }
  1890. var union = baseRest(function(arrays) {
  1891. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  1892. });
  1893. var union$1 = union;
  1894. const isLeaf = (el) => !el.getAttribute("aria-owns");
  1895. const getSibling = (el, distance, elClass) => {
  1896. const { parentNode } = el;
  1897. if (!parentNode)
  1898. return null;
  1899. const siblings = parentNode.querySelectorAll(elClass);
  1900. const index = Array.prototype.indexOf.call(siblings, el);
  1901. return siblings[index + distance] || null;
  1902. };
  1903. const focusNode = (el) => {
  1904. if (!el)
  1905. return;
  1906. el.focus();
  1907. !isLeaf(el) && el.click();
  1908. };
  1909. const on = (element, event, handler3, useCapture = false) => {
  1910. if (element && event && handler3) {
  1911. element == null ? void 0 : element.addEventListener(event, handler3, useCapture);
  1912. }
  1913. };
  1914. const off = (element, event, handler3, useCapture = false) => {
  1915. if (element && event && handler3) {
  1916. element == null ? void 0 : element.removeEventListener(event, handler3, useCapture);
  1917. }
  1918. };
  1919. const once = (el, event, fn2) => {
  1920. const listener = function(...args) {
  1921. if (fn2) {
  1922. fn2.apply(this, args);
  1923. }
  1924. off(el, event, listener);
  1925. };
  1926. on(el, event, listener);
  1927. };
  1928. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  1929. const handleEvent = (event) => {
  1930. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  1931. if (checkForDefaultPrevented === false || !shouldPrevent) {
  1932. return oursHandler == null ? void 0 : oursHandler(event);
  1933. }
  1934. };
  1935. return handleEvent;
  1936. };
  1937. function tryOnScopeDispose(fn2) {
  1938. if (getCurrentScope()) {
  1939. onScopeDispose(fn2);
  1940. return true;
  1941. }
  1942. return false;
  1943. }
  1944. const isClient$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 keysOf = (arr) => Object.keys(arr);
  2277. const entriesOf = (arr) => Object.entries(arr);
  2278. const getProp = (obj, path, defaultValue) => {
  2279. return {
  2280. get value() {
  2281. return get(obj, path, defaultValue);
  2282. },
  2283. set value(val) {
  2284. set(obj, path, val);
  2285. }
  2286. };
  2287. };
  2288. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  2289. const hasClass = (el, cls) => {
  2290. if (!el || !cls)
  2291. return false;
  2292. if (cls.includes(" "))
  2293. throw new Error("className should not contain space.");
  2294. return el.classList.contains(cls);
  2295. };
  2296. const addClass = (el, cls) => {
  2297. if (!el || !cls.trim())
  2298. return;
  2299. el.classList.add(...classNameToArray(cls));
  2300. };
  2301. const removeClass = (el, cls) => {
  2302. if (!el || !cls.trim())
  2303. return;
  2304. el.classList.remove(...classNameToArray(cls));
  2305. };
  2306. const getStyle = (element, styleName) => {
  2307. var _a2;
  2308. if (!isClient$1 || !element || !styleName)
  2309. return "";
  2310. camelize(styleName);
  2311. try {
  2312. const style = element.style[styleName];
  2313. if (style)
  2314. return style;
  2315. const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
  2316. return computed2 ? computed2[styleName] : "";
  2317. } catch (e) {
  2318. return element.style[styleName];
  2319. }
  2320. };
  2321. const isScroll = (el, isVertical) => {
  2322. if (!isClient$1)
  2323. return false;
  2324. const key = {
  2325. undefined: "overflow",
  2326. true: "overflow-y",
  2327. false: "overflow-x"
  2328. }[String(isVertical)];
  2329. const overflow = getStyle(el, key);
  2330. return ["scroll", "auto", "overlay"].some((s2) => overflow.includes(s2));
  2331. };
  2332. const getScrollContainer = (el, isVertical) => {
  2333. if (!isClient$1)
  2334. return;
  2335. let parent = el;
  2336. while (parent) {
  2337. if ([window, document, document.documentElement].includes(parent))
  2338. return window;
  2339. if (isScroll(parent, isVertical))
  2340. return parent;
  2341. parent = parent.parentNode;
  2342. }
  2343. return parent;
  2344. };
  2345. let scrollBarWidth;
  2346. const getScrollBarWidth = () => {
  2347. var _a2;
  2348. if (!isClient$1)
  2349. return 0;
  2350. if (scrollBarWidth !== void 0)
  2351. return scrollBarWidth;
  2352. const outer = document.createElement("div");
  2353. outer.className = "el-scrollbar__wrap";
  2354. outer.style.visibility = "hidden";
  2355. outer.style.width = "100px";
  2356. outer.style.position = "absolute";
  2357. outer.style.top = "-9999px";
  2358. document.body.appendChild(outer);
  2359. const widthNoScroll = outer.offsetWidth;
  2360. outer.style.overflow = "scroll";
  2361. const inner = document.createElement("div");
  2362. inner.style.width = "100%";
  2363. outer.appendChild(inner);
  2364. const widthWithScroll = inner.offsetWidth;
  2365. (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
  2366. scrollBarWidth = widthNoScroll - widthWithScroll;
  2367. return scrollBarWidth;
  2368. };
  2369. function scrollIntoView(container, selected) {
  2370. if (!isClient$1)
  2371. return;
  2372. if (!selected) {
  2373. container.scrollTop = 0;
  2374. return;
  2375. }
  2376. const offsetParents = [];
  2377. let pointer = selected.offsetParent;
  2378. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  2379. offsetParents.push(pointer);
  2380. pointer = pointer.offsetParent;
  2381. }
  2382. const top2 = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  2383. const bottom2 = top2 + selected.offsetHeight;
  2384. const viewRectTop = container.scrollTop;
  2385. const viewRectBottom = viewRectTop + container.clientHeight;
  2386. if (top2 < viewRectTop) {
  2387. container.scrollTop = top2;
  2388. } else if (bottom2 > viewRectBottom) {
  2389. container.scrollTop = bottom2 - container.clientHeight;
  2390. }
  2391. }
  2392. var _export_sfc$2 = (sfc, props) => {
  2393. const target = sfc.__vccOpts || sfc;
  2394. for (const [key, val] of props) {
  2395. target[key] = val;
  2396. }
  2397. return target;
  2398. };
  2399. const _sfc_main$1x = defineComponent({
  2400. name: "ArrowDown"
  2401. });
  2402. const _hoisted_1$12 = {
  2403. viewBox: "0 0 1024 1024",
  2404. xmlns: "http://www.w3.org/2000/svg"
  2405. };
  2406. const _hoisted_2$V = /* @__PURE__ */ createElementVNode("path", {
  2407. fill: "currentColor",
  2408. 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"
  2409. }, null, -1);
  2410. const _hoisted_3$I = [
  2411. _hoisted_2$V
  2412. ];
  2413. function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
  2414. return openBlock(), createElementBlock("svg", _hoisted_1$12, _hoisted_3$I);
  2415. }
  2416. var arrowDown = /* @__PURE__ */ _export_sfc$2(_sfc_main$1x, [["render", _sfc_render$13]]);
  2417. const _sfc_main$1w = defineComponent({
  2418. name: "ArrowLeft"
  2419. });
  2420. const _hoisted_1$11 = {
  2421. viewBox: "0 0 1024 1024",
  2422. xmlns: "http://www.w3.org/2000/svg"
  2423. };
  2424. const _hoisted_2$U = /* @__PURE__ */ createElementVNode("path", {
  2425. fill: "currentColor",
  2426. 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"
  2427. }, null, -1);
  2428. const _hoisted_3$H = [
  2429. _hoisted_2$U
  2430. ];
  2431. function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
  2432. return openBlock(), createElementBlock("svg", _hoisted_1$11, _hoisted_3$H);
  2433. }
  2434. var arrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1w, [["render", _sfc_render$12]]);
  2435. const _sfc_main$1v = defineComponent({
  2436. name: "ArrowRight"
  2437. });
  2438. const _hoisted_1$10 = {
  2439. viewBox: "0 0 1024 1024",
  2440. xmlns: "http://www.w3.org/2000/svg"
  2441. };
  2442. const _hoisted_2$T = /* @__PURE__ */ createElementVNode("path", {
  2443. fill: "currentColor",
  2444. 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"
  2445. }, null, -1);
  2446. const _hoisted_3$G = [
  2447. _hoisted_2$T
  2448. ];
  2449. function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
  2450. return openBlock(), createElementBlock("svg", _hoisted_1$10, _hoisted_3$G);
  2451. }
  2452. var arrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1v, [["render", _sfc_render$11]]);
  2453. const _sfc_main$1u = defineComponent({
  2454. name: "ArrowUp"
  2455. });
  2456. const _hoisted_1$$ = {
  2457. viewBox: "0 0 1024 1024",
  2458. xmlns: "http://www.w3.org/2000/svg"
  2459. };
  2460. const _hoisted_2$S = /* @__PURE__ */ createElementVNode("path", {
  2461. fill: "currentColor",
  2462. 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"
  2463. }, null, -1);
  2464. const _hoisted_3$F = [
  2465. _hoisted_2$S
  2466. ];
  2467. function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
  2468. return openBlock(), createElementBlock("svg", _hoisted_1$$, _hoisted_3$F);
  2469. }
  2470. var arrowUp = /* @__PURE__ */ _export_sfc$2(_sfc_main$1u, [["render", _sfc_render$10]]);
  2471. const _sfc_main$1t = defineComponent({
  2472. name: "Calendar"
  2473. });
  2474. const _hoisted_1$_ = {
  2475. viewBox: "0 0 1024 1024",
  2476. xmlns: "http://www.w3.org/2000/svg"
  2477. };
  2478. const _hoisted_2$R = /* @__PURE__ */ createElementVNode("path", {
  2479. fill: "currentColor",
  2480. 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"
  2481. }, null, -1);
  2482. const _hoisted_3$E = [
  2483. _hoisted_2$R
  2484. ];
  2485. function _sfc_render$$(_ctx, _cache, $props, $setup, $data, $options) {
  2486. return openBlock(), createElementBlock("svg", _hoisted_1$_, _hoisted_3$E);
  2487. }
  2488. var calendar = /* @__PURE__ */ _export_sfc$2(_sfc_main$1t, [["render", _sfc_render$$]]);
  2489. const _sfc_main$1s = defineComponent({
  2490. name: "Check"
  2491. });
  2492. const _hoisted_1$Z = {
  2493. viewBox: "0 0 1024 1024",
  2494. xmlns: "http://www.w3.org/2000/svg"
  2495. };
  2496. const _hoisted_2$Q = /* @__PURE__ */ createElementVNode("path", {
  2497. fill: "currentColor",
  2498. 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"
  2499. }, null, -1);
  2500. const _hoisted_3$D = [
  2501. _hoisted_2$Q
  2502. ];
  2503. function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
  2504. return openBlock(), createElementBlock("svg", _hoisted_1$Z, _hoisted_3$D);
  2505. }
  2506. var check = /* @__PURE__ */ _export_sfc$2(_sfc_main$1s, [["render", _sfc_render$_]]);
  2507. const _sfc_main$1r = defineComponent({
  2508. name: "CircleCheck"
  2509. });
  2510. const _hoisted_1$Y = {
  2511. viewBox: "0 0 1024 1024",
  2512. xmlns: "http://www.w3.org/2000/svg"
  2513. };
  2514. const _hoisted_2$P = /* @__PURE__ */ createElementVNode("path", {
  2515. fill: "currentColor",
  2516. 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"
  2517. }, null, -1);
  2518. const _hoisted_3$C = /* @__PURE__ */ createElementVNode("path", {
  2519. fill: "currentColor",
  2520. 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"
  2521. }, null, -1);
  2522. const _hoisted_4$h = [
  2523. _hoisted_2$P,
  2524. _hoisted_3$C
  2525. ];
  2526. function _sfc_render$Z(_ctx, _cache, $props, $setup, $data, $options) {
  2527. return openBlock(), createElementBlock("svg", _hoisted_1$Y, _hoisted_4$h);
  2528. }
  2529. var circleCheck = /* @__PURE__ */ _export_sfc$2(_sfc_main$1r, [["render", _sfc_render$Z]]);
  2530. const _sfc_main$1q = defineComponent({
  2531. name: "CircleClose"
  2532. });
  2533. const _hoisted_1$X = {
  2534. viewBox: "0 0 1024 1024",
  2535. xmlns: "http://www.w3.org/2000/svg"
  2536. };
  2537. const _hoisted_2$O = /* @__PURE__ */ createElementVNode("path", {
  2538. fill: "currentColor",
  2539. 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"
  2540. }, null, -1);
  2541. const _hoisted_3$B = /* @__PURE__ */ createElementVNode("path", {
  2542. fill: "currentColor",
  2543. 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"
  2544. }, null, -1);
  2545. const _hoisted_4$g = [
  2546. _hoisted_2$O,
  2547. _hoisted_3$B
  2548. ];
  2549. function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
  2550. return openBlock(), createElementBlock("svg", _hoisted_1$X, _hoisted_4$g);
  2551. }
  2552. var circleClose = /* @__PURE__ */ _export_sfc$2(_sfc_main$1q, [["render", _sfc_render$Y]]);
  2553. const _sfc_main$1p = defineComponent({
  2554. name: "Clock"
  2555. });
  2556. const _hoisted_1$W = {
  2557. viewBox: "0 0 1024 1024",
  2558. xmlns: "http://www.w3.org/2000/svg"
  2559. };
  2560. const _hoisted_2$N = /* @__PURE__ */ createElementVNode("path", {
  2561. fill: "currentColor",
  2562. 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"
  2563. }, null, -1);
  2564. const _hoisted_3$A = /* @__PURE__ */ createElementVNode("path", {
  2565. fill: "currentColor",
  2566. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
  2567. }, null, -1);
  2568. const _hoisted_4$f = /* @__PURE__ */ createElementVNode("path", {
  2569. fill: "currentColor",
  2570. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z"
  2571. }, null, -1);
  2572. const _hoisted_5$c = [
  2573. _hoisted_2$N,
  2574. _hoisted_3$A,
  2575. _hoisted_4$f
  2576. ];
  2577. function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
  2578. return openBlock(), createElementBlock("svg", _hoisted_1$W, _hoisted_5$c);
  2579. }
  2580. var clock = /* @__PURE__ */ _export_sfc$2(_sfc_main$1p, [["render", _sfc_render$X]]);
  2581. const _sfc_main$1o = defineComponent({
  2582. name: "Close"
  2583. });
  2584. const _hoisted_1$V = {
  2585. viewBox: "0 0 1024 1024",
  2586. xmlns: "http://www.w3.org/2000/svg"
  2587. };
  2588. const _hoisted_2$M = /* @__PURE__ */ createElementVNode("path", {
  2589. fill: "currentColor",
  2590. 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"
  2591. }, null, -1);
  2592. const _hoisted_3$z = [
  2593. _hoisted_2$M
  2594. ];
  2595. function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
  2596. return openBlock(), createElementBlock("svg", _hoisted_1$V, _hoisted_3$z);
  2597. }
  2598. var close = /* @__PURE__ */ _export_sfc$2(_sfc_main$1o, [["render", _sfc_render$W]]);
  2599. const _sfc_main$1n = defineComponent({
  2600. name: "DArrowLeft"
  2601. });
  2602. const _hoisted_1$U = {
  2603. viewBox: "0 0 1024 1024",
  2604. xmlns: "http://www.w3.org/2000/svg"
  2605. };
  2606. const _hoisted_2$L = /* @__PURE__ */ createElementVNode("path", {
  2607. fill: "currentColor",
  2608. 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"
  2609. }, null, -1);
  2610. const _hoisted_3$y = [
  2611. _hoisted_2$L
  2612. ];
  2613. function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
  2614. return openBlock(), createElementBlock("svg", _hoisted_1$U, _hoisted_3$y);
  2615. }
  2616. var dArrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1n, [["render", _sfc_render$V]]);
  2617. const _sfc_main$1m = defineComponent({
  2618. name: "DArrowRight"
  2619. });
  2620. const _hoisted_1$T = {
  2621. viewBox: "0 0 1024 1024",
  2622. xmlns: "http://www.w3.org/2000/svg"
  2623. };
  2624. const _hoisted_2$K = /* @__PURE__ */ createElementVNode("path", {
  2625. fill: "currentColor",
  2626. 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"
  2627. }, null, -1);
  2628. const _hoisted_3$x = [
  2629. _hoisted_2$K
  2630. ];
  2631. function _sfc_render$U(_ctx, _cache, $props, $setup, $data, $options) {
  2632. return openBlock(), createElementBlock("svg", _hoisted_1$T, _hoisted_3$x);
  2633. }
  2634. var dArrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1m, [["render", _sfc_render$U]]);
  2635. const _sfc_main$1l = defineComponent({
  2636. name: "Delete"
  2637. });
  2638. const _hoisted_1$S = {
  2639. viewBox: "0 0 1024 1024",
  2640. xmlns: "http://www.w3.org/2000/svg"
  2641. };
  2642. const _hoisted_2$J = /* @__PURE__ */ createElementVNode("path", {
  2643. fill: "currentColor",
  2644. 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"
  2645. }, null, -1);
  2646. const _hoisted_3$w = [
  2647. _hoisted_2$J
  2648. ];
  2649. function _sfc_render$T(_ctx, _cache, $props, $setup, $data, $options) {
  2650. return openBlock(), createElementBlock("svg", _hoisted_1$S, _hoisted_3$w);
  2651. }
  2652. var _delete = /* @__PURE__ */ _export_sfc$2(_sfc_main$1l, [["render", _sfc_render$T]]);
  2653. const _sfc_main$1k = defineComponent({
  2654. name: "Document"
  2655. });
  2656. const _hoisted_1$R = {
  2657. viewBox: "0 0 1024 1024",
  2658. xmlns: "http://www.w3.org/2000/svg"
  2659. };
  2660. const _hoisted_2$I = /* @__PURE__ */ createElementVNode("path", {
  2661. fill: "currentColor",
  2662. 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"
  2663. }, null, -1);
  2664. const _hoisted_3$v = [
  2665. _hoisted_2$I
  2666. ];
  2667. function _sfc_render$S(_ctx, _cache, $props, $setup, $data, $options) {
  2668. return openBlock(), createElementBlock("svg", _hoisted_1$R, _hoisted_3$v);
  2669. }
  2670. var document$1 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1k, [["render", _sfc_render$S]]);
  2671. const _sfc_main$1j = defineComponent({
  2672. name: "FullScreen"
  2673. });
  2674. const _hoisted_1$Q = {
  2675. viewBox: "0 0 1024 1024",
  2676. xmlns: "http://www.w3.org/2000/svg"
  2677. };
  2678. const _hoisted_2$H = /* @__PURE__ */ createElementVNode("path", {
  2679. fill: "currentColor",
  2680. 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"
  2681. }, null, -1);
  2682. const _hoisted_3$u = [
  2683. _hoisted_2$H
  2684. ];
  2685. function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
  2686. return openBlock(), createElementBlock("svg", _hoisted_1$Q, _hoisted_3$u);
  2687. }
  2688. var fullScreen = /* @__PURE__ */ _export_sfc$2(_sfc_main$1j, [["render", _sfc_render$R]]);
  2689. const _sfc_main$1i = defineComponent({
  2690. name: "Hide"
  2691. });
  2692. const _hoisted_1$P = {
  2693. viewBox: "0 0 1024 1024",
  2694. xmlns: "http://www.w3.org/2000/svg"
  2695. };
  2696. const _hoisted_2$G = /* @__PURE__ */ createElementVNode("path", {
  2697. 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",
  2698. fill: "currentColor"
  2699. }, null, -1);
  2700. const _hoisted_3$t = /* @__PURE__ */ createElementVNode("path", {
  2701. 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",
  2702. fill: "currentColor"
  2703. }, null, -1);
  2704. const _hoisted_4$e = [
  2705. _hoisted_2$G,
  2706. _hoisted_3$t
  2707. ];
  2708. function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
  2709. return openBlock(), createElementBlock("svg", _hoisted_1$P, _hoisted_4$e);
  2710. }
  2711. var hide$2 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1i, [["render", _sfc_render$Q]]);
  2712. const _sfc_main$1h = defineComponent({
  2713. name: "Loading"
  2714. });
  2715. const _hoisted_1$O = {
  2716. viewBox: "0 0 1024 1024",
  2717. xmlns: "http://www.w3.org/2000/svg"
  2718. };
  2719. const _hoisted_2$F = /* @__PURE__ */ createElementVNode("path", {
  2720. fill: "currentColor",
  2721. 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"
  2722. }, null, -1);
  2723. const _hoisted_3$s = [
  2724. _hoisted_2$F
  2725. ];
  2726. function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
  2727. return openBlock(), createElementBlock("svg", _hoisted_1$O, _hoisted_3$s);
  2728. }
  2729. var loading = /* @__PURE__ */ _export_sfc$2(_sfc_main$1h, [["render", _sfc_render$P]]);
  2730. const _sfc_main$1g = defineComponent({
  2731. name: "Minus"
  2732. });
  2733. const _hoisted_1$N = {
  2734. viewBox: "0 0 1024 1024",
  2735. xmlns: "http://www.w3.org/2000/svg"
  2736. };
  2737. const _hoisted_2$E = /* @__PURE__ */ createElementVNode("path", {
  2738. fill: "currentColor",
  2739. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  2740. }, null, -1);
  2741. const _hoisted_3$r = [
  2742. _hoisted_2$E
  2743. ];
  2744. function _sfc_render$O(_ctx, _cache, $props, $setup, $data, $options) {
  2745. return openBlock(), createElementBlock("svg", _hoisted_1$N, _hoisted_3$r);
  2746. }
  2747. var minus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1g, [["render", _sfc_render$O]]);
  2748. const _sfc_main$1f = defineComponent({
  2749. name: "Plus"
  2750. });
  2751. const _hoisted_1$M = {
  2752. viewBox: "0 0 1024 1024",
  2753. xmlns: "http://www.w3.org/2000/svg"
  2754. };
  2755. const _hoisted_2$D = /* @__PURE__ */ createElementVNode("path", {
  2756. fill: "currentColor",
  2757. 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"
  2758. }, null, -1);
  2759. const _hoisted_3$q = [
  2760. _hoisted_2$D
  2761. ];
  2762. function _sfc_render$N(_ctx, _cache, $props, $setup, $data, $options) {
  2763. return openBlock(), createElementBlock("svg", _hoisted_1$M, _hoisted_3$q);
  2764. }
  2765. var plus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1f, [["render", _sfc_render$N]]);
  2766. const _sfc_main$1e = defineComponent({
  2767. name: "RefreshLeft"
  2768. });
  2769. const _hoisted_1$L = {
  2770. viewBox: "0 0 1024 1024",
  2771. xmlns: "http://www.w3.org/2000/svg"
  2772. };
  2773. const _hoisted_2$C = /* @__PURE__ */ createElementVNode("path", {
  2774. fill: "currentColor",
  2775. 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"
  2776. }, null, -1);
  2777. const _hoisted_3$p = [
  2778. _hoisted_2$C
  2779. ];
  2780. function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
  2781. return openBlock(), createElementBlock("svg", _hoisted_1$L, _hoisted_3$p);
  2782. }
  2783. var refreshLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1e, [["render", _sfc_render$M]]);
  2784. const _sfc_main$1d = defineComponent({
  2785. name: "RefreshRight"
  2786. });
  2787. const _hoisted_1$K = {
  2788. viewBox: "0 0 1024 1024",
  2789. xmlns: "http://www.w3.org/2000/svg"
  2790. };
  2791. const _hoisted_2$B = /* @__PURE__ */ createElementVNode("path", {
  2792. fill: "currentColor",
  2793. 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"
  2794. }, null, -1);
  2795. const _hoisted_3$o = [
  2796. _hoisted_2$B
  2797. ];
  2798. function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
  2799. return openBlock(), createElementBlock("svg", _hoisted_1$K, _hoisted_3$o);
  2800. }
  2801. var refreshRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1d, [["render", _sfc_render$L]]);
  2802. const _sfc_main$1c = defineComponent({
  2803. name: "ScaleToOriginal"
  2804. });
  2805. const _hoisted_1$J = {
  2806. viewBox: "0 0 1024 1024",
  2807. xmlns: "http://www.w3.org/2000/svg"
  2808. };
  2809. const _hoisted_2$A = /* @__PURE__ */ createElementVNode("path", {
  2810. fill: "currentColor",
  2811. 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"
  2812. }, null, -1);
  2813. const _hoisted_3$n = [
  2814. _hoisted_2$A
  2815. ];
  2816. function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
  2817. return openBlock(), createElementBlock("svg", _hoisted_1$J, _hoisted_3$n);
  2818. }
  2819. var scaleToOriginal = /* @__PURE__ */ _export_sfc$2(_sfc_main$1c, [["render", _sfc_render$K]]);
  2820. const _sfc_main$1b = defineComponent({
  2821. name: "StarFilled"
  2822. });
  2823. const _hoisted_1$I = {
  2824. viewBox: "0 0 1024 1024",
  2825. xmlns: "http://www.w3.org/2000/svg"
  2826. };
  2827. const _hoisted_2$z = /* @__PURE__ */ createElementVNode("path", {
  2828. fill: "currentColor",
  2829. 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"
  2830. }, null, -1);
  2831. const _hoisted_3$m = [
  2832. _hoisted_2$z
  2833. ];
  2834. function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
  2835. return openBlock(), createElementBlock("svg", _hoisted_1$I, _hoisted_3$m);
  2836. }
  2837. var starFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$1b, [["render", _sfc_render$J]]);
  2838. const _sfc_main$1a = defineComponent({
  2839. name: "Star"
  2840. });
  2841. const _hoisted_1$H = {
  2842. viewBox: "0 0 1024 1024",
  2843. xmlns: "http://www.w3.org/2000/svg"
  2844. };
  2845. const _hoisted_2$y = /* @__PURE__ */ createElementVNode("path", {
  2846. fill: "currentColor",
  2847. 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"
  2848. }, null, -1);
  2849. const _hoisted_3$l = [
  2850. _hoisted_2$y
  2851. ];
  2852. function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
  2853. return openBlock(), createElementBlock("svg", _hoisted_1$H, _hoisted_3$l);
  2854. }
  2855. var star = /* @__PURE__ */ _export_sfc$2(_sfc_main$1a, [["render", _sfc_render$I]]);
  2856. const _sfc_main$19 = defineComponent({
  2857. name: "View"
  2858. });
  2859. const _hoisted_1$G = {
  2860. viewBox: "0 0 1024 1024",
  2861. xmlns: "http://www.w3.org/2000/svg"
  2862. };
  2863. const _hoisted_2$x = /* @__PURE__ */ createElementVNode("path", {
  2864. fill: "currentColor",
  2865. 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"
  2866. }, null, -1);
  2867. const _hoisted_3$k = [
  2868. _hoisted_2$x
  2869. ];
  2870. function _sfc_render$H(_ctx, _cache, $props, $setup, $data, $options) {
  2871. return openBlock(), createElementBlock("svg", _hoisted_1$G, _hoisted_3$k);
  2872. }
  2873. var view = /* @__PURE__ */ _export_sfc$2(_sfc_main$19, [["render", _sfc_render$H]]);
  2874. const _sfc_main$18 = defineComponent({
  2875. name: "WarningFilled"
  2876. });
  2877. const _hoisted_1$F = {
  2878. viewBox: "0 0 1024 1024",
  2879. xmlns: "http://www.w3.org/2000/svg"
  2880. };
  2881. const _hoisted_2$w = /* @__PURE__ */ createElementVNode("path", {
  2882. fill: "currentColor",
  2883. 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"
  2884. }, null, -1);
  2885. const _hoisted_3$j = [
  2886. _hoisted_2$w
  2887. ];
  2888. function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
  2889. return openBlock(), createElementBlock("svg", _hoisted_1$F, _hoisted_3$j);
  2890. }
  2891. var warningFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$18, [["render", _sfc_render$G]]);
  2892. const _sfc_main$17 = defineComponent({
  2893. name: "ZoomIn"
  2894. });
  2895. const _hoisted_1$E = {
  2896. viewBox: "0 0 1024 1024",
  2897. xmlns: "http://www.w3.org/2000/svg"
  2898. };
  2899. const _hoisted_2$v = /* @__PURE__ */ createElementVNode("path", {
  2900. fill: "currentColor",
  2901. 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"
  2902. }, null, -1);
  2903. const _hoisted_3$i = [
  2904. _hoisted_2$v
  2905. ];
  2906. function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
  2907. return openBlock(), createElementBlock("svg", _hoisted_1$E, _hoisted_3$i);
  2908. }
  2909. var zoomIn = /* @__PURE__ */ _export_sfc$2(_sfc_main$17, [["render", _sfc_render$F]]);
  2910. const _sfc_main$16 = defineComponent({
  2911. name: "ZoomOut"
  2912. });
  2913. const _hoisted_1$D = {
  2914. viewBox: "0 0 1024 1024",
  2915. xmlns: "http://www.w3.org/2000/svg"
  2916. };
  2917. const _hoisted_2$u = /* @__PURE__ */ createElementVNode("path", {
  2918. fill: "currentColor",
  2919. 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"
  2920. }, null, -1);
  2921. const _hoisted_3$h = [
  2922. _hoisted_2$u
  2923. ];
  2924. function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
  2925. return openBlock(), createElementBlock("svg", _hoisted_1$D, _hoisted_3$h);
  2926. }
  2927. var zoomOut = /* @__PURE__ */ _export_sfc$2(_sfc_main$16, [["render", _sfc_render$E]]);
  2928. const wrapperKey = Symbol();
  2929. const propKey = "__elPropsReservedKey";
  2930. function buildProp(option, key) {
  2931. if (!isObject$1(option) || !!option[propKey])
  2932. return option;
  2933. const { values, required: required4, default: defaultValue, type: type4, validator } = option;
  2934. const _validator = values || validator ? (val) => {
  2935. let valid = false;
  2936. let allowedValues = [];
  2937. if (values) {
  2938. allowedValues = Array.from(values);
  2939. if (hasOwn(option, "default")) {
  2940. allowedValues.push(defaultValue);
  2941. }
  2942. valid || (valid = allowedValues.includes(val));
  2943. }
  2944. if (validator)
  2945. valid || (valid = validator(val));
  2946. if (!valid && allowedValues.length > 0) {
  2947. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  2948. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  2949. }
  2950. return valid;
  2951. } : void 0;
  2952. const prop = {
  2953. type: isObject$1(type4) && Object.getOwnPropertySymbols(type4).includes(wrapperKey) ? type4[wrapperKey] : type4,
  2954. required: !!required4,
  2955. validator: _validator,
  2956. [propKey]: true
  2957. };
  2958. if (hasOwn(option, "default"))
  2959. prop.default = defaultValue;
  2960. return prop;
  2961. }
  2962. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  2963. key,
  2964. buildProp(option, key)
  2965. ]));
  2966. const definePropType = (val) => ({ [wrapperKey]: val });
  2967. const iconPropType = definePropType([
  2968. String,
  2969. Object,
  2970. Function
  2971. ]);
  2972. const CloseComponents = {
  2973. Close: close
  2974. };
  2975. const ValidateComponentsMap = {
  2976. validating: loading,
  2977. success: circleCheck,
  2978. error: circleClose
  2979. };
  2980. const withInstall = (main2, extra) => {
  2981. main2.install = (app) => {
  2982. for (const comp of [main2, ...Object.values(extra != null ? extra : {})]) {
  2983. app.component(comp.name, comp);
  2984. }
  2985. };
  2986. if (extra) {
  2987. for (const [key, comp] of Object.entries(extra)) {
  2988. main2[key] = comp;
  2989. }
  2990. }
  2991. return main2;
  2992. };
  2993. const withNoopInstall = (component) => {
  2994. component.install = NOOP;
  2995. return component;
  2996. };
  2997. class ElementPlusError extends Error {
  2998. constructor(m2) {
  2999. super(m2);
  3000. this.name = "ElementPlusError";
  3001. }
  3002. }
  3003. function throwError(scope, m2) {
  3004. throw new ElementPlusError(`[${scope}] ${m2}`);
  3005. }
  3006. function debugWarn(scope, message) {
  3007. }
  3008. function addUnit(value, defaultUnit = "px") {
  3009. if (!value)
  3010. return "";
  3011. if (isString(value)) {
  3012. return value;
  3013. } else if (isNumber(value)) {
  3014. return `${value}${defaultUnit}`;
  3015. }
  3016. }
  3017. const EVENT_CODE = {
  3018. tab: "Tab",
  3019. enter: "Enter",
  3020. space: "Space",
  3021. left: "ArrowLeft",
  3022. up: "ArrowUp",
  3023. right: "ArrowRight",
  3024. down: "ArrowDown",
  3025. esc: "Escape",
  3026. delete: "Delete",
  3027. backspace: "Backspace",
  3028. numpadEnter: "NumpadEnter",
  3029. pageUp: "PageUp",
  3030. pageDown: "PageDown",
  3031. home: "Home",
  3032. end: "End"
  3033. };
  3034. const datePickTypes = [
  3035. "year",
  3036. "month",
  3037. "date",
  3038. "dates",
  3039. "week",
  3040. "datetime",
  3041. "datetimerange",
  3042. "daterange",
  3043. "monthrange"
  3044. ];
  3045. const UPDATE_MODEL_EVENT = "update:modelValue";
  3046. const CHANGE_EVENT = "change";
  3047. const INPUT_EVENT = "input";
  3048. const componentSizes = ["", "default", "small", "large"];
  3049. const componentSizeMap = {
  3050. large: 40,
  3051. default: 32,
  3052. small: 24
  3053. };
  3054. const getComponentSize = (size = "default") => {
  3055. return componentSizeMap[size || "default"];
  3056. };
  3057. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  3058. const isValidDatePickType = (val) => [...datePickTypes].includes(val);
  3059. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  3060. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  3061. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  3062. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  3063. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  3064. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  3065. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  3066. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  3067. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  3068. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  3069. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  3070. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  3071. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  3072. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  3073. return PatchFlags2;
  3074. })(PatchFlags || {});
  3075. function isFragment(node) {
  3076. return isVNode(node) && node.type === Fragment;
  3077. }
  3078. function isComment(node) {
  3079. return isVNode(node) && node.type === Comment;
  3080. }
  3081. function isValidElementNode(node) {
  3082. return isVNode(node) && !isFragment(node) && !isComment(node);
  3083. }
  3084. const unique = (arr) => [...new Set(arr)];
  3085. const castArray = (arr) => {
  3086. if (!arr && arr !== 0)
  3087. return [];
  3088. return Array.isArray(arr) ? arr : [arr];
  3089. };
  3090. const isFirefox = () => isClient$1 && /firefox/i.test(window.navigator.userAgent);
  3091. const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
  3092. const generateId = () => Math.floor(Math.random() * 1e4);
  3093. const mutable = (val) => val;
  3094. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  3095. const LISTENER_PREFIX = /^on[A-Z]/;
  3096. const useAttrs = (params = {}) => {
  3097. const { excludeListeners = false, excludeKeys = [] } = params;
  3098. const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
  3099. const instance = getCurrentInstance();
  3100. if (!instance) {
  3101. return computed(() => ({}));
  3102. }
  3103. return computed(() => {
  3104. var _a2;
  3105. return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  3106. });
  3107. };
  3108. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  3109. const configProviderContextKey = Symbol();
  3110. const dialogInjectionKey = Symbol("dialogInjectionKey");
  3111. const formContextKey = Symbol("formContextKey");
  3112. const formItemContextKey = Symbol("formItemContextKey");
  3113. const radioGroupKey = Symbol("radioGroupKey");
  3114. const scrollbarContextKey = Symbol("scrollbarContextKey");
  3115. const uploadContextKey = Symbol("uploadContextKey");
  3116. const POPPER_INJECTION_KEY = Symbol("popper");
  3117. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  3118. const useProp = (name) => {
  3119. const vm = getCurrentInstance();
  3120. return computed(() => {
  3121. var _a2, _b2;
  3122. return (_b2 = (_a2 = vm.proxy) == null ? void 0 : _a2.$props[name]) != null ? _b2 : void 0;
  3123. });
  3124. };
  3125. const globalConfig = ref();
  3126. function useGlobalConfig(key, defaultValue = void 0) {
  3127. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  3128. if (key) {
  3129. return computed(() => {
  3130. var _a2, _b2;
  3131. return (_b2 = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b2 : defaultValue;
  3132. });
  3133. } else {
  3134. return config;
  3135. }
  3136. }
  3137. const provideGlobalConfig = (config, app, global2 = false) => {
  3138. var _a2;
  3139. const inSetup = !!getCurrentInstance();
  3140. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  3141. const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
  3142. if (!provideFn) {
  3143. return;
  3144. }
  3145. const context = computed(() => {
  3146. const cfg = unref(config);
  3147. if (!(oldConfig == null ? void 0 : oldConfig.value))
  3148. return cfg;
  3149. return mergeConfig(oldConfig.value, cfg);
  3150. });
  3151. provideFn(configProviderContextKey, context);
  3152. if (global2 || !globalConfig.value) {
  3153. globalConfig.value = context.value;
  3154. }
  3155. return context;
  3156. };
  3157. const mergeConfig = (a2, b2) => {
  3158. var _a2;
  3159. const keys2 = [.../* @__PURE__ */ new Set([...keysOf(a2), ...keysOf(b2)])];
  3160. const obj = {};
  3161. for (const key of keys2) {
  3162. obj[key] = (_a2 = b2[key]) != null ? _a2 : a2[key];
  3163. }
  3164. return obj;
  3165. };
  3166. const useSizeProp = buildProp({
  3167. type: String,
  3168. values: componentSizes,
  3169. required: false
  3170. });
  3171. const useSize = (fallback, ignore = {}) => {
  3172. const emptyRef = ref(void 0);
  3173. const size = ignore.prop ? emptyRef : useProp("size");
  3174. const globalConfig2 = ignore.global ? emptyRef : useGlobalConfig("size");
  3175. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  3176. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  3177. return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  3178. };
  3179. const useDisabled$1 = (fallback) => {
  3180. const disabled = useProp("disabled");
  3181. const form = inject(formContextKey, void 0);
  3182. return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  3183. };
  3184. const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type: type4 = "API" }, condition) => {
  3185. watch(() => unref(condition), (val) => {
  3186. }, {
  3187. immediate: true
  3188. });
  3189. };
  3190. const useDraggable = (targetRef, dragRef, draggable) => {
  3191. let transform = {
  3192. offsetX: 0,
  3193. offsetY: 0
  3194. };
  3195. const onMousedown = (e) => {
  3196. const downX = e.clientX;
  3197. const downY = e.clientY;
  3198. const { offsetX, offsetY } = transform;
  3199. const targetRect = targetRef.value.getBoundingClientRect();
  3200. const targetLeft = targetRect.left;
  3201. const targetTop = targetRect.top;
  3202. const targetWidth = targetRect.width;
  3203. const targetHeight = targetRect.height;
  3204. const clientWidth = document.documentElement.clientWidth;
  3205. const clientHeight = document.documentElement.clientHeight;
  3206. const minLeft = -targetLeft + offsetX;
  3207. const minTop = -targetTop + offsetY;
  3208. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  3209. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  3210. const onMousemove = (e2) => {
  3211. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  3212. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  3213. transform = {
  3214. offsetX: moveX,
  3215. offsetY: moveY
  3216. };
  3217. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  3218. };
  3219. const onMouseup = () => {
  3220. document.removeEventListener("mousemove", onMousemove);
  3221. document.removeEventListener("mouseup", onMouseup);
  3222. };
  3223. document.addEventListener("mousemove", onMousemove);
  3224. document.addEventListener("mouseup", onMouseup);
  3225. };
  3226. const onDraggable = () => {
  3227. if (dragRef.value && targetRef.value) {
  3228. dragRef.value.addEventListener("mousedown", onMousedown);
  3229. }
  3230. };
  3231. const offDraggable = () => {
  3232. if (dragRef.value && targetRef.value) {
  3233. dragRef.value.removeEventListener("mousedown", onMousedown);
  3234. }
  3235. };
  3236. onMounted(() => {
  3237. watchEffect(() => {
  3238. if (draggable.value) {
  3239. onDraggable();
  3240. } else {
  3241. offDraggable();
  3242. }
  3243. });
  3244. });
  3245. onBeforeUnmount(() => {
  3246. offDraggable();
  3247. });
  3248. };
  3249. const useFocus = (el) => {
  3250. return {
  3251. focus: () => {
  3252. var _a2, _b2;
  3253. (_b2 = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  3254. }
  3255. };
  3256. };
  3257. const useFormItem = () => {
  3258. const form = inject(formContextKey, void 0);
  3259. const formItem = inject(formItemContextKey, void 0);
  3260. return {
  3261. form,
  3262. formItem
  3263. };
  3264. };
  3265. var English = {
  3266. name: "en",
  3267. el: {
  3268. colorpicker: {
  3269. confirm: "OK",
  3270. clear: "Clear"
  3271. },
  3272. datepicker: {
  3273. now: "Now",
  3274. today: "Today",
  3275. cancel: "Cancel",
  3276. clear: "Clear",
  3277. confirm: "OK",
  3278. selectDate: "Select date",
  3279. selectTime: "Select time",
  3280. startDate: "Start Date",
  3281. startTime: "Start Time",
  3282. endDate: "End Date",
  3283. endTime: "End Time",
  3284. prevYear: "Previous Year",
  3285. nextYear: "Next Year",
  3286. prevMonth: "Previous Month",
  3287. nextMonth: "Next Month",
  3288. year: "",
  3289. month1: "January",
  3290. month2: "February",
  3291. month3: "March",
  3292. month4: "April",
  3293. month5: "May",
  3294. month6: "June",
  3295. month7: "July",
  3296. month8: "August",
  3297. month9: "September",
  3298. month10: "October",
  3299. month11: "November",
  3300. month12: "December",
  3301. week: "week",
  3302. weeks: {
  3303. sun: "Sun",
  3304. mon: "Mon",
  3305. tue: "Tue",
  3306. wed: "Wed",
  3307. thu: "Thu",
  3308. fri: "Fri",
  3309. sat: "Sat"
  3310. },
  3311. months: {
  3312. jan: "Jan",
  3313. feb: "Feb",
  3314. mar: "Mar",
  3315. apr: "Apr",
  3316. may: "May",
  3317. jun: "Jun",
  3318. jul: "Jul",
  3319. aug: "Aug",
  3320. sep: "Sep",
  3321. oct: "Oct",
  3322. nov: "Nov",
  3323. dec: "Dec"
  3324. }
  3325. },
  3326. select: {
  3327. loading: "Loading",
  3328. noMatch: "No matching data",
  3329. noData: "No data",
  3330. placeholder: "Select"
  3331. },
  3332. cascader: {
  3333. noMatch: "No matching data",
  3334. loading: "Loading",
  3335. placeholder: "Select",
  3336. noData: "No data"
  3337. },
  3338. pagination: {
  3339. goto: "Go to",
  3340. pagesize: "/page",
  3341. total: "Total {total}",
  3342. pageClassifier: "",
  3343. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  3344. },
  3345. messagebox: {
  3346. title: "Message",
  3347. confirm: "OK",
  3348. cancel: "Cancel",
  3349. error: "Illegal input"
  3350. },
  3351. upload: {
  3352. deleteTip: "press delete to remove",
  3353. delete: "Delete",
  3354. preview: "Preview",
  3355. continue: "Continue"
  3356. },
  3357. table: {
  3358. emptyText: "No Data",
  3359. confirmFilter: "Confirm",
  3360. resetFilter: "Reset",
  3361. clearFilter: "All",
  3362. sumText: "Sum"
  3363. },
  3364. tree: {
  3365. emptyText: "No Data"
  3366. },
  3367. transfer: {
  3368. noMatch: "No matching data",
  3369. noData: "No data",
  3370. titles: ["List 1", "List 2"],
  3371. filterPlaceholder: "Enter keyword",
  3372. noCheckedFormat: "{total} items",
  3373. hasCheckedFormat: "{checked}/{total} checked"
  3374. },
  3375. image: {
  3376. error: "FAILED"
  3377. },
  3378. pageHeader: {
  3379. title: "Back"
  3380. },
  3381. popconfirm: {
  3382. confirmButtonText: "Yes",
  3383. cancelButtonText: "No"
  3384. }
  3385. }
  3386. };
  3387. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  3388. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_2, key) => {
  3389. var _a2;
  3390. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  3391. });
  3392. const buildLocaleContext = (locale) => {
  3393. const lang = computed(() => unref(locale).name);
  3394. const localeRef = isRef(locale) ? locale : ref(locale);
  3395. return {
  3396. lang,
  3397. locale: localeRef,
  3398. t: buildTranslator(locale)
  3399. };
  3400. };
  3401. const useLocale = () => {
  3402. const locale = useGlobalConfig("locale");
  3403. return buildLocaleContext(computed(() => locale.value || English));
  3404. };
  3405. const useLockscreen = (trigger) => {
  3406. if (!isRef(trigger)) {
  3407. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  3408. }
  3409. if (!isClient$1 || hasClass(document.body, "el-popup-parent--hidden")) {
  3410. return;
  3411. }
  3412. let scrollBarWidth2 = 0;
  3413. let withoutHiddenClass = false;
  3414. let bodyPaddingRight = "0";
  3415. let computedBodyPaddingRight = 0;
  3416. const cleanup = () => {
  3417. removeClass(document.body, "el-popup-parent--hidden");
  3418. if (withoutHiddenClass) {
  3419. document.body.style.paddingRight = bodyPaddingRight;
  3420. }
  3421. };
  3422. watch(trigger, (val) => {
  3423. if (!val) {
  3424. cleanup();
  3425. return;
  3426. }
  3427. withoutHiddenClass = !hasClass(document.body, "el-popup-parent--hidden");
  3428. if (withoutHiddenClass) {
  3429. bodyPaddingRight = document.body.style.paddingRight;
  3430. computedBodyPaddingRight = Number.parseInt(getStyle(document.body, "paddingRight"), 10);
  3431. }
  3432. scrollBarWidth2 = getScrollBarWidth();
  3433. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  3434. const bodyOverflowY = getStyle(document.body, "overflowY");
  3435. if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  3436. document.body.style.paddingRight = `${computedBodyPaddingRight + scrollBarWidth2}px`;
  3437. }
  3438. addClass(document.body, "el-popup-parent--hidden");
  3439. });
  3440. onScopeDispose(() => cleanup());
  3441. };
  3442. const modalStack = [];
  3443. const closeModal = (e) => {
  3444. if (modalStack.length === 0)
  3445. return;
  3446. if (e.code === EVENT_CODE.esc) {
  3447. e.stopPropagation();
  3448. const topModal = modalStack[modalStack.length - 1];
  3449. topModal.handleClose();
  3450. }
  3451. };
  3452. const useModal = (instance, visibleRef) => {
  3453. watch(visibleRef, (val) => {
  3454. if (val) {
  3455. modalStack.push(instance);
  3456. } else {
  3457. modalStack.splice(modalStack.indexOf(instance), 1);
  3458. }
  3459. });
  3460. };
  3461. if (isClient$1)
  3462. useEventListener(document, "keydown", closeModal);
  3463. const _prop = buildProp({
  3464. type: definePropType(Boolean),
  3465. default: null
  3466. });
  3467. const _event = buildProp({
  3468. type: definePropType(Function)
  3469. });
  3470. const createModelToggleComposable = (name) => {
  3471. const useModelToggleProps2 = {
  3472. [name]: _prop,
  3473. [`onUpdate:${name}`]: _event
  3474. };
  3475. const useModelToggleEmits2 = [`update:${name}`];
  3476. const useModelToggle2 = ({
  3477. indicator,
  3478. shouldHideWhenRouteChanges,
  3479. shouldProceed,
  3480. onShow,
  3481. onHide
  3482. }) => {
  3483. const instance = getCurrentInstance();
  3484. const props = instance.props;
  3485. const { emit } = instance;
  3486. const updateEventKey = `update:${name}`;
  3487. const hasUpdateHandler = computed(() => isFunction(props[`onUpdate:${name}`]));
  3488. const isModelBindingAbsent = computed(() => props[name] === null);
  3489. const doShow = () => {
  3490. if (indicator.value === true) {
  3491. return;
  3492. }
  3493. indicator.value = true;
  3494. if (isFunction(onShow)) {
  3495. onShow();
  3496. }
  3497. };
  3498. const doHide = () => {
  3499. if (indicator.value === false) {
  3500. return;
  3501. }
  3502. indicator.value = false;
  3503. if (isFunction(onHide)) {
  3504. onHide();
  3505. }
  3506. };
  3507. const show = () => {
  3508. if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
  3509. return;
  3510. const shouldEmit = hasUpdateHandler.value && isClient$1;
  3511. if (shouldEmit) {
  3512. emit(updateEventKey, true);
  3513. }
  3514. if (isModelBindingAbsent.value || !shouldEmit) {
  3515. doShow();
  3516. }
  3517. };
  3518. const hide2 = () => {
  3519. if (props.disabled === true || !isClient$1)
  3520. return;
  3521. const shouldEmit = hasUpdateHandler.value && isClient$1;
  3522. if (shouldEmit) {
  3523. emit(updateEventKey, false);
  3524. }
  3525. if (isModelBindingAbsent.value || !shouldEmit) {
  3526. doHide();
  3527. }
  3528. };
  3529. const onChange = (val) => {
  3530. if (!isBoolean(val))
  3531. return;
  3532. if (props.disabled && val) {
  3533. if (hasUpdateHandler.value) {
  3534. emit(updateEventKey, false);
  3535. }
  3536. } else if (indicator.value !== val) {
  3537. if (val) {
  3538. doShow();
  3539. } else {
  3540. doHide();
  3541. }
  3542. }
  3543. };
  3544. const toggle = () => {
  3545. if (indicator.value) {
  3546. hide2();
  3547. } else {
  3548. show();
  3549. }
  3550. };
  3551. watch(() => props[name], onChange);
  3552. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  3553. watch(() => __spreadValues({}, instance.proxy.$route), () => {
  3554. if (shouldHideWhenRouteChanges.value && indicator.value) {
  3555. hide2();
  3556. }
  3557. });
  3558. }
  3559. onMounted(() => {
  3560. onChange(props[name]);
  3561. });
  3562. return {
  3563. hide: hide2,
  3564. show,
  3565. toggle
  3566. };
  3567. };
  3568. return {
  3569. useModelToggle: useModelToggle2,
  3570. useModelToggleProps: useModelToggleProps2,
  3571. useModelToggleEmits: useModelToggleEmits2
  3572. };
  3573. };
  3574. const useRestoreActive = (toggle, initialFocus) => {
  3575. let previousActive;
  3576. watch(() => toggle.value, (val) => {
  3577. var _a2, _b2;
  3578. if (val) {
  3579. previousActive = document.activeElement;
  3580. if (isRef(initialFocus)) {
  3581. (_b2 = (_a2 = initialFocus.value).focus) == null ? void 0 : _b2.call(_a2);
  3582. }
  3583. } else {
  3584. {
  3585. previousActive.focus();
  3586. }
  3587. }
  3588. });
  3589. };
  3590. const useSameTarget = (handleClick) => {
  3591. if (!handleClick) {
  3592. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  3593. }
  3594. let mousedownTarget = false;
  3595. let mouseupTarget = false;
  3596. const onClick = (e) => {
  3597. if (mousedownTarget && mouseupTarget) {
  3598. handleClick(e);
  3599. }
  3600. mousedownTarget = mouseupTarget = false;
  3601. };
  3602. const onMousedown = (e) => {
  3603. mousedownTarget = e.target === e.currentTarget;
  3604. };
  3605. const onMouseup = (e) => {
  3606. mouseupTarget = e.target === e.currentTarget;
  3607. };
  3608. return { onClick, onMousedown, onMouseup };
  3609. };
  3610. function useTimeout() {
  3611. let timeoutHandle;
  3612. const registerTimeout = (fn2, delay) => {
  3613. cancelTimeout();
  3614. timeoutHandle = window.setTimeout(fn2, delay);
  3615. };
  3616. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  3617. tryOnScopeDispose(() => cancelTimeout());
  3618. return {
  3619. registerTimeout,
  3620. cancelTimeout
  3621. };
  3622. }
  3623. const defaultIdInjection = {
  3624. prefix: Math.floor(Math.random() * 1e4),
  3625. current: 0
  3626. };
  3627. const ID_INJECTION_KEY = Symbol("elIdInjection");
  3628. const useId = (deterministicId) => {
  3629. const idInjection = inject(ID_INJECTION_KEY, defaultIdInjection);
  3630. const idRef = computed(() => unref(deterministicId) || `el-id-${idInjection.prefix}-${idInjection.current++}`);
  3631. return idRef;
  3632. };
  3633. const useEscapeKeydown = (handler3) => {
  3634. const cachedHandler = (e) => {
  3635. const event = e;
  3636. if (event.key === EVENT_CODE.esc) {
  3637. handler3 == null ? void 0 : handler3(event);
  3638. }
  3639. };
  3640. onMounted(() => {
  3641. on(document, "keydown", cachedHandler);
  3642. });
  3643. onBeforeUnmount(() => {
  3644. off(document, "keydown", cachedHandler);
  3645. });
  3646. };
  3647. let cachedContainer;
  3648. const POPPER_CONTAINER_ID = `el-popper-container-${generateId()}`;
  3649. const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`;
  3650. const createContainer = () => {
  3651. const container = document.createElement("div");
  3652. container.id = POPPER_CONTAINER_ID;
  3653. document.body.appendChild(container);
  3654. return container;
  3655. };
  3656. const usePopperContainer = () => {
  3657. onBeforeMount(() => {
  3658. if (!isClient$1)
  3659. return;
  3660. if (!cachedContainer || !document.body.querySelector(POPPER_CONTAINER_SELECTOR)) {
  3661. cachedContainer = createContainer();
  3662. }
  3663. });
  3664. };
  3665. const useDelayedToggleProps = buildProps({
  3666. showAfter: {
  3667. type: Number,
  3668. default: 0
  3669. },
  3670. hideAfter: {
  3671. type: Number,
  3672. default: 200
  3673. }
  3674. });
  3675. const useDelayedToggle = ({
  3676. showAfter,
  3677. hideAfter,
  3678. open,
  3679. close: close2
  3680. }) => {
  3681. const { registerTimeout } = useTimeout();
  3682. const onOpen = () => {
  3683. registerTimeout(() => {
  3684. open();
  3685. }, unref(showAfter));
  3686. };
  3687. const onClose = () => {
  3688. registerTimeout(() => {
  3689. close2();
  3690. }, unref(hideAfter));
  3691. };
  3692. return {
  3693. onOpen,
  3694. onClose
  3695. };
  3696. };
  3697. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  3698. const useForwardRef = (forwardRef) => {
  3699. const setForwardRef = (el) => {
  3700. forwardRef.value = el;
  3701. };
  3702. provide(FORWARD_REF_INJECTION_KEY, {
  3703. setForwardRef
  3704. });
  3705. };
  3706. const useForwardRefDirective = (setForwardRef) => {
  3707. return {
  3708. mounted(el) {
  3709. setForwardRef(el);
  3710. },
  3711. updated(el) {
  3712. setForwardRef(el);
  3713. },
  3714. unmounted() {
  3715. setForwardRef(null);
  3716. }
  3717. };
  3718. };
  3719. const defaultNamespace = "el";
  3720. const statePrefix = "is-";
  3721. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  3722. let cls = `${namespace}-${block}`;
  3723. if (blockSuffix) {
  3724. cls += `-${blockSuffix}`;
  3725. }
  3726. if (element) {
  3727. cls += `__${element}`;
  3728. }
  3729. if (modifier) {
  3730. cls += `--${modifier}`;
  3731. }
  3732. return cls;
  3733. };
  3734. const useNamespace = (block) => {
  3735. const globalConfig2 = useGlobalConfig("namespace");
  3736. const namespace = computed(() => globalConfig2.value || defaultNamespace);
  3737. const b2 = (blockSuffix = "") => _bem(unref(namespace), block, blockSuffix, "", "");
  3738. const e = (element) => element ? _bem(unref(namespace), block, "", element, "") : "";
  3739. const m2 = (modifier) => modifier ? _bem(unref(namespace), block, "", "", modifier) : "";
  3740. const be = (blockSuffix, element) => blockSuffix && element ? _bem(unref(namespace), block, blockSuffix, element, "") : "";
  3741. const em = (element, modifier) => element && modifier ? _bem(unref(namespace), block, "", element, modifier) : "";
  3742. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(unref(namespace), block, blockSuffix, "", modifier) : "";
  3743. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(unref(namespace), block, blockSuffix, element, modifier) : "";
  3744. const is = (name, ...args) => {
  3745. const state = args.length >= 1 ? args[0] : true;
  3746. return name && state ? `${statePrefix}${name}` : "";
  3747. };
  3748. return {
  3749. namespace,
  3750. b: b2,
  3751. e,
  3752. m: m2,
  3753. be,
  3754. em,
  3755. bm,
  3756. bem,
  3757. is
  3758. };
  3759. };
  3760. const zIndex = ref(0);
  3761. const useZIndex = () => {
  3762. const initialZIndex = useGlobalConfig("zIndex", 2e3);
  3763. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  3764. const nextZIndex = () => {
  3765. zIndex.value++;
  3766. return currentZIndex.value;
  3767. };
  3768. return {
  3769. initialZIndex,
  3770. currentZIndex,
  3771. nextZIndex
  3772. };
  3773. };
  3774. var _export_sfc$1 = (sfc, props) => {
  3775. const target = sfc.__vccOpts || sfc;
  3776. for (const [key, val] of props) {
  3777. target[key] = val;
  3778. }
  3779. return target;
  3780. };
  3781. const iconProps = buildProps({
  3782. size: {
  3783. type: definePropType([Number, String])
  3784. },
  3785. color: {
  3786. type: String
  3787. }
  3788. });
  3789. const __default__$l = {
  3790. name: "ElIcon",
  3791. inheritAttrs: false
  3792. };
  3793. const _sfc_main$15 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$l), {
  3794. props: iconProps,
  3795. setup(__props) {
  3796. const props = __props;
  3797. const ns = useNamespace("icon");
  3798. const style = computed(() => {
  3799. if (!props.size && !props.color)
  3800. return {};
  3801. return {
  3802. fontSize: isUndefined(props.size) ? void 0 : addUnit(props.size),
  3803. "--color": props.color
  3804. };
  3805. });
  3806. return (_ctx, _cache) => {
  3807. return openBlock(), createElementBlock("i", mergeProps({
  3808. class: unref(ns).b(),
  3809. style: unref(style)
  3810. }, _ctx.$attrs), [
  3811. renderSlot(_ctx.$slots, "default")
  3812. ], 16);
  3813. };
  3814. }
  3815. }));
  3816. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  3817. const ElIcon = withInstall(Icon);
  3818. let hiddenTextarea = void 0;
  3819. const HIDDEN_STYLE = `
  3820. height:0 !important;
  3821. visibility:hidden !important;
  3822. overflow:hidden !important;
  3823. position:absolute !important;
  3824. z-index:-1000 !important;
  3825. top:0 !important;
  3826. right:0 !important;
  3827. `;
  3828. const CONTEXT_STYLE = [
  3829. "letter-spacing",
  3830. "line-height",
  3831. "padding-top",
  3832. "padding-bottom",
  3833. "font-family",
  3834. "font-weight",
  3835. "font-size",
  3836. "text-rendering",
  3837. "text-transform",
  3838. "width",
  3839. "text-indent",
  3840. "padding-left",
  3841. "padding-right",
  3842. "border-width",
  3843. "box-sizing"
  3844. ];
  3845. function calculateNodeStyling(targetElement) {
  3846. const style = window.getComputedStyle(targetElement);
  3847. const boxSizing = style.getPropertyValue("box-sizing");
  3848. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  3849. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  3850. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  3851. return { contextStyle, paddingSize, borderSize, boxSizing };
  3852. }
  3853. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  3854. var _a2;
  3855. if (!hiddenTextarea) {
  3856. hiddenTextarea = document.createElement("textarea");
  3857. document.body.appendChild(hiddenTextarea);
  3858. }
  3859. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  3860. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  3861. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  3862. let height = hiddenTextarea.scrollHeight;
  3863. const result = {};
  3864. if (boxSizing === "border-box") {
  3865. height = height + borderSize;
  3866. } else if (boxSizing === "content-box") {
  3867. height = height - paddingSize;
  3868. }
  3869. hiddenTextarea.value = "";
  3870. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  3871. if (isNumber(minRows)) {
  3872. let minHeight = singleRowHeight * minRows;
  3873. if (boxSizing === "border-box") {
  3874. minHeight = minHeight + paddingSize + borderSize;
  3875. }
  3876. height = Math.max(minHeight, height);
  3877. result.minHeight = `${minHeight}px`;
  3878. }
  3879. if (isNumber(maxRows)) {
  3880. let maxHeight = singleRowHeight * maxRows;
  3881. if (boxSizing === "border-box") {
  3882. maxHeight = maxHeight + paddingSize + borderSize;
  3883. }
  3884. height = Math.min(maxHeight, height);
  3885. }
  3886. result.height = `${height}px`;
  3887. (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
  3888. hiddenTextarea = void 0;
  3889. return result;
  3890. }
  3891. const inputProps = buildProps({
  3892. size: useSizeProp,
  3893. disabled: Boolean,
  3894. modelValue: {
  3895. type: definePropType([
  3896. String,
  3897. Number,
  3898. Object
  3899. ]),
  3900. default: ""
  3901. },
  3902. type: {
  3903. type: String,
  3904. default: "text"
  3905. },
  3906. resize: {
  3907. type: String,
  3908. values: ["none", "both", "horizontal", "vertical"]
  3909. },
  3910. autosize: {
  3911. type: definePropType([Boolean, Object]),
  3912. default: false
  3913. },
  3914. autocomplete: {
  3915. type: String,
  3916. default: "off"
  3917. },
  3918. placeholder: {
  3919. type: String
  3920. },
  3921. form: {
  3922. type: String,
  3923. default: ""
  3924. },
  3925. readonly: {
  3926. type: Boolean,
  3927. default: false
  3928. },
  3929. clearable: {
  3930. type: Boolean,
  3931. default: false
  3932. },
  3933. showPassword: {
  3934. type: Boolean,
  3935. default: false
  3936. },
  3937. showWordLimit: {
  3938. type: Boolean,
  3939. default: false
  3940. },
  3941. suffixIcon: {
  3942. type: iconPropType,
  3943. default: ""
  3944. },
  3945. prefixIcon: {
  3946. type: iconPropType,
  3947. default: ""
  3948. },
  3949. label: {
  3950. type: String
  3951. },
  3952. tabindex: {
  3953. type: [Number, String]
  3954. },
  3955. validateEvent: {
  3956. type: Boolean,
  3957. default: true
  3958. },
  3959. inputStyle: {
  3960. type: definePropType([Object, Array, String]),
  3961. default: () => mutable({})
  3962. }
  3963. });
  3964. const inputEmits = {
  3965. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  3966. input: (value) => isString(value),
  3967. change: (value) => isString(value),
  3968. focus: (evt) => evt instanceof FocusEvent,
  3969. blur: (evt) => evt instanceof FocusEvent,
  3970. clear: () => true,
  3971. mouseleave: (evt) => evt instanceof MouseEvent,
  3972. mouseenter: (evt) => evt instanceof MouseEvent,
  3973. keydown: (evt) => evt instanceof Event,
  3974. compositionstart: (evt) => evt instanceof CompositionEvent,
  3975. compositionupdate: (evt) => evt instanceof CompositionEvent,
  3976. compositionend: (evt) => evt instanceof CompositionEvent
  3977. };
  3978. const _hoisted_1$C = ["type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder"];
  3979. const _hoisted_2$t = ["tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder"];
  3980. const __default__$k = {
  3981. name: "ElInput",
  3982. inheritAttrs: false
  3983. };
  3984. const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$k), {
  3985. props: inputProps,
  3986. emits: inputEmits,
  3987. setup(__props, { expose, emit }) {
  3988. const props = __props;
  3989. const PENDANT_MAP = {
  3990. suffix: "append",
  3991. prefix: "prepend"
  3992. };
  3993. const instance = getCurrentInstance();
  3994. const rawAttrs = useAttrs$1();
  3995. const slots = useSlots();
  3996. const attrs = useAttrs();
  3997. const { form, formItem } = useFormItem();
  3998. const inputSize = useSize();
  3999. const inputDisabled = useDisabled$1();
  4000. const nsInput = useNamespace("input");
  4001. const nsTextarea = useNamespace("textarea");
  4002. const input = shallowRef();
  4003. const textarea = shallowRef();
  4004. const focused = ref(false);
  4005. const hovering = ref(false);
  4006. const isComposing = ref(false);
  4007. const passwordVisible = ref(false);
  4008. const textareaCalcStyle = shallowRef(props.inputStyle);
  4009. const _ref = computed(() => input.value || textarea.value);
  4010. const needStatusIcon = computed(() => {
  4011. var _a2;
  4012. return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
  4013. });
  4014. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  4015. const validateIcon = computed(() => ValidateComponentsMap[validateState.value]);
  4016. const passwordIcon = computed(() => passwordVisible.value ? view : hide$2);
  4017. const containerStyle = computed(() => [
  4018. rawAttrs.style,
  4019. props.inputStyle
  4020. ]);
  4021. const textareaStyle = computed(() => [
  4022. props.inputStyle,
  4023. textareaCalcStyle.value,
  4024. { resize: props.resize }
  4025. ]);
  4026. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  4027. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  4028. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !props.readonly && (!!nativeInputValue.value || focused.value));
  4029. const isWordLimitVisible = computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  4030. const textLength = computed(() => Array.from(nativeInputValue.value).length);
  4031. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  4032. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  4033. const resizeTextarea = () => {
  4034. const { type: type4, autosize } = props;
  4035. if (!isClient$1 || type4 !== "textarea")
  4036. return;
  4037. if (autosize) {
  4038. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  4039. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  4040. textareaCalcStyle.value = __spreadValues({}, calcTextareaHeight(textarea.value, minRows, maxRows));
  4041. } else {
  4042. textareaCalcStyle.value = {
  4043. minHeight: calcTextareaHeight(textarea.value).minHeight
  4044. };
  4045. }
  4046. };
  4047. const setNativeInputValue = () => {
  4048. const input2 = _ref.value;
  4049. if (!input2 || input2.value === nativeInputValue.value)
  4050. return;
  4051. input2.value = nativeInputValue.value;
  4052. };
  4053. const calcIconOffset = (place) => {
  4054. const { el } = instance.vnode;
  4055. if (!el)
  4056. return;
  4057. const elList = Array.from(el.querySelectorAll(`.${nsInput.e(place)}`));
  4058. const target = elList.find((item) => item.parentNode === el);
  4059. if (!target)
  4060. return;
  4061. const pendant = PENDANT_MAP[place];
  4062. if (slots[pendant]) {
  4063. target.style.transform = `translateX(${place === "suffix" ? "-" : ""}${el.querySelector(`.${nsInput.be("group", pendant)}`).offsetWidth}px)`;
  4064. } else {
  4065. target.removeAttribute("style");
  4066. }
  4067. };
  4068. const updateIconOffset = () => {
  4069. calcIconOffset("prefix");
  4070. calcIconOffset("suffix");
  4071. };
  4072. const handleInput = async (event) => {
  4073. const { value } = event.target;
  4074. if (isComposing.value)
  4075. return;
  4076. if (value === nativeInputValue.value)
  4077. return;
  4078. emit(UPDATE_MODEL_EVENT, value);
  4079. emit("input", value);
  4080. await nextTick();
  4081. setNativeInputValue();
  4082. };
  4083. const handleChange2 = (event) => {
  4084. emit("change", event.target.value);
  4085. };
  4086. const handleCompositionStart = (event) => {
  4087. emit("compositionstart", event);
  4088. isComposing.value = true;
  4089. };
  4090. const handleCompositionUpdate = (event) => {
  4091. var _a2;
  4092. emit("compositionupdate", event);
  4093. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  4094. const lastCharacter = text[text.length - 1] || "";
  4095. isComposing.value = !isKorean(lastCharacter);
  4096. };
  4097. const handleCompositionEnd = (event) => {
  4098. emit("compositionend", event);
  4099. if (isComposing.value) {
  4100. isComposing.value = false;
  4101. handleInput(event);
  4102. }
  4103. };
  4104. const handlePasswordVisible = () => {
  4105. passwordVisible.value = !passwordVisible.value;
  4106. focus();
  4107. };
  4108. const focus = async () => {
  4109. var _a2;
  4110. await nextTick();
  4111. (_a2 = _ref.value) == null ? void 0 : _a2.focus();
  4112. };
  4113. const blur = () => {
  4114. var _a2;
  4115. return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
  4116. };
  4117. const handleFocus = (event) => {
  4118. focused.value = true;
  4119. emit("focus", event);
  4120. };
  4121. const handleBlur = (event) => {
  4122. var _a2;
  4123. focused.value = false;
  4124. emit("blur", event);
  4125. if (props.validateEvent) {
  4126. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  4127. }
  4128. };
  4129. const handleMouseLeave = (evt) => {
  4130. hovering.value = false;
  4131. emit("mouseleave", evt);
  4132. };
  4133. const handleMouseEnter = (evt) => {
  4134. hovering.value = true;
  4135. emit("mouseenter", evt);
  4136. };
  4137. const handleKeydown = (evt) => {
  4138. emit("keydown", evt);
  4139. };
  4140. const select = () => {
  4141. var _a2;
  4142. (_a2 = _ref.value) == null ? void 0 : _a2.select();
  4143. };
  4144. const clear = () => {
  4145. emit(UPDATE_MODEL_EVENT, "");
  4146. emit("change", "");
  4147. emit("clear");
  4148. emit("input", "");
  4149. };
  4150. watch(() => props.modelValue, () => {
  4151. var _a2;
  4152. nextTick(() => resizeTextarea());
  4153. if (props.validateEvent) {
  4154. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  4155. }
  4156. });
  4157. watch(nativeInputValue, () => setNativeInputValue());
  4158. watch(() => props.type, async () => {
  4159. await nextTick();
  4160. setNativeInputValue();
  4161. resizeTextarea();
  4162. updateIconOffset();
  4163. });
  4164. onMounted(async () => {
  4165. setNativeInputValue();
  4166. updateIconOffset();
  4167. await nextTick();
  4168. resizeTextarea();
  4169. });
  4170. onUpdated(async () => {
  4171. await nextTick();
  4172. updateIconOffset();
  4173. });
  4174. expose({
  4175. input,
  4176. textarea,
  4177. ref: _ref,
  4178. textareaStyle,
  4179. autosize: toRef(props, "autosize"),
  4180. focus,
  4181. blur,
  4182. select,
  4183. clear,
  4184. resizeTextarea
  4185. });
  4186. return (_ctx, _cache) => {
  4187. return withDirectives((openBlock(), createElementBlock("div", {
  4188. class: normalizeClass([
  4189. _ctx.type === "textarea" ? unref(nsTextarea).b() : unref(nsInput).b(),
  4190. unref(nsInput).m(unref(inputSize)),
  4191. unref(nsInput).is("disabled", unref(inputDisabled)),
  4192. unref(nsInput).is("exceed", unref(inputExceed)),
  4193. {
  4194. [unref(nsInput).b("group")]: _ctx.$slots.prepend || _ctx.$slots.append,
  4195. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  4196. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend,
  4197. [unref(nsInput).m("prefix")]: _ctx.$slots.prefix || _ctx.prefixIcon,
  4198. [unref(nsInput).m("suffix")]: _ctx.$slots.suffix || _ctx.suffixIcon || _ctx.clearable || _ctx.showPassword,
  4199. [unref(nsInput).bm("suffix", "password-clear")]: unref(showClear) && unref(showPwdVisible)
  4200. },
  4201. _ctx.$attrs.class
  4202. ]),
  4203. style: normalizeStyle(unref(containerStyle)),
  4204. onMouseenter: handleMouseEnter,
  4205. onMouseleave: handleMouseLeave
  4206. }, [
  4207. createCommentVNode(" input "),
  4208. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4209. createCommentVNode(" prepend slot "),
  4210. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  4211. key: 0,
  4212. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  4213. }, [
  4214. renderSlot(_ctx.$slots, "prepend")
  4215. ], 2)) : createCommentVNode("v-if", true),
  4216. createElementVNode("div", {
  4217. class: normalizeClass([unref(nsInput).e("wrapper"), unref(nsInput).is("focus", focused.value)])
  4218. }, [
  4219. createCommentVNode(" prefix slot "),
  4220. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  4221. key: 0,
  4222. class: normalizeClass(unref(nsInput).e("prefix"))
  4223. }, [
  4224. createElementVNode("span", {
  4225. class: normalizeClass(unref(nsInput).e("prefix-inner"))
  4226. }, [
  4227. renderSlot(_ctx.$slots, "prefix"),
  4228. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4229. key: 0,
  4230. class: normalizeClass(unref(nsInput).e("icon"))
  4231. }, {
  4232. default: withCtx(() => [
  4233. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  4234. ]),
  4235. _: 1
  4236. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4237. ], 2)
  4238. ], 2)) : createCommentVNode("v-if", true),
  4239. createElementVNode("input", mergeProps({
  4240. ref_key: "input",
  4241. ref: input,
  4242. class: unref(nsInput).e("inner")
  4243. }, unref(attrs), {
  4244. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  4245. disabled: unref(inputDisabled),
  4246. readonly: _ctx.readonly,
  4247. autocomplete: _ctx.autocomplete,
  4248. tabindex: _ctx.tabindex,
  4249. "aria-label": _ctx.label,
  4250. placeholder: _ctx.placeholder,
  4251. style: _ctx.inputStyle,
  4252. onCompositionstart: handleCompositionStart,
  4253. onCompositionupdate: handleCompositionUpdate,
  4254. onCompositionend: handleCompositionEnd,
  4255. onInput: handleInput,
  4256. onFocus: handleFocus,
  4257. onBlur: handleBlur,
  4258. onChange: handleChange2,
  4259. onKeydown: handleKeydown
  4260. }), null, 16, _hoisted_1$C),
  4261. createCommentVNode(" suffix slot "),
  4262. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  4263. key: 1,
  4264. class: normalizeClass(unref(nsInput).e("suffix"))
  4265. }, [
  4266. createElementVNode("span", {
  4267. class: normalizeClass(unref(nsInput).e("suffix-inner"))
  4268. }, [
  4269. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4270. renderSlot(_ctx.$slots, "suffix"),
  4271. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4272. key: 0,
  4273. class: normalizeClass(unref(nsInput).e("icon"))
  4274. }, {
  4275. default: withCtx(() => [
  4276. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  4277. ]),
  4278. _: 1
  4279. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4280. ], 64)) : createCommentVNode("v-if", true),
  4281. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  4282. key: 1,
  4283. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  4284. onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
  4285. }, ["prevent"])),
  4286. onClick: clear
  4287. }, {
  4288. default: withCtx(() => [
  4289. createVNode(unref(circleClose))
  4290. ]),
  4291. _: 1
  4292. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4293. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  4294. key: 2,
  4295. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  4296. onClick: handlePasswordVisible
  4297. }, {
  4298. default: withCtx(() => [
  4299. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  4300. ]),
  4301. _: 1
  4302. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4303. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4304. key: 3,
  4305. class: normalizeClass(unref(nsInput).e("count"))
  4306. }, [
  4307. createElementVNode("span", {
  4308. class: normalizeClass(unref(nsInput).e("count-inner"))
  4309. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
  4310. ], 2)) : createCommentVNode("v-if", true)
  4311. ], 2),
  4312. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  4313. key: 0,
  4314. class: normalizeClass([
  4315. unref(nsInput).e("icon"),
  4316. unref(nsInput).e("validateIcon"),
  4317. unref(nsInput).is("loading", unref(validateState) === "validating")
  4318. ])
  4319. }, {
  4320. default: withCtx(() => [
  4321. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  4322. ]),
  4323. _: 1
  4324. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4325. ], 2)) : createCommentVNode("v-if", true)
  4326. ], 2),
  4327. createCommentVNode(" append slot "),
  4328. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  4329. key: 1,
  4330. class: normalizeClass(unref(nsInput).be("group", "append"))
  4331. }, [
  4332. renderSlot(_ctx.$slots, "append")
  4333. ], 2)) : createCommentVNode("v-if", true)
  4334. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  4335. createCommentVNode(" textarea "),
  4336. createElementVNode("textarea", mergeProps({
  4337. ref_key: "textarea",
  4338. ref: textarea,
  4339. class: unref(nsTextarea).e("inner")
  4340. }, unref(attrs), {
  4341. tabindex: _ctx.tabindex,
  4342. disabled: unref(inputDisabled),
  4343. readonly: _ctx.readonly,
  4344. autocomplete: _ctx.autocomplete,
  4345. style: unref(textareaStyle),
  4346. "aria-label": _ctx.label,
  4347. placeholder: _ctx.placeholder,
  4348. onCompositionstart: handleCompositionStart,
  4349. onCompositionupdate: handleCompositionUpdate,
  4350. onCompositionend: handleCompositionEnd,
  4351. onInput: handleInput,
  4352. onFocus: handleFocus,
  4353. onBlur: handleBlur,
  4354. onChange: handleChange2,
  4355. onKeydown: handleKeydown
  4356. }), null, 16, _hoisted_2$t),
  4357. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4358. key: 0,
  4359. class: normalizeClass(unref(nsInput).e("count"))
  4360. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)) : createCommentVNode("v-if", true)
  4361. ], 64))
  4362. ], 38)), [
  4363. [vShow, _ctx.type !== "hidden"]
  4364. ]);
  4365. };
  4366. }
  4367. }));
  4368. var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$14, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
  4369. const ElInput = withInstall(Input);
  4370. const BAR_MAP = {
  4371. vertical: {
  4372. offset: "offsetHeight",
  4373. scroll: "scrollTop",
  4374. scrollSize: "scrollHeight",
  4375. size: "height",
  4376. key: "vertical",
  4377. axis: "Y",
  4378. client: "clientY",
  4379. direction: "top"
  4380. },
  4381. horizontal: {
  4382. offset: "offsetWidth",
  4383. scroll: "scrollLeft",
  4384. scrollSize: "scrollWidth",
  4385. size: "width",
  4386. key: "horizontal",
  4387. axis: "X",
  4388. client: "clientX",
  4389. direction: "left"
  4390. }
  4391. };
  4392. const renderThumbStyle = ({ move, size, bar }) => ({
  4393. [bar.size]: size,
  4394. transform: `translate${bar.axis}(${move}%)`
  4395. });
  4396. const thumbProps = buildProps({
  4397. vertical: Boolean,
  4398. size: String,
  4399. move: Number,
  4400. ratio: {
  4401. type: Number,
  4402. required: true
  4403. },
  4404. always: Boolean
  4405. });
  4406. const COMPONENT_NAME$4 = "Thumb";
  4407. const _sfc_main$13 = defineComponent({
  4408. name: COMPONENT_NAME$4,
  4409. props: thumbProps,
  4410. setup(props) {
  4411. const scrollbar = inject(scrollbarContextKey);
  4412. const ns = useNamespace("scrollbar");
  4413. if (!scrollbar)
  4414. throwError(COMPONENT_NAME$4, "can not inject scrollbar context");
  4415. const instance = ref();
  4416. const thumb = ref();
  4417. const thumbState = ref({});
  4418. const visible = ref(false);
  4419. let cursorDown = false;
  4420. let cursorLeave = false;
  4421. let originalOnSelectStart = isClient$1 ? document.onselectstart : null;
  4422. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  4423. const thumbStyle = computed(() => renderThumbStyle({
  4424. size: props.size,
  4425. move: props.move,
  4426. bar: bar.value
  4427. }));
  4428. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  4429. const clickThumbHandler = (e) => {
  4430. var _a2;
  4431. e.stopPropagation();
  4432. if (e.ctrlKey || [1, 2].includes(e.button))
  4433. return;
  4434. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  4435. startDrag(e);
  4436. const el = e.currentTarget;
  4437. if (!el)
  4438. return;
  4439. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  4440. };
  4441. const clickTrackHandler = (e) => {
  4442. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  4443. return;
  4444. const offset2 = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  4445. const thumbHalf = thumb.value[bar.value.offset] / 2;
  4446. const thumbPositionPercentage = (offset2 - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4447. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4448. };
  4449. const startDrag = (e) => {
  4450. e.stopImmediatePropagation();
  4451. cursorDown = true;
  4452. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  4453. document.addEventListener("mouseup", mouseUpDocumentHandler);
  4454. originalOnSelectStart = document.onselectstart;
  4455. document.onselectstart = () => false;
  4456. };
  4457. const mouseMoveDocumentHandler = (e) => {
  4458. if (!instance.value || !thumb.value)
  4459. return;
  4460. if (cursorDown === false)
  4461. return;
  4462. const prevPage = thumbState.value[bar.value.axis];
  4463. if (!prevPage)
  4464. return;
  4465. const offset2 = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  4466. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  4467. const thumbPositionPercentage = (offset2 - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4468. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4469. };
  4470. const mouseUpDocumentHandler = () => {
  4471. cursorDown = false;
  4472. thumbState.value[bar.value.axis] = 0;
  4473. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  4474. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4475. restoreOnselectstart();
  4476. if (cursorLeave)
  4477. visible.value = false;
  4478. };
  4479. const mouseMoveScrollbarHandler = () => {
  4480. cursorLeave = false;
  4481. visible.value = !!props.size;
  4482. };
  4483. const mouseLeaveScrollbarHandler = () => {
  4484. cursorLeave = true;
  4485. visible.value = cursorDown;
  4486. };
  4487. onBeforeUnmount(() => {
  4488. restoreOnselectstart();
  4489. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4490. });
  4491. const restoreOnselectstart = () => {
  4492. if (document.onselectstart !== originalOnSelectStart)
  4493. document.onselectstart = originalOnSelectStart;
  4494. };
  4495. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  4496. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  4497. return {
  4498. ns,
  4499. instance,
  4500. thumb,
  4501. bar,
  4502. thumbStyle,
  4503. visible,
  4504. clickTrackHandler,
  4505. clickThumbHandler
  4506. };
  4507. }
  4508. });
  4509. function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
  4510. return openBlock(), createBlock(Transition, {
  4511. name: _ctx.ns.b("fade")
  4512. }, {
  4513. default: withCtx(() => [
  4514. withDirectives(createElementVNode("div", {
  4515. ref: "instance",
  4516. class: normalizeClass([_ctx.ns.e("bar"), _ctx.ns.is(_ctx.bar.key)]),
  4517. onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
  4518. }, [
  4519. createElementVNode("div", {
  4520. ref: "thumb",
  4521. class: normalizeClass(_ctx.ns.e("thumb")),
  4522. style: normalizeStyle(_ctx.thumbStyle),
  4523. onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
  4524. }, null, 38)
  4525. ], 34), [
  4526. [vShow, _ctx.always || _ctx.visible]
  4527. ])
  4528. ]),
  4529. _: 1
  4530. }, 8, ["name"]);
  4531. }
  4532. 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"]]);
  4533. const barProps = buildProps({
  4534. always: {
  4535. type: Boolean,
  4536. default: true
  4537. },
  4538. width: {
  4539. type: String,
  4540. default: ""
  4541. },
  4542. height: {
  4543. type: String,
  4544. default: ""
  4545. },
  4546. ratioX: {
  4547. type: Number,
  4548. default: 1
  4549. },
  4550. ratioY: {
  4551. type: Number,
  4552. default: 1
  4553. }
  4554. });
  4555. const _sfc_main$12 = defineComponent({
  4556. components: {
  4557. Thumb
  4558. },
  4559. props: barProps,
  4560. setup(props) {
  4561. const moveX = ref(0);
  4562. const moveY = ref(0);
  4563. const GAP = 4;
  4564. const handleScroll = (wrap) => {
  4565. if (wrap) {
  4566. const offsetHeight = wrap.offsetHeight - GAP;
  4567. const offsetWidth = wrap.offsetWidth - GAP;
  4568. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  4569. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  4570. }
  4571. };
  4572. return {
  4573. handleScroll,
  4574. moveX,
  4575. moveY
  4576. };
  4577. }
  4578. });
  4579. function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
  4580. const _component_thumb = resolveComponent("thumb");
  4581. return openBlock(), createElementBlock(Fragment, null, [
  4582. createVNode(_component_thumb, {
  4583. move: _ctx.moveX,
  4584. ratio: _ctx.ratioX,
  4585. size: _ctx.width,
  4586. always: _ctx.always
  4587. }, null, 8, ["move", "ratio", "size", "always"]),
  4588. createVNode(_component_thumb, {
  4589. move: _ctx.moveY,
  4590. ratio: _ctx.ratioY,
  4591. size: _ctx.height,
  4592. vertical: "",
  4593. always: _ctx.always
  4594. }, null, 8, ["move", "ratio", "size", "always"])
  4595. ], 64);
  4596. }
  4597. 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"]]);
  4598. const scrollbarProps = buildProps({
  4599. height: {
  4600. type: [String, Number],
  4601. default: ""
  4602. },
  4603. maxHeight: {
  4604. type: [String, Number],
  4605. default: ""
  4606. },
  4607. native: {
  4608. type: Boolean,
  4609. default: false
  4610. },
  4611. wrapStyle: {
  4612. type: definePropType([String, Object, Array]),
  4613. default: ""
  4614. },
  4615. wrapClass: {
  4616. type: [String, Array],
  4617. default: ""
  4618. },
  4619. viewClass: {
  4620. type: [String, Array],
  4621. default: ""
  4622. },
  4623. viewStyle: {
  4624. type: [String, Array, Object],
  4625. default: ""
  4626. },
  4627. noresize: Boolean,
  4628. tag: {
  4629. type: String,
  4630. default: "div"
  4631. },
  4632. always: {
  4633. type: Boolean,
  4634. default: false
  4635. },
  4636. minSize: {
  4637. type: Number,
  4638. default: 20
  4639. }
  4640. });
  4641. const scrollbarEmits = {
  4642. scroll: ({
  4643. scrollTop,
  4644. scrollLeft
  4645. }) => isNumber(scrollTop) && isNumber(scrollLeft)
  4646. };
  4647. const _sfc_main$11 = defineComponent({
  4648. name: "ElScrollbar",
  4649. components: {
  4650. Bar
  4651. },
  4652. props: scrollbarProps,
  4653. emits: scrollbarEmits,
  4654. setup(props, { emit }) {
  4655. const ns = useNamespace("scrollbar");
  4656. let stopResizeObserver = void 0;
  4657. let stopResizeListener = void 0;
  4658. const scrollbar$ = ref();
  4659. const wrap$ = ref();
  4660. const resize$ = ref();
  4661. const sizeWidth = ref("0");
  4662. const sizeHeight = ref("0");
  4663. const barRef = ref();
  4664. const moveX = ref(0);
  4665. const moveY = ref(0);
  4666. const ratioY = ref(1);
  4667. const ratioX = ref(1);
  4668. const GAP = 4;
  4669. const style = computed(() => {
  4670. const style2 = {};
  4671. if (props.height)
  4672. style2.height = addUnit(props.height);
  4673. if (props.maxHeight)
  4674. style2.maxHeight = addUnit(props.maxHeight);
  4675. return [props.wrapStyle, style2];
  4676. });
  4677. const handleScroll = () => {
  4678. var _a2;
  4679. if (wrap$.value) {
  4680. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4681. emit("scroll", {
  4682. scrollTop: wrap$.value.scrollTop,
  4683. scrollLeft: wrap$.value.scrollLeft
  4684. });
  4685. }
  4686. };
  4687. function scrollTo(arg1, arg2) {
  4688. if (isObject$1(arg1)) {
  4689. wrap$.value.scrollTo(arg1);
  4690. } else if (isNumber(arg1) && isNumber(arg2)) {
  4691. wrap$.value.scrollTo(arg1, arg2);
  4692. }
  4693. }
  4694. const setScrollTop = (value) => {
  4695. if (!isNumber(value)) {
  4696. return;
  4697. }
  4698. wrap$.value.scrollTop = value;
  4699. };
  4700. const setScrollLeft = (value) => {
  4701. if (!isNumber(value)) {
  4702. return;
  4703. }
  4704. wrap$.value.scrollLeft = value;
  4705. };
  4706. const update = () => {
  4707. if (!wrap$.value)
  4708. return;
  4709. const offsetHeight = wrap$.value.offsetHeight - GAP;
  4710. const offsetWidth = wrap$.value.offsetWidth - GAP;
  4711. const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight;
  4712. const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth;
  4713. const height = Math.max(originalHeight, props.minSize);
  4714. const width = Math.max(originalWidth, props.minSize);
  4715. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  4716. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  4717. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  4718. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  4719. };
  4720. watch(() => props.noresize, (noresize) => {
  4721. if (noresize) {
  4722. stopResizeObserver == null ? void 0 : stopResizeObserver();
  4723. stopResizeListener == null ? void 0 : stopResizeListener();
  4724. } else {
  4725. ({ stop: stopResizeObserver } = useResizeObserver(resize$, update));
  4726. stopResizeListener = useEventListener("resize", update);
  4727. }
  4728. }, { immediate: true });
  4729. watch(() => [props.maxHeight, props.height], () => {
  4730. if (!props.native)
  4731. nextTick(() => {
  4732. var _a2;
  4733. update();
  4734. if (wrap$.value) {
  4735. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4736. }
  4737. });
  4738. });
  4739. provide(scrollbarContextKey, reactive({
  4740. scrollbarElement: scrollbar$,
  4741. wrapElement: wrap$
  4742. }));
  4743. onMounted(() => {
  4744. if (!props.native)
  4745. nextTick(() => update());
  4746. });
  4747. onUpdated(() => update());
  4748. return {
  4749. ns,
  4750. scrollbar$,
  4751. wrap$,
  4752. resize$,
  4753. barRef,
  4754. moveX,
  4755. moveY,
  4756. ratioX,
  4757. ratioY,
  4758. sizeWidth,
  4759. sizeHeight,
  4760. style,
  4761. update,
  4762. handleScroll,
  4763. scrollTo,
  4764. setScrollTop,
  4765. setScrollLeft
  4766. };
  4767. }
  4768. });
  4769. function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
  4770. const _component_bar = resolveComponent("bar");
  4771. return openBlock(), createElementBlock("div", {
  4772. ref: "scrollbar$",
  4773. class: normalizeClass(_ctx.ns.b())
  4774. }, [
  4775. createElementVNode("div", {
  4776. ref: "wrap$",
  4777. class: normalizeClass([
  4778. _ctx.wrapClass,
  4779. _ctx.ns.e("wrap"),
  4780. { [_ctx.ns.em("wrap", "hidden-default")]: !_ctx.native }
  4781. ]),
  4782. style: normalizeStyle(_ctx.style),
  4783. onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
  4784. }, [
  4785. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  4786. ref: "resize$",
  4787. class: normalizeClass([_ctx.ns.e("view"), _ctx.viewClass]),
  4788. style: normalizeStyle(_ctx.viewStyle)
  4789. }, {
  4790. default: withCtx(() => [
  4791. renderSlot(_ctx.$slots, "default")
  4792. ]),
  4793. _: 3
  4794. }, 8, ["class", "style"]))
  4795. ], 38),
  4796. !_ctx.native ? (openBlock(), createBlock(_component_bar, {
  4797. key: 0,
  4798. ref: "barRef",
  4799. height: _ctx.sizeHeight,
  4800. width: _ctx.sizeWidth,
  4801. always: _ctx.always,
  4802. "ratio-x": _ctx.ratioX,
  4803. "ratio-y": _ctx.ratioY
  4804. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
  4805. ], 2);
  4806. }
  4807. 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"]]);
  4808. const ElScrollbar = withInstall(Scrollbar);
  4809. const __default__$j = {
  4810. name: "ElPopperRoot",
  4811. inheritAttrs: false
  4812. };
  4813. const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$j), {
  4814. setup(__props, { expose }) {
  4815. const triggerRef2 = ref();
  4816. const popperInstanceRef = ref();
  4817. const contentRef = ref();
  4818. const referenceRef = ref();
  4819. const popperProvides = {
  4820. triggerRef: triggerRef2,
  4821. popperInstanceRef,
  4822. contentRef,
  4823. referenceRef
  4824. };
  4825. expose(popperProvides);
  4826. provide(POPPER_INJECTION_KEY, popperProvides);
  4827. return (_ctx, _cache) => {
  4828. return renderSlot(_ctx.$slots, "default");
  4829. };
  4830. }
  4831. }));
  4832. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$10, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
  4833. const usePopperArrowProps = buildProps({
  4834. arrowOffset: {
  4835. type: Number,
  4836. default: 5
  4837. }
  4838. });
  4839. const __default__$i = {
  4840. name: "ElPopperArrow",
  4841. inheritAttrs: false
  4842. };
  4843. const _sfc_main$$ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$i), {
  4844. props: usePopperArrowProps,
  4845. setup(__props, { expose }) {
  4846. const props = __props;
  4847. const ns = useNamespace("popper");
  4848. const { arrowOffset, arrowRef } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  4849. watch(() => props.arrowOffset, (val) => {
  4850. arrowOffset.value = val;
  4851. });
  4852. onBeforeUnmount(() => {
  4853. arrowRef.value = void 0;
  4854. });
  4855. expose({
  4856. arrowRef
  4857. });
  4858. return (_ctx, _cache) => {
  4859. return openBlock(), createElementBlock("span", {
  4860. ref_key: "arrowRef",
  4861. ref: arrowRef,
  4862. class: normalizeClass(unref(ns).e("arrow")),
  4863. "data-popper-arrow": ""
  4864. }, null, 2);
  4865. };
  4866. }
  4867. }));
  4868. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
  4869. const NAME = "ElOnlyChild";
  4870. const OnlyChild = defineComponent({
  4871. name: NAME,
  4872. setup(_2, {
  4873. slots,
  4874. attrs
  4875. }) {
  4876. var _a2;
  4877. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  4878. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  4879. return () => {
  4880. var _a22;
  4881. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  4882. if (!defaultSlot)
  4883. return null;
  4884. if (defaultSlot.length > 1) {
  4885. return null;
  4886. }
  4887. const firstLegitNode = findFirstLegitChild(defaultSlot);
  4888. if (!firstLegitNode) {
  4889. return null;
  4890. }
  4891. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  4892. };
  4893. }
  4894. });
  4895. function findFirstLegitChild(node) {
  4896. if (!node)
  4897. return null;
  4898. const children = node;
  4899. for (const child of children) {
  4900. if (isObject$1(child)) {
  4901. switch (child.type) {
  4902. case Comment:
  4903. continue;
  4904. case Text:
  4905. return wrapTextContent(child);
  4906. case "svg":
  4907. return wrapTextContent(child);
  4908. case Fragment:
  4909. return findFirstLegitChild(child.children);
  4910. default:
  4911. return child;
  4912. }
  4913. }
  4914. return wrapTextContent(child);
  4915. }
  4916. return null;
  4917. }
  4918. function wrapTextContent(s2) {
  4919. return createVNode("span", {
  4920. "class": "el-only-child__content"
  4921. }, [s2]);
  4922. }
  4923. const usePopperTriggerProps = buildProps({
  4924. virtualRef: {
  4925. type: definePropType(Object)
  4926. },
  4927. virtualTriggering: Boolean,
  4928. onMouseenter: Function,
  4929. onMouseleave: Function,
  4930. onClick: Function,
  4931. onKeydown: Function,
  4932. onFocus: Function,
  4933. onBlur: Function,
  4934. onContextmenu: Function,
  4935. id: String,
  4936. open: Boolean
  4937. });
  4938. const __default__$h = {
  4939. name: "ElPopperTrigger",
  4940. inheritAttrs: false
  4941. };
  4942. const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$h), {
  4943. props: usePopperTriggerProps,
  4944. setup(__props, { expose }) {
  4945. const props = __props;
  4946. const { triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  4947. useForwardRef(triggerRef2);
  4948. onMounted(() => {
  4949. watch(() => props.virtualRef, (virtualEl) => {
  4950. if (virtualEl) {
  4951. triggerRef2.value = unrefElement(virtualEl);
  4952. }
  4953. }, {
  4954. immediate: true
  4955. });
  4956. watch(() => triggerRef2.value, (el, prevEl) => {
  4957. if (isElement$1(el)) {
  4958. [
  4959. "onMouseenter",
  4960. "onMouseleave",
  4961. "onClick",
  4962. "onKeydown",
  4963. "onFocus",
  4964. "onBlur",
  4965. "onContextmenu"
  4966. ].forEach((eventName) => {
  4967. var _a2;
  4968. const handler3 = props[eventName];
  4969. if (handler3) {
  4970. el.addEventListener(eventName.slice(2).toLowerCase(), handler3);
  4971. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler3);
  4972. }
  4973. });
  4974. }
  4975. }, {
  4976. immediate: true
  4977. });
  4978. });
  4979. expose({
  4980. triggerRef: triggerRef2
  4981. });
  4982. return (_ctx, _cache) => {
  4983. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  4984. "aria-describedby": _ctx.open ? _ctx.id : void 0
  4985. }), {
  4986. default: withCtx(() => [
  4987. renderSlot(_ctx.$slots, "default")
  4988. ]),
  4989. _: 3
  4990. }, 16, ["aria-describedby"])) : createCommentVNode("v-if", true);
  4991. };
  4992. }
  4993. }));
  4994. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$_, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
  4995. var top = "top";
  4996. var bottom = "bottom";
  4997. var right = "right";
  4998. var left = "left";
  4999. var auto = "auto";
  5000. var basePlacements = [top, bottom, right, left];
  5001. var start = "start";
  5002. var end = "end";
  5003. var clippingParents = "clippingParents";
  5004. var viewport = "viewport";
  5005. var popper = "popper";
  5006. var reference = "reference";
  5007. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  5008. return acc.concat([placement + "-" + start, placement + "-" + end]);
  5009. }, []);
  5010. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  5011. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  5012. }, []);
  5013. var beforeRead = "beforeRead";
  5014. var read = "read";
  5015. var afterRead = "afterRead";
  5016. var beforeMain = "beforeMain";
  5017. var main = "main";
  5018. var afterMain = "afterMain";
  5019. var beforeWrite = "beforeWrite";
  5020. var write = "write";
  5021. var afterWrite = "afterWrite";
  5022. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  5023. function getNodeName(element) {
  5024. return element ? (element.nodeName || "").toLowerCase() : null;
  5025. }
  5026. function getWindow(node) {
  5027. if (node == null) {
  5028. return window;
  5029. }
  5030. if (node.toString() !== "[object Window]") {
  5031. var ownerDocument = node.ownerDocument;
  5032. return ownerDocument ? ownerDocument.defaultView || window : window;
  5033. }
  5034. return node;
  5035. }
  5036. function isElement(node) {
  5037. var OwnElement = getWindow(node).Element;
  5038. return node instanceof OwnElement || node instanceof Element;
  5039. }
  5040. function isHTMLElement(node) {
  5041. var OwnElement = getWindow(node).HTMLElement;
  5042. return node instanceof OwnElement || node instanceof HTMLElement;
  5043. }
  5044. function isShadowRoot(node) {
  5045. if (typeof ShadowRoot === "undefined") {
  5046. return false;
  5047. }
  5048. var OwnElement = getWindow(node).ShadowRoot;
  5049. return node instanceof OwnElement || node instanceof ShadowRoot;
  5050. }
  5051. function applyStyles(_ref) {
  5052. var state = _ref.state;
  5053. Object.keys(state.elements).forEach(function(name) {
  5054. var style = state.styles[name] || {};
  5055. var attributes = state.attributes[name] || {};
  5056. var element = state.elements[name];
  5057. if (!isHTMLElement(element) || !getNodeName(element)) {
  5058. return;
  5059. }
  5060. Object.assign(element.style, style);
  5061. Object.keys(attributes).forEach(function(name2) {
  5062. var value = attributes[name2];
  5063. if (value === false) {
  5064. element.removeAttribute(name2);
  5065. } else {
  5066. element.setAttribute(name2, value === true ? "" : value);
  5067. }
  5068. });
  5069. });
  5070. }
  5071. function effect$2(_ref2) {
  5072. var state = _ref2.state;
  5073. var initialStyles = {
  5074. popper: {
  5075. position: state.options.strategy,
  5076. left: "0",
  5077. top: "0",
  5078. margin: "0"
  5079. },
  5080. arrow: {
  5081. position: "absolute"
  5082. },
  5083. reference: {}
  5084. };
  5085. Object.assign(state.elements.popper.style, initialStyles.popper);
  5086. state.styles = initialStyles;
  5087. if (state.elements.arrow) {
  5088. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  5089. }
  5090. return function() {
  5091. Object.keys(state.elements).forEach(function(name) {
  5092. var element = state.elements[name];
  5093. var attributes = state.attributes[name] || {};
  5094. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  5095. var style = styleProperties.reduce(function(style2, property) {
  5096. style2[property] = "";
  5097. return style2;
  5098. }, {});
  5099. if (!isHTMLElement(element) || !getNodeName(element)) {
  5100. return;
  5101. }
  5102. Object.assign(element.style, style);
  5103. Object.keys(attributes).forEach(function(attribute) {
  5104. element.removeAttribute(attribute);
  5105. });
  5106. });
  5107. };
  5108. }
  5109. var applyStyles$1 = {
  5110. name: "applyStyles",
  5111. enabled: true,
  5112. phase: "write",
  5113. fn: applyStyles,
  5114. effect: effect$2,
  5115. requires: ["computeStyles"]
  5116. };
  5117. function getBasePlacement(placement) {
  5118. return placement.split("-")[0];
  5119. }
  5120. var max = Math.max;
  5121. var min = Math.min;
  5122. var round = Math.round;
  5123. function getBoundingClientRect(element, includeScale) {
  5124. if (includeScale === void 0) {
  5125. includeScale = false;
  5126. }
  5127. var rect = element.getBoundingClientRect();
  5128. var scaleX = 1;
  5129. var scaleY = 1;
  5130. if (isHTMLElement(element) && includeScale) {
  5131. var offsetHeight = element.offsetHeight;
  5132. var offsetWidth = element.offsetWidth;
  5133. if (offsetWidth > 0) {
  5134. scaleX = round(rect.width) / offsetWidth || 1;
  5135. }
  5136. if (offsetHeight > 0) {
  5137. scaleY = round(rect.height) / offsetHeight || 1;
  5138. }
  5139. }
  5140. return {
  5141. width: rect.width / scaleX,
  5142. height: rect.height / scaleY,
  5143. top: rect.top / scaleY,
  5144. right: rect.right / scaleX,
  5145. bottom: rect.bottom / scaleY,
  5146. left: rect.left / scaleX,
  5147. x: rect.left / scaleX,
  5148. y: rect.top / scaleY
  5149. };
  5150. }
  5151. function getLayoutRect(element) {
  5152. var clientRect = getBoundingClientRect(element);
  5153. var width = element.offsetWidth;
  5154. var height = element.offsetHeight;
  5155. if (Math.abs(clientRect.width - width) <= 1) {
  5156. width = clientRect.width;
  5157. }
  5158. if (Math.abs(clientRect.height - height) <= 1) {
  5159. height = clientRect.height;
  5160. }
  5161. return {
  5162. x: element.offsetLeft,
  5163. y: element.offsetTop,
  5164. width,
  5165. height
  5166. };
  5167. }
  5168. function contains(parent, child) {
  5169. var rootNode = child.getRootNode && child.getRootNode();
  5170. if (parent.contains(child)) {
  5171. return true;
  5172. } else if (rootNode && isShadowRoot(rootNode)) {
  5173. var next = child;
  5174. do {
  5175. if (next && parent.isSameNode(next)) {
  5176. return true;
  5177. }
  5178. next = next.parentNode || next.host;
  5179. } while (next);
  5180. }
  5181. return false;
  5182. }
  5183. function getComputedStyle$1(element) {
  5184. return getWindow(element).getComputedStyle(element);
  5185. }
  5186. function isTableElement(element) {
  5187. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  5188. }
  5189. function getDocumentElement(element) {
  5190. return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
  5191. }
  5192. function getParentNode(element) {
  5193. if (getNodeName(element) === "html") {
  5194. return element;
  5195. }
  5196. return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
  5197. }
  5198. function getTrueOffsetParent(element) {
  5199. if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
  5200. return null;
  5201. }
  5202. return element.offsetParent;
  5203. }
  5204. function getContainingBlock(element) {
  5205. var isFirefox2 = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
  5206. var isIE = navigator.userAgent.indexOf("Trident") !== -1;
  5207. if (isIE && isHTMLElement(element)) {
  5208. var elementCss = getComputedStyle$1(element);
  5209. if (elementCss.position === "fixed") {
  5210. return null;
  5211. }
  5212. }
  5213. var currentNode = getParentNode(element);
  5214. if (isShadowRoot(currentNode)) {
  5215. currentNode = currentNode.host;
  5216. }
  5217. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  5218. var css = getComputedStyle$1(currentNode);
  5219. 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") {
  5220. return currentNode;
  5221. } else {
  5222. currentNode = currentNode.parentNode;
  5223. }
  5224. }
  5225. return null;
  5226. }
  5227. function getOffsetParent(element) {
  5228. var window2 = getWindow(element);
  5229. var offsetParent = getTrueOffsetParent(element);
  5230. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
  5231. offsetParent = getTrueOffsetParent(offsetParent);
  5232. }
  5233. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
  5234. return window2;
  5235. }
  5236. return offsetParent || getContainingBlock(element) || window2;
  5237. }
  5238. function getMainAxisFromPlacement(placement) {
  5239. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  5240. }
  5241. function within(min$1, value, max$1) {
  5242. return max(min$1, min(value, max$1));
  5243. }
  5244. function withinMaxClamp(min2, value, max2) {
  5245. var v2 = within(min2, value, max2);
  5246. return v2 > max2 ? max2 : v2;
  5247. }
  5248. function getFreshSideObject() {
  5249. return {
  5250. top: 0,
  5251. right: 0,
  5252. bottom: 0,
  5253. left: 0
  5254. };
  5255. }
  5256. function mergePaddingObject(paddingObject) {
  5257. return Object.assign({}, getFreshSideObject(), paddingObject);
  5258. }
  5259. function expandToHashMap(value, keys2) {
  5260. return keys2.reduce(function(hashMap, key) {
  5261. hashMap[key] = value;
  5262. return hashMap;
  5263. }, {});
  5264. }
  5265. var toPaddingObject = function toPaddingObject2(padding, state) {
  5266. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  5267. placement: state.placement
  5268. })) : padding;
  5269. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5270. };
  5271. function arrow(_ref) {
  5272. var _state$modifiersData$;
  5273. var state = _ref.state, name = _ref.name, options = _ref.options;
  5274. var arrowElement = state.elements.arrow;
  5275. var popperOffsets2 = state.modifiersData.popperOffsets;
  5276. var basePlacement = getBasePlacement(state.placement);
  5277. var axis = getMainAxisFromPlacement(basePlacement);
  5278. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  5279. var len = isVertical ? "height" : "width";
  5280. if (!arrowElement || !popperOffsets2) {
  5281. return;
  5282. }
  5283. var paddingObject = toPaddingObject(options.padding, state);
  5284. var arrowRect = getLayoutRect(arrowElement);
  5285. var minProp = axis === "y" ? top : left;
  5286. var maxProp = axis === "y" ? bottom : right;
  5287. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  5288. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  5289. var arrowOffsetParent = getOffsetParent(arrowElement);
  5290. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  5291. var centerToReference = endDiff / 2 - startDiff / 2;
  5292. var min2 = paddingObject[minProp];
  5293. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  5294. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  5295. var offset2 = within(min2, center, max2);
  5296. var axisProp = axis;
  5297. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  5298. }
  5299. function effect$1(_ref2) {
  5300. var state = _ref2.state, options = _ref2.options;
  5301. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  5302. if (arrowElement == null) {
  5303. return;
  5304. }
  5305. if (typeof arrowElement === "string") {
  5306. arrowElement = state.elements.popper.querySelector(arrowElement);
  5307. if (!arrowElement) {
  5308. return;
  5309. }
  5310. }
  5311. if (!contains(state.elements.popper, arrowElement)) {
  5312. return;
  5313. }
  5314. state.elements.arrow = arrowElement;
  5315. }
  5316. var arrow$1 = {
  5317. name: "arrow",
  5318. enabled: true,
  5319. phase: "main",
  5320. fn: arrow,
  5321. effect: effect$1,
  5322. requires: ["popperOffsets"],
  5323. requiresIfExists: ["preventOverflow"]
  5324. };
  5325. function getVariation(placement) {
  5326. return placement.split("-")[1];
  5327. }
  5328. var unsetSides = {
  5329. top: "auto",
  5330. right: "auto",
  5331. bottom: "auto",
  5332. left: "auto"
  5333. };
  5334. function roundOffsetsByDPR(_ref) {
  5335. var x2 = _ref.x, y = _ref.y;
  5336. var win = window;
  5337. var dpr = win.devicePixelRatio || 1;
  5338. return {
  5339. x: round(x2 * dpr) / dpr || 0,
  5340. y: round(y * dpr) / dpr || 0
  5341. };
  5342. }
  5343. function mapToStyles(_ref2) {
  5344. var _Object$assign2;
  5345. 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;
  5346. 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;
  5347. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  5348. x: x2,
  5349. y
  5350. }) : {
  5351. x: x2,
  5352. y
  5353. };
  5354. x2 = _ref3.x;
  5355. y = _ref3.y;
  5356. var hasX = offsets.hasOwnProperty("x");
  5357. var hasY = offsets.hasOwnProperty("y");
  5358. var sideX = left;
  5359. var sideY = top;
  5360. var win = window;
  5361. if (adaptive) {
  5362. var offsetParent = getOffsetParent(popper2);
  5363. var heightProp = "clientHeight";
  5364. var widthProp = "clientWidth";
  5365. if (offsetParent === getWindow(popper2)) {
  5366. offsetParent = getDocumentElement(popper2);
  5367. if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
  5368. heightProp = "scrollHeight";
  5369. widthProp = "scrollWidth";
  5370. }
  5371. }
  5372. offsetParent = offsetParent;
  5373. if (placement === top || (placement === left || placement === right) && variation === end) {
  5374. sideY = bottom;
  5375. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
  5376. y -= offsetY - popperRect.height;
  5377. y *= gpuAcceleration ? 1 : -1;
  5378. }
  5379. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  5380. sideX = right;
  5381. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
  5382. x2 -= offsetX - popperRect.width;
  5383. x2 *= gpuAcceleration ? 1 : -1;
  5384. }
  5385. }
  5386. var commonStyles = Object.assign({
  5387. position
  5388. }, adaptive && unsetSides);
  5389. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  5390. x: x2,
  5391. y
  5392. }) : {
  5393. x: x2,
  5394. y
  5395. };
  5396. x2 = _ref4.x;
  5397. y = _ref4.y;
  5398. if (gpuAcceleration) {
  5399. var _Object$assign;
  5400. 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));
  5401. }
  5402. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x2 + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  5403. }
  5404. function computeStyles(_ref5) {
  5405. var state = _ref5.state, options = _ref5.options;
  5406. 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;
  5407. var commonStyles = {
  5408. placement: getBasePlacement(state.placement),
  5409. variation: getVariation(state.placement),
  5410. popper: state.elements.popper,
  5411. popperRect: state.rects.popper,
  5412. gpuAcceleration,
  5413. isFixed: state.options.strategy === "fixed"
  5414. };
  5415. if (state.modifiersData.popperOffsets != null) {
  5416. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  5417. offsets: state.modifiersData.popperOffsets,
  5418. position: state.options.strategy,
  5419. adaptive,
  5420. roundOffsets
  5421. })));
  5422. }
  5423. if (state.modifiersData.arrow != null) {
  5424. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  5425. offsets: state.modifiersData.arrow,
  5426. position: "absolute",
  5427. adaptive: false,
  5428. roundOffsets
  5429. })));
  5430. }
  5431. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5432. "data-popper-placement": state.placement
  5433. });
  5434. }
  5435. var computeStyles$1 = {
  5436. name: "computeStyles",
  5437. enabled: true,
  5438. phase: "beforeWrite",
  5439. fn: computeStyles,
  5440. data: {}
  5441. };
  5442. var passive = {
  5443. passive: true
  5444. };
  5445. function effect(_ref) {
  5446. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  5447. 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;
  5448. var window2 = getWindow(state.elements.popper);
  5449. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  5450. if (scroll) {
  5451. scrollParents.forEach(function(scrollParent) {
  5452. scrollParent.addEventListener("scroll", instance.update, passive);
  5453. });
  5454. }
  5455. if (resize) {
  5456. window2.addEventListener("resize", instance.update, passive);
  5457. }
  5458. return function() {
  5459. if (scroll) {
  5460. scrollParents.forEach(function(scrollParent) {
  5461. scrollParent.removeEventListener("scroll", instance.update, passive);
  5462. });
  5463. }
  5464. if (resize) {
  5465. window2.removeEventListener("resize", instance.update, passive);
  5466. }
  5467. };
  5468. }
  5469. var eventListeners = {
  5470. name: "eventListeners",
  5471. enabled: true,
  5472. phase: "write",
  5473. fn: function fn() {
  5474. },
  5475. effect,
  5476. data: {}
  5477. };
  5478. var hash$1 = {
  5479. left: "right",
  5480. right: "left",
  5481. bottom: "top",
  5482. top: "bottom"
  5483. };
  5484. function getOppositePlacement(placement) {
  5485. return placement.replace(/left|right|bottom|top/g, function(matched) {
  5486. return hash$1[matched];
  5487. });
  5488. }
  5489. var hash = {
  5490. start: "end",
  5491. end: "start"
  5492. };
  5493. function getOppositeVariationPlacement(placement) {
  5494. return placement.replace(/start|end/g, function(matched) {
  5495. return hash[matched];
  5496. });
  5497. }
  5498. function getWindowScroll(node) {
  5499. var win = getWindow(node);
  5500. var scrollLeft = win.pageXOffset;
  5501. var scrollTop = win.pageYOffset;
  5502. return {
  5503. scrollLeft,
  5504. scrollTop
  5505. };
  5506. }
  5507. function getWindowScrollBarX(element) {
  5508. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  5509. }
  5510. function getViewportRect(element) {
  5511. var win = getWindow(element);
  5512. var html = getDocumentElement(element);
  5513. var visualViewport = win.visualViewport;
  5514. var width = html.clientWidth;
  5515. var height = html.clientHeight;
  5516. var x2 = 0;
  5517. var y = 0;
  5518. if (visualViewport) {
  5519. width = visualViewport.width;
  5520. height = visualViewport.height;
  5521. if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
  5522. x2 = visualViewport.offsetLeft;
  5523. y = visualViewport.offsetTop;
  5524. }
  5525. }
  5526. return {
  5527. width,
  5528. height,
  5529. x: x2 + getWindowScrollBarX(element),
  5530. y
  5531. };
  5532. }
  5533. function getDocumentRect(element) {
  5534. var _element$ownerDocumen;
  5535. var html = getDocumentElement(element);
  5536. var winScroll = getWindowScroll(element);
  5537. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  5538. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  5539. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  5540. var x2 = -winScroll.scrollLeft + getWindowScrollBarX(element);
  5541. var y = -winScroll.scrollTop;
  5542. if (getComputedStyle$1(body || html).direction === "rtl") {
  5543. x2 += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  5544. }
  5545. return {
  5546. width,
  5547. height,
  5548. x: x2,
  5549. y
  5550. };
  5551. }
  5552. function isScrollParent(element) {
  5553. var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  5554. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  5555. }
  5556. function getScrollParent(node) {
  5557. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  5558. return node.ownerDocument.body;
  5559. }
  5560. if (isHTMLElement(node) && isScrollParent(node)) {
  5561. return node;
  5562. }
  5563. return getScrollParent(getParentNode(node));
  5564. }
  5565. function listScrollParents(element, list) {
  5566. var _element$ownerDocumen;
  5567. if (list === void 0) {
  5568. list = [];
  5569. }
  5570. var scrollParent = getScrollParent(element);
  5571. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  5572. var win = getWindow(scrollParent);
  5573. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  5574. var updatedList = list.concat(target);
  5575. return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
  5576. }
  5577. function rectToClientRect(rect) {
  5578. return Object.assign({}, rect, {
  5579. left: rect.x,
  5580. top: rect.y,
  5581. right: rect.x + rect.width,
  5582. bottom: rect.y + rect.height
  5583. });
  5584. }
  5585. function getInnerBoundingClientRect(element) {
  5586. var rect = getBoundingClientRect(element);
  5587. rect.top = rect.top + element.clientTop;
  5588. rect.left = rect.left + element.clientLeft;
  5589. rect.bottom = rect.top + element.clientHeight;
  5590. rect.right = rect.left + element.clientWidth;
  5591. rect.width = element.clientWidth;
  5592. rect.height = element.clientHeight;
  5593. rect.x = rect.left;
  5594. rect.y = rect.top;
  5595. return rect;
  5596. }
  5597. function getClientRectFromMixedType(element, clippingParent) {
  5598. return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  5599. }
  5600. function getClippingParents(element) {
  5601. var clippingParents2 = listScrollParents(getParentNode(element));
  5602. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
  5603. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  5604. if (!isElement(clipperElement)) {
  5605. return [];
  5606. }
  5607. return clippingParents2.filter(function(clippingParent) {
  5608. return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  5609. });
  5610. }
  5611. function getClippingRect(element, boundary, rootBoundary) {
  5612. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  5613. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  5614. var firstClippingParent = clippingParents2[0];
  5615. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  5616. var rect = getClientRectFromMixedType(element, clippingParent);
  5617. accRect.top = max(rect.top, accRect.top);
  5618. accRect.right = min(rect.right, accRect.right);
  5619. accRect.bottom = min(rect.bottom, accRect.bottom);
  5620. accRect.left = max(rect.left, accRect.left);
  5621. return accRect;
  5622. }, getClientRectFromMixedType(element, firstClippingParent));
  5623. clippingRect.width = clippingRect.right - clippingRect.left;
  5624. clippingRect.height = clippingRect.bottom - clippingRect.top;
  5625. clippingRect.x = clippingRect.left;
  5626. clippingRect.y = clippingRect.top;
  5627. return clippingRect;
  5628. }
  5629. function computeOffsets(_ref) {
  5630. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  5631. var basePlacement = placement ? getBasePlacement(placement) : null;
  5632. var variation = placement ? getVariation(placement) : null;
  5633. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  5634. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  5635. var offsets;
  5636. switch (basePlacement) {
  5637. case top:
  5638. offsets = {
  5639. x: commonX,
  5640. y: reference2.y - element.height
  5641. };
  5642. break;
  5643. case bottom:
  5644. offsets = {
  5645. x: commonX,
  5646. y: reference2.y + reference2.height
  5647. };
  5648. break;
  5649. case right:
  5650. offsets = {
  5651. x: reference2.x + reference2.width,
  5652. y: commonY
  5653. };
  5654. break;
  5655. case left:
  5656. offsets = {
  5657. x: reference2.x - element.width,
  5658. y: commonY
  5659. };
  5660. break;
  5661. default:
  5662. offsets = {
  5663. x: reference2.x,
  5664. y: reference2.y
  5665. };
  5666. }
  5667. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  5668. if (mainAxis != null) {
  5669. var len = mainAxis === "y" ? "height" : "width";
  5670. switch (variation) {
  5671. case start:
  5672. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  5673. break;
  5674. case end:
  5675. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  5676. break;
  5677. }
  5678. }
  5679. return offsets;
  5680. }
  5681. function detectOverflow(state, options) {
  5682. if (options === void 0) {
  5683. options = {};
  5684. }
  5685. 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;
  5686. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5687. var altContext = elementContext === popper ? reference : popper;
  5688. var popperRect = state.rects.popper;
  5689. var element = state.elements[altBoundary ? altContext : elementContext];
  5690. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
  5691. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  5692. var popperOffsets2 = computeOffsets({
  5693. reference: referenceClientRect,
  5694. element: popperRect,
  5695. strategy: "absolute",
  5696. placement
  5697. });
  5698. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  5699. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  5700. var overflowOffsets = {
  5701. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  5702. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  5703. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  5704. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  5705. };
  5706. var offsetData = state.modifiersData.offset;
  5707. if (elementContext === popper && offsetData) {
  5708. var offset2 = offsetData[placement];
  5709. Object.keys(overflowOffsets).forEach(function(key) {
  5710. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  5711. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  5712. overflowOffsets[key] += offset2[axis] * multiply;
  5713. });
  5714. }
  5715. return overflowOffsets;
  5716. }
  5717. function computeAutoPlacement(state, options) {
  5718. if (options === void 0) {
  5719. options = {};
  5720. }
  5721. 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;
  5722. var variation = getVariation(placement);
  5723. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  5724. return getVariation(placement2) === variation;
  5725. }) : basePlacements;
  5726. var allowedPlacements = placements$1.filter(function(placement2) {
  5727. return allowedAutoPlacements.indexOf(placement2) >= 0;
  5728. });
  5729. if (allowedPlacements.length === 0) {
  5730. allowedPlacements = placements$1;
  5731. }
  5732. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  5733. acc[placement2] = detectOverflow(state, {
  5734. placement: placement2,
  5735. boundary,
  5736. rootBoundary,
  5737. padding
  5738. })[getBasePlacement(placement2)];
  5739. return acc;
  5740. }, {});
  5741. return Object.keys(overflows).sort(function(a2, b2) {
  5742. return overflows[a2] - overflows[b2];
  5743. });
  5744. }
  5745. function getExpandedFallbackPlacements(placement) {
  5746. if (getBasePlacement(placement) === auto) {
  5747. return [];
  5748. }
  5749. var oppositePlacement = getOppositePlacement(placement);
  5750. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  5751. }
  5752. function flip(_ref) {
  5753. var state = _ref.state, options = _ref.options, name = _ref.name;
  5754. if (state.modifiersData[name]._skip) {
  5755. return;
  5756. }
  5757. 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;
  5758. var preferredPlacement = state.options.placement;
  5759. var basePlacement = getBasePlacement(preferredPlacement);
  5760. var isBasePlacement = basePlacement === preferredPlacement;
  5761. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  5762. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  5763. return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
  5764. placement: placement2,
  5765. boundary,
  5766. rootBoundary,
  5767. padding,
  5768. flipVariations,
  5769. allowedAutoPlacements
  5770. }) : placement2);
  5771. }, []);
  5772. var referenceRect = state.rects.reference;
  5773. var popperRect = state.rects.popper;
  5774. var checksMap = /* @__PURE__ */ new Map();
  5775. var makeFallbackChecks = true;
  5776. var firstFittingPlacement = placements2[0];
  5777. for (var i = 0; i < placements2.length; i++) {
  5778. var placement = placements2[i];
  5779. var _basePlacement = getBasePlacement(placement);
  5780. var isStartVariation = getVariation(placement) === start;
  5781. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  5782. var len = isVertical ? "width" : "height";
  5783. var overflow = detectOverflow(state, {
  5784. placement,
  5785. boundary,
  5786. rootBoundary,
  5787. altBoundary,
  5788. padding
  5789. });
  5790. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  5791. if (referenceRect[len] > popperRect[len]) {
  5792. mainVariationSide = getOppositePlacement(mainVariationSide);
  5793. }
  5794. var altVariationSide = getOppositePlacement(mainVariationSide);
  5795. var checks = [];
  5796. if (checkMainAxis) {
  5797. checks.push(overflow[_basePlacement] <= 0);
  5798. }
  5799. if (checkAltAxis) {
  5800. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  5801. }
  5802. if (checks.every(function(check2) {
  5803. return check2;
  5804. })) {
  5805. firstFittingPlacement = placement;
  5806. makeFallbackChecks = false;
  5807. break;
  5808. }
  5809. checksMap.set(placement, checks);
  5810. }
  5811. if (makeFallbackChecks) {
  5812. var numberOfChecks = flipVariations ? 3 : 1;
  5813. var _loop = function _loop2(_i2) {
  5814. var fittingPlacement = placements2.find(function(placement2) {
  5815. var checks2 = checksMap.get(placement2);
  5816. if (checks2) {
  5817. return checks2.slice(0, _i2).every(function(check2) {
  5818. return check2;
  5819. });
  5820. }
  5821. });
  5822. if (fittingPlacement) {
  5823. firstFittingPlacement = fittingPlacement;
  5824. return "break";
  5825. }
  5826. };
  5827. for (var _i = numberOfChecks; _i > 0; _i--) {
  5828. var _ret = _loop(_i);
  5829. if (_ret === "break")
  5830. break;
  5831. }
  5832. }
  5833. if (state.placement !== firstFittingPlacement) {
  5834. state.modifiersData[name]._skip = true;
  5835. state.placement = firstFittingPlacement;
  5836. state.reset = true;
  5837. }
  5838. }
  5839. var flip$1 = {
  5840. name: "flip",
  5841. enabled: true,
  5842. phase: "main",
  5843. fn: flip,
  5844. requiresIfExists: ["offset"],
  5845. data: {
  5846. _skip: false
  5847. }
  5848. };
  5849. function getSideOffsets(overflow, rect, preventedOffsets) {
  5850. if (preventedOffsets === void 0) {
  5851. preventedOffsets = {
  5852. x: 0,
  5853. y: 0
  5854. };
  5855. }
  5856. return {
  5857. top: overflow.top - rect.height - preventedOffsets.y,
  5858. right: overflow.right - rect.width + preventedOffsets.x,
  5859. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  5860. left: overflow.left - rect.width - preventedOffsets.x
  5861. };
  5862. }
  5863. function isAnySideFullyClipped(overflow) {
  5864. return [top, right, bottom, left].some(function(side) {
  5865. return overflow[side] >= 0;
  5866. });
  5867. }
  5868. function hide(_ref) {
  5869. var state = _ref.state, name = _ref.name;
  5870. var referenceRect = state.rects.reference;
  5871. var popperRect = state.rects.popper;
  5872. var preventedOffsets = state.modifiersData.preventOverflow;
  5873. var referenceOverflow = detectOverflow(state, {
  5874. elementContext: "reference"
  5875. });
  5876. var popperAltOverflow = detectOverflow(state, {
  5877. altBoundary: true
  5878. });
  5879. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  5880. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  5881. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  5882. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  5883. state.modifiersData[name] = {
  5884. referenceClippingOffsets,
  5885. popperEscapeOffsets,
  5886. isReferenceHidden,
  5887. hasPopperEscaped
  5888. };
  5889. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5890. "data-popper-reference-hidden": isReferenceHidden,
  5891. "data-popper-escaped": hasPopperEscaped
  5892. });
  5893. }
  5894. var hide$1 = {
  5895. name: "hide",
  5896. enabled: true,
  5897. phase: "main",
  5898. requiresIfExists: ["preventOverflow"],
  5899. fn: hide
  5900. };
  5901. function distanceAndSkiddingToXY(placement, rects, offset2) {
  5902. var basePlacement = getBasePlacement(placement);
  5903. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  5904. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  5905. placement
  5906. })) : offset2, skidding = _ref[0], distance = _ref[1];
  5907. skidding = skidding || 0;
  5908. distance = (distance || 0) * invertDistance;
  5909. return [left, right].indexOf(basePlacement) >= 0 ? {
  5910. x: distance,
  5911. y: skidding
  5912. } : {
  5913. x: skidding,
  5914. y: distance
  5915. };
  5916. }
  5917. function offset(_ref2) {
  5918. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  5919. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  5920. var data2 = placements.reduce(function(acc, placement) {
  5921. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  5922. return acc;
  5923. }, {});
  5924. var _data$state$placement = data2[state.placement], x2 = _data$state$placement.x, y = _data$state$placement.y;
  5925. if (state.modifiersData.popperOffsets != null) {
  5926. state.modifiersData.popperOffsets.x += x2;
  5927. state.modifiersData.popperOffsets.y += y;
  5928. }
  5929. state.modifiersData[name] = data2;
  5930. }
  5931. var offset$1 = {
  5932. name: "offset",
  5933. enabled: true,
  5934. phase: "main",
  5935. requires: ["popperOffsets"],
  5936. fn: offset
  5937. };
  5938. function popperOffsets(_ref) {
  5939. var state = _ref.state, name = _ref.name;
  5940. state.modifiersData[name] = computeOffsets({
  5941. reference: state.rects.reference,
  5942. element: state.rects.popper,
  5943. strategy: "absolute",
  5944. placement: state.placement
  5945. });
  5946. }
  5947. var popperOffsets$1 = {
  5948. name: "popperOffsets",
  5949. enabled: true,
  5950. phase: "read",
  5951. fn: popperOffsets,
  5952. data: {}
  5953. };
  5954. function getAltAxis(axis) {
  5955. return axis === "x" ? "y" : "x";
  5956. }
  5957. function preventOverflow(_ref) {
  5958. var state = _ref.state, options = _ref.options, name = _ref.name;
  5959. 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;
  5960. var overflow = detectOverflow(state, {
  5961. boundary,
  5962. rootBoundary,
  5963. padding,
  5964. altBoundary
  5965. });
  5966. var basePlacement = getBasePlacement(state.placement);
  5967. var variation = getVariation(state.placement);
  5968. var isBasePlacement = !variation;
  5969. var mainAxis = getMainAxisFromPlacement(basePlacement);
  5970. var altAxis = getAltAxis(mainAxis);
  5971. var popperOffsets2 = state.modifiersData.popperOffsets;
  5972. var referenceRect = state.rects.reference;
  5973. var popperRect = state.rects.popper;
  5974. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  5975. placement: state.placement
  5976. })) : tetherOffset;
  5977. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  5978. mainAxis: tetherOffsetValue,
  5979. altAxis: tetherOffsetValue
  5980. } : Object.assign({
  5981. mainAxis: 0,
  5982. altAxis: 0
  5983. }, tetherOffsetValue);
  5984. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  5985. var data2 = {
  5986. x: 0,
  5987. y: 0
  5988. };
  5989. if (!popperOffsets2) {
  5990. return;
  5991. }
  5992. if (checkMainAxis) {
  5993. var _offsetModifierState$;
  5994. var mainSide = mainAxis === "y" ? top : left;
  5995. var altSide = mainAxis === "y" ? bottom : right;
  5996. var len = mainAxis === "y" ? "height" : "width";
  5997. var offset2 = popperOffsets2[mainAxis];
  5998. var min$1 = offset2 + overflow[mainSide];
  5999. var max$1 = offset2 - overflow[altSide];
  6000. var additive = tether ? -popperRect[len] / 2 : 0;
  6001. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  6002. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  6003. var arrowElement = state.elements.arrow;
  6004. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  6005. width: 0,
  6006. height: 0
  6007. };
  6008. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  6009. var arrowPaddingMin = arrowPaddingObject[mainSide];
  6010. var arrowPaddingMax = arrowPaddingObject[altSide];
  6011. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  6012. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  6013. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  6014. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  6015. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  6016. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  6017. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  6018. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  6019. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  6020. popperOffsets2[mainAxis] = preventedOffset;
  6021. data2[mainAxis] = preventedOffset - offset2;
  6022. }
  6023. if (checkAltAxis) {
  6024. var _offsetModifierState$2;
  6025. var _mainSide = mainAxis === "x" ? top : left;
  6026. var _altSide = mainAxis === "x" ? bottom : right;
  6027. var _offset = popperOffsets2[altAxis];
  6028. var _len = altAxis === "y" ? "height" : "width";
  6029. var _min = _offset + overflow[_mainSide];
  6030. var _max = _offset - overflow[_altSide];
  6031. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  6032. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  6033. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  6034. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  6035. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  6036. popperOffsets2[altAxis] = _preventedOffset;
  6037. data2[altAxis] = _preventedOffset - _offset;
  6038. }
  6039. state.modifiersData[name] = data2;
  6040. }
  6041. var preventOverflow$1 = {
  6042. name: "preventOverflow",
  6043. enabled: true,
  6044. phase: "main",
  6045. fn: preventOverflow,
  6046. requiresIfExists: ["offset"]
  6047. };
  6048. function getHTMLElementScroll(element) {
  6049. return {
  6050. scrollLeft: element.scrollLeft,
  6051. scrollTop: element.scrollTop
  6052. };
  6053. }
  6054. function getNodeScroll(node) {
  6055. if (node === getWindow(node) || !isHTMLElement(node)) {
  6056. return getWindowScroll(node);
  6057. } else {
  6058. return getHTMLElementScroll(node);
  6059. }
  6060. }
  6061. function isElementScaled(element) {
  6062. var rect = element.getBoundingClientRect();
  6063. var scaleX = round(rect.width) / element.offsetWidth || 1;
  6064. var scaleY = round(rect.height) / element.offsetHeight || 1;
  6065. return scaleX !== 1 || scaleY !== 1;
  6066. }
  6067. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  6068. if (isFixed === void 0) {
  6069. isFixed = false;
  6070. }
  6071. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  6072. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  6073. var documentElement = getDocumentElement(offsetParent);
  6074. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
  6075. var scroll = {
  6076. scrollLeft: 0,
  6077. scrollTop: 0
  6078. };
  6079. var offsets = {
  6080. x: 0,
  6081. y: 0
  6082. };
  6083. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  6084. if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
  6085. scroll = getNodeScroll(offsetParent);
  6086. }
  6087. if (isHTMLElement(offsetParent)) {
  6088. offsets = getBoundingClientRect(offsetParent, true);
  6089. offsets.x += offsetParent.clientLeft;
  6090. offsets.y += offsetParent.clientTop;
  6091. } else if (documentElement) {
  6092. offsets.x = getWindowScrollBarX(documentElement);
  6093. }
  6094. }
  6095. return {
  6096. x: rect.left + scroll.scrollLeft - offsets.x,
  6097. y: rect.top + scroll.scrollTop - offsets.y,
  6098. width: rect.width,
  6099. height: rect.height
  6100. };
  6101. }
  6102. function order(modifiers) {
  6103. var map = /* @__PURE__ */ new Map();
  6104. var visited = /* @__PURE__ */ new Set();
  6105. var result = [];
  6106. modifiers.forEach(function(modifier) {
  6107. map.set(modifier.name, modifier);
  6108. });
  6109. function sort(modifier) {
  6110. visited.add(modifier.name);
  6111. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  6112. requires.forEach(function(dep) {
  6113. if (!visited.has(dep)) {
  6114. var depModifier = map.get(dep);
  6115. if (depModifier) {
  6116. sort(depModifier);
  6117. }
  6118. }
  6119. });
  6120. result.push(modifier);
  6121. }
  6122. modifiers.forEach(function(modifier) {
  6123. if (!visited.has(modifier.name)) {
  6124. sort(modifier);
  6125. }
  6126. });
  6127. return result;
  6128. }
  6129. function orderModifiers(modifiers) {
  6130. var orderedModifiers = order(modifiers);
  6131. return modifierPhases.reduce(function(acc, phase) {
  6132. return acc.concat(orderedModifiers.filter(function(modifier) {
  6133. return modifier.phase === phase;
  6134. }));
  6135. }, []);
  6136. }
  6137. function debounce(fn2) {
  6138. var pending;
  6139. return function() {
  6140. if (!pending) {
  6141. pending = new Promise(function(resolve) {
  6142. Promise.resolve().then(function() {
  6143. pending = void 0;
  6144. resolve(fn2());
  6145. });
  6146. });
  6147. }
  6148. return pending;
  6149. };
  6150. }
  6151. function mergeByName(modifiers) {
  6152. var merged = modifiers.reduce(function(merged2, current) {
  6153. var existing = merged2[current.name];
  6154. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  6155. options: Object.assign({}, existing.options, current.options),
  6156. data: Object.assign({}, existing.data, current.data)
  6157. }) : current;
  6158. return merged2;
  6159. }, {});
  6160. return Object.keys(merged).map(function(key) {
  6161. return merged[key];
  6162. });
  6163. }
  6164. var DEFAULT_OPTIONS = {
  6165. placement: "bottom",
  6166. modifiers: [],
  6167. strategy: "absolute"
  6168. };
  6169. function areValidElements() {
  6170. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  6171. args[_key] = arguments[_key];
  6172. }
  6173. return !args.some(function(element) {
  6174. return !(element && typeof element.getBoundingClientRect === "function");
  6175. });
  6176. }
  6177. function popperGenerator(generatorOptions) {
  6178. if (generatorOptions === void 0) {
  6179. generatorOptions = {};
  6180. }
  6181. 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;
  6182. return function createPopper2(reference2, popper2, options) {
  6183. if (options === void 0) {
  6184. options = defaultOptions;
  6185. }
  6186. var state = {
  6187. placement: "bottom",
  6188. orderedModifiers: [],
  6189. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  6190. modifiersData: {},
  6191. elements: {
  6192. reference: reference2,
  6193. popper: popper2
  6194. },
  6195. attributes: {},
  6196. styles: {}
  6197. };
  6198. var effectCleanupFns = [];
  6199. var isDestroyed = false;
  6200. var instance = {
  6201. state,
  6202. setOptions: function setOptions(setOptionsAction) {
  6203. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  6204. cleanupModifierEffects();
  6205. state.options = Object.assign({}, defaultOptions, state.options, options2);
  6206. state.scrollParents = {
  6207. reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  6208. popper: listScrollParents(popper2)
  6209. };
  6210. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  6211. state.orderedModifiers = orderedModifiers.filter(function(m2) {
  6212. return m2.enabled;
  6213. });
  6214. runModifierEffects();
  6215. return instance.update();
  6216. },
  6217. forceUpdate: function forceUpdate() {
  6218. if (isDestroyed) {
  6219. return;
  6220. }
  6221. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  6222. if (!areValidElements(reference3, popper3)) {
  6223. return;
  6224. }
  6225. state.rects = {
  6226. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  6227. popper: getLayoutRect(popper3)
  6228. };
  6229. state.reset = false;
  6230. state.placement = state.options.placement;
  6231. state.orderedModifiers.forEach(function(modifier) {
  6232. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  6233. });
  6234. for (var index = 0; index < state.orderedModifiers.length; index++) {
  6235. if (state.reset === true) {
  6236. state.reset = false;
  6237. index = -1;
  6238. continue;
  6239. }
  6240. 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;
  6241. if (typeof fn2 === "function") {
  6242. state = fn2({
  6243. state,
  6244. options: _options,
  6245. name,
  6246. instance
  6247. }) || state;
  6248. }
  6249. }
  6250. },
  6251. update: debounce(function() {
  6252. return new Promise(function(resolve) {
  6253. instance.forceUpdate();
  6254. resolve(state);
  6255. });
  6256. }),
  6257. destroy: function destroy() {
  6258. cleanupModifierEffects();
  6259. isDestroyed = true;
  6260. }
  6261. };
  6262. if (!areValidElements(reference2, popper2)) {
  6263. return instance;
  6264. }
  6265. instance.setOptions(options).then(function(state2) {
  6266. if (!isDestroyed && options.onFirstUpdate) {
  6267. options.onFirstUpdate(state2);
  6268. }
  6269. });
  6270. function runModifierEffects() {
  6271. state.orderedModifiers.forEach(function(_ref3) {
  6272. var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect2 = _ref3.effect;
  6273. if (typeof effect2 === "function") {
  6274. var cleanupFn = effect2({
  6275. state,
  6276. name,
  6277. instance,
  6278. options: options2
  6279. });
  6280. var noopFn = function noopFn2() {
  6281. };
  6282. effectCleanupFns.push(cleanupFn || noopFn);
  6283. }
  6284. });
  6285. }
  6286. function cleanupModifierEffects() {
  6287. effectCleanupFns.forEach(function(fn2) {
  6288. return fn2();
  6289. });
  6290. effectCleanupFns = [];
  6291. }
  6292. return instance;
  6293. };
  6294. }
  6295. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  6296. var createPopper = /* @__PURE__ */ popperGenerator({
  6297. defaultModifiers
  6298. });
  6299. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  6300. const usePopperCoreConfigProps = buildProps({
  6301. boundariesPadding: {
  6302. type: Number,
  6303. default: 0
  6304. },
  6305. fallbackPlacements: {
  6306. type: definePropType(Array),
  6307. default: () => []
  6308. },
  6309. gpuAcceleration: {
  6310. type: Boolean,
  6311. default: true
  6312. },
  6313. offset: {
  6314. type: Number,
  6315. default: 12
  6316. },
  6317. placement: {
  6318. type: String,
  6319. values: placements,
  6320. default: "bottom"
  6321. },
  6322. popperOptions: {
  6323. type: definePropType(Object),
  6324. default: () => ({})
  6325. },
  6326. strategy: {
  6327. type: String,
  6328. values: POSITIONING_STRATEGIES,
  6329. default: "absolute"
  6330. }
  6331. });
  6332. const usePopperContentProps = buildProps(__spreadProps(__spreadValues({}, usePopperCoreConfigProps), {
  6333. style: { type: definePropType([String, Array, Object]) },
  6334. className: { type: definePropType([String, Array, Object]) },
  6335. effect: {
  6336. type: String,
  6337. default: "dark"
  6338. },
  6339. visible: Boolean,
  6340. enterable: {
  6341. type: Boolean,
  6342. default: true
  6343. },
  6344. pure: Boolean,
  6345. popperClass: {
  6346. type: definePropType([String, Array, Object])
  6347. },
  6348. popperStyle: {
  6349. type: definePropType([String, Array, Object])
  6350. },
  6351. referenceEl: {
  6352. type: definePropType(Object)
  6353. },
  6354. stopPopperMouseEvent: {
  6355. type: Boolean,
  6356. default: true
  6357. },
  6358. zIndex: Number
  6359. }));
  6360. const buildPopperOptions = (props, arrowProps) => {
  6361. const { placement, strategy, popperOptions: popperOptions2 } = props;
  6362. const options = __spreadProps(__spreadValues({
  6363. placement,
  6364. strategy
  6365. }, popperOptions2), {
  6366. modifiers: genModifiers(props)
  6367. });
  6368. attachArrow(options, arrowProps);
  6369. deriveExtraModifiers(options, popperOptions2 == null ? void 0 : popperOptions2.modifiers);
  6370. return options;
  6371. };
  6372. const unwrapMeasurableEl = ($el) => {
  6373. if (!isClient$1)
  6374. return;
  6375. return unrefElement($el);
  6376. };
  6377. function genModifiers(options) {
  6378. const { offset: offset2, gpuAcceleration, fallbackPlacements } = options;
  6379. return [
  6380. {
  6381. name: "offset",
  6382. options: {
  6383. offset: [0, offset2 != null ? offset2 : 12]
  6384. }
  6385. },
  6386. {
  6387. name: "preventOverflow",
  6388. options: {
  6389. padding: {
  6390. top: 2,
  6391. bottom: 2,
  6392. left: 5,
  6393. right: 5
  6394. }
  6395. }
  6396. },
  6397. {
  6398. name: "flip",
  6399. options: {
  6400. padding: 5,
  6401. fallbackPlacements: fallbackPlacements != null ? fallbackPlacements : []
  6402. }
  6403. },
  6404. {
  6405. name: "computeStyles",
  6406. options: {
  6407. gpuAcceleration,
  6408. adaptive: gpuAcceleration
  6409. }
  6410. }
  6411. ];
  6412. }
  6413. function attachArrow(options, { arrowEl, arrowOffset }) {
  6414. options.modifiers.push({
  6415. name: "arrow",
  6416. options: {
  6417. element: arrowEl,
  6418. padding: arrowOffset != null ? arrowOffset : 5
  6419. }
  6420. });
  6421. }
  6422. function deriveExtraModifiers(options, modifiers) {
  6423. if (modifiers) {
  6424. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  6425. }
  6426. }
  6427. const __default__$g = {
  6428. name: "ElPopperContent"
  6429. };
  6430. const _sfc_main$Z = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$g), {
  6431. props: usePopperContentProps,
  6432. emits: ["mouseenter", "mouseleave"],
  6433. setup(__props, { expose }) {
  6434. const props = __props;
  6435. const { popperInstanceRef, contentRef, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  6436. const { nextZIndex } = useZIndex();
  6437. const ns = useNamespace("popper");
  6438. const popperContentRef = ref();
  6439. const arrowRef = ref();
  6440. const arrowOffset = ref();
  6441. provide(POPPER_CONTENT_INJECTION_KEY, {
  6442. arrowRef,
  6443. arrowOffset
  6444. });
  6445. const contentZIndex = ref(props.zIndex || nextZIndex());
  6446. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
  6447. const contentStyle = computed(() => [{ zIndex: unref(contentZIndex) }, props.popperStyle]);
  6448. const contentClass = computed(() => [
  6449. ns.b(),
  6450. ns.is("pure", props.pure),
  6451. ns.is(props.effect),
  6452. props.popperClass
  6453. ]);
  6454. const createPopperInstance = ({ referenceEl, popperContentEl, arrowEl }) => {
  6455. const options = buildPopperOptions(props, {
  6456. arrowEl,
  6457. arrowOffset: unref(arrowOffset)
  6458. });
  6459. return createPopper(referenceEl, popperContentEl, options);
  6460. };
  6461. const updatePopper = (shouldUpdateZIndex = true) => {
  6462. var _a2;
  6463. (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.update();
  6464. shouldUpdateZIndex && (contentZIndex.value = props.zIndex || nextZIndex());
  6465. };
  6466. const togglePopperAlive = () => {
  6467. var _a2, _b2;
  6468. const monitorable = { name: "eventListeners", enabled: props.visible };
  6469. (_b2 = (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.setOptions) == null ? void 0 : _b2.call(_a2, (options) => __spreadProps(__spreadValues({}, options), {
  6470. modifiers: [...options.modifiers || [], monitorable]
  6471. }));
  6472. updatePopper(false);
  6473. };
  6474. onMounted(() => {
  6475. let updateHandle;
  6476. watch(computedReference, (referenceEl) => {
  6477. var _a2;
  6478. updateHandle == null ? void 0 : updateHandle();
  6479. const popperInstance = unref(popperInstanceRef);
  6480. (_a2 = popperInstance == null ? void 0 : popperInstance.destroy) == null ? void 0 : _a2.call(popperInstance);
  6481. if (referenceEl) {
  6482. const popperContentEl = unref(popperContentRef);
  6483. contentRef.value = popperContentEl;
  6484. popperInstanceRef.value = createPopperInstance({
  6485. referenceEl,
  6486. popperContentEl,
  6487. arrowEl: unref(arrowRef)
  6488. });
  6489. updateHandle = watch(() => referenceEl.getBoundingClientRect(), () => updatePopper(), {
  6490. immediate: true
  6491. });
  6492. } else {
  6493. popperInstanceRef.value = void 0;
  6494. }
  6495. }, {
  6496. immediate: true
  6497. });
  6498. watch(() => props.visible, togglePopperAlive, { immediate: true });
  6499. watch(() => buildPopperOptions(props, {
  6500. arrowEl: unref(arrowRef),
  6501. arrowOffset: unref(arrowOffset)
  6502. }), (option) => {
  6503. var _a2;
  6504. return (_a2 = popperInstanceRef.value) == null ? void 0 : _a2.setOptions(option);
  6505. });
  6506. });
  6507. expose({
  6508. popperContentRef,
  6509. popperInstanceRef,
  6510. updatePopper,
  6511. contentStyle
  6512. });
  6513. return (_ctx, _cache) => {
  6514. return openBlock(), createElementBlock("div", {
  6515. ref_key: "popperContentRef",
  6516. ref: popperContentRef,
  6517. style: normalizeStyle(unref(contentStyle)),
  6518. class: normalizeClass(unref(contentClass)),
  6519. role: "tooltip",
  6520. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  6521. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  6522. }, [
  6523. renderSlot(_ctx.$slots, "default")
  6524. ], 38);
  6525. };
  6526. }
  6527. }));
  6528. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$Z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
  6529. function useDeprecateAppendToBody(scope, from) {
  6530. const vm = getCurrentInstance();
  6531. const compatTeleported = computed(() => {
  6532. return isBoolean(vm.props[from]) ? vm.props[from] : vm.props.teleported;
  6533. });
  6534. useDeprecated({
  6535. scope,
  6536. from,
  6537. replacement: "teleported",
  6538. version: "2.1.0",
  6539. ref: "https://element-plus.org/en-US/component/tooltip.html#attributes"
  6540. }, computed(() => isBoolean(vm.props[from])));
  6541. return {
  6542. compatTeleported
  6543. };
  6544. }
  6545. const ElPopper = withInstall(Popper);
  6546. const _sfc_main$Y = defineComponent({
  6547. name: "ElVisuallyHidden",
  6548. props: {
  6549. style: {
  6550. type: [String, Object, Array]
  6551. }
  6552. },
  6553. setup(props) {
  6554. return {
  6555. computedStyle: computed(() => {
  6556. return [
  6557. props.style,
  6558. {
  6559. position: "absolute",
  6560. border: 0,
  6561. width: 1,
  6562. height: 1,
  6563. padding: 0,
  6564. margin: -1,
  6565. overflow: "hidden",
  6566. clip: "rect(0, 0, 0, 0)",
  6567. whiteSpace: "nowrap",
  6568. wordWrap: "normal"
  6569. }
  6570. ];
  6571. })
  6572. };
  6573. }
  6574. });
  6575. function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
  6576. return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, { style: _ctx.computedStyle }), [
  6577. renderSlot(_ctx.$slots, "default")
  6578. ], 16);
  6579. }
  6580. 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"]]);
  6581. const useTooltipContentProps = buildProps(__spreadProps(__spreadValues(__spreadValues({}, useDelayedToggleProps), usePopperContentProps), {
  6582. appendTo: {
  6583. type: definePropType([String, Object]),
  6584. default: POPPER_CONTAINER_SELECTOR
  6585. },
  6586. content: {
  6587. type: String,
  6588. default: ""
  6589. },
  6590. rawContent: {
  6591. type: Boolean,
  6592. default: false
  6593. },
  6594. persistent: Boolean,
  6595. ariaLabel: String,
  6596. visible: {
  6597. type: definePropType(Boolean),
  6598. default: null
  6599. },
  6600. transition: {
  6601. type: String,
  6602. default: "el-fade-in-linear"
  6603. },
  6604. teleported: {
  6605. type: Boolean,
  6606. default: true
  6607. },
  6608. disabled: {
  6609. type: Boolean
  6610. }
  6611. }));
  6612. const useTooltipTriggerProps = buildProps(__spreadProps(__spreadValues({}, usePopperTriggerProps), {
  6613. disabled: Boolean,
  6614. trigger: {
  6615. type: definePropType([String, Array]),
  6616. default: "hover"
  6617. }
  6618. }));
  6619. const useTooltipProps = buildProps({
  6620. openDelay: {
  6621. type: Number
  6622. },
  6623. visibleArrow: {
  6624. type: Boolean,
  6625. default: void 0
  6626. },
  6627. hideAfter: {
  6628. type: Number,
  6629. default: 200
  6630. },
  6631. showArrow: {
  6632. type: Boolean,
  6633. default: true
  6634. }
  6635. });
  6636. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  6637. const _sfc_main$X = defineComponent({
  6638. name: "ElTooltipContent",
  6639. components: {
  6640. ElPopperContent,
  6641. ElVisuallyHidden
  6642. },
  6643. inheritAttrs: false,
  6644. props: useTooltipContentProps,
  6645. setup(props) {
  6646. const contentRef = ref(null);
  6647. const intermediateOpen = ref(false);
  6648. const entering = ref(false);
  6649. const leaving = ref(false);
  6650. const destroyed = ref(false);
  6651. const {
  6652. controlled,
  6653. id,
  6654. open,
  6655. trigger,
  6656. onClose,
  6657. onOpen,
  6658. onShow,
  6659. onHide,
  6660. onBeforeShow,
  6661. onBeforeHide
  6662. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6663. const persistentRef = computed(() => {
  6664. return props.persistent;
  6665. });
  6666. onBeforeUnmount(() => {
  6667. destroyed.value = true;
  6668. });
  6669. const shouldRender = computed(() => {
  6670. return unref(persistentRef) ? true : unref(open);
  6671. });
  6672. const shouldShow = computed(() => {
  6673. return props.disabled ? false : unref(open);
  6674. });
  6675. const contentStyle = computed(() => {
  6676. var _a2;
  6677. return (_a2 = props.style) != null ? _a2 : {};
  6678. });
  6679. const ariaHidden = computed(() => !unref(open));
  6680. useEscapeKeydown(onClose);
  6681. const onTransitionLeave = () => {
  6682. onHide();
  6683. };
  6684. const stopWhenControlled = () => {
  6685. if (unref(controlled))
  6686. return true;
  6687. };
  6688. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  6689. if (props.enterable && unref(trigger) === "hover") {
  6690. onOpen();
  6691. }
  6692. });
  6693. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  6694. if (unref(trigger) === "hover") {
  6695. onClose();
  6696. }
  6697. });
  6698. const onBeforeEnter = () => {
  6699. var _a2, _b2;
  6700. (_b2 = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  6701. onBeforeShow == null ? void 0 : onBeforeShow();
  6702. };
  6703. const onBeforeLeave = () => {
  6704. onBeforeHide == null ? void 0 : onBeforeHide();
  6705. };
  6706. const onAfterShow = () => {
  6707. onShow();
  6708. };
  6709. let stopHandle;
  6710. watch(() => unref(open), (val) => {
  6711. if (val) {
  6712. stopHandle = onClickOutside(computed(() => {
  6713. var _a2;
  6714. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  6715. }), () => {
  6716. if (unref(controlled))
  6717. return;
  6718. const $trigger = unref(trigger);
  6719. if ($trigger !== "hover") {
  6720. onClose();
  6721. }
  6722. });
  6723. } else {
  6724. stopHandle == null ? void 0 : stopHandle();
  6725. }
  6726. }, {
  6727. flush: "post"
  6728. });
  6729. return {
  6730. ariaHidden,
  6731. entering,
  6732. leaving,
  6733. id,
  6734. intermediateOpen,
  6735. contentStyle,
  6736. contentRef,
  6737. destroyed,
  6738. shouldRender,
  6739. shouldShow,
  6740. open,
  6741. onAfterShow,
  6742. onBeforeEnter,
  6743. onBeforeLeave,
  6744. onContentEnter,
  6745. onContentLeave,
  6746. onTransitionLeave
  6747. };
  6748. }
  6749. });
  6750. function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
  6751. const _component_el_visually_hidden = resolveComponent("el-visually-hidden");
  6752. const _component_el_popper_content = resolveComponent("el-popper-content");
  6753. return openBlock(), createBlock(Teleport, {
  6754. disabled: !_ctx.teleported,
  6755. to: _ctx.appendTo
  6756. }, [
  6757. createVNode(Transition, {
  6758. name: _ctx.transition,
  6759. onAfterLeave: _ctx.onTransitionLeave,
  6760. onBeforeEnter: _ctx.onBeforeEnter,
  6761. onAfterEnter: _ctx.onAfterShow,
  6762. onBeforeLeave: _ctx.onBeforeLeave
  6763. }, {
  6764. default: withCtx(() => [
  6765. _ctx.shouldRender ? withDirectives((openBlock(), createBlock(_component_el_popper_content, mergeProps({
  6766. key: 0,
  6767. ref: "contentRef"
  6768. }, _ctx.$attrs, {
  6769. "aria-hidden": _ctx.ariaHidden,
  6770. "boundaries-padding": _ctx.boundariesPadding,
  6771. "fallback-placements": _ctx.fallbackPlacements,
  6772. "gpu-acceleration": _ctx.gpuAcceleration,
  6773. offset: _ctx.offset,
  6774. placement: _ctx.placement,
  6775. "popper-options": _ctx.popperOptions,
  6776. strategy: _ctx.strategy,
  6777. effect: _ctx.effect,
  6778. enterable: _ctx.enterable,
  6779. pure: _ctx.pure,
  6780. "popper-class": _ctx.popperClass,
  6781. "popper-style": [_ctx.popperStyle, _ctx.contentStyle],
  6782. "reference-el": _ctx.referenceEl,
  6783. visible: _ctx.shouldShow,
  6784. "z-index": _ctx.zIndex,
  6785. onMouseenter: _ctx.onContentEnter,
  6786. onMouseleave: _ctx.onContentLeave
  6787. }), {
  6788. default: withCtx(() => [
  6789. createCommentVNode(" Workaround bug #6378 "),
  6790. !_ctx.destroyed ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  6791. renderSlot(_ctx.$slots, "default"),
  6792. createVNode(_component_el_visually_hidden, {
  6793. id: _ctx.id,
  6794. role: "tooltip"
  6795. }, {
  6796. default: withCtx(() => [
  6797. createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
  6798. ]),
  6799. _: 1
  6800. }, 8, ["id"])
  6801. ], 64)) : createCommentVNode("v-if", true)
  6802. ]),
  6803. _: 3
  6804. }, 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"])), [
  6805. [vShow, _ctx.shouldShow]
  6806. ]) : createCommentVNode("v-if", true)
  6807. ]),
  6808. _: 3
  6809. }, 8, ["name", "onAfterLeave", "onBeforeEnter", "onAfterEnter", "onBeforeLeave"])
  6810. ], 8, ["disabled", "to"]);
  6811. }
  6812. 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"]]);
  6813. const isTriggerType = (trigger, type4) => {
  6814. if (isArray(trigger)) {
  6815. return trigger.includes(type4);
  6816. }
  6817. return trigger === type4;
  6818. };
  6819. const whenTrigger = (trigger, type4, handler3) => {
  6820. return (e) => {
  6821. isTriggerType(unref(trigger), type4) && handler3(e);
  6822. };
  6823. };
  6824. const _sfc_main$W = defineComponent({
  6825. name: "ElTooltipTrigger",
  6826. components: {
  6827. ElPopperTrigger
  6828. },
  6829. props: useTooltipTriggerProps,
  6830. setup(props) {
  6831. const ns = useNamespace("tooltip");
  6832. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6833. const triggerRef2 = ref(null);
  6834. const stopWhenControlledOrDisabled = () => {
  6835. if (unref(controlled) || props.disabled) {
  6836. return true;
  6837. }
  6838. };
  6839. const trigger = toRef(props, "trigger");
  6840. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  6841. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  6842. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  6843. if (e.button === 0) {
  6844. onToggle(e);
  6845. }
  6846. }));
  6847. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  6848. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  6849. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  6850. e.preventDefault();
  6851. onToggle(e);
  6852. }));
  6853. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  6854. const { code } = e;
  6855. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  6856. onToggle(e);
  6857. }
  6858. });
  6859. return {
  6860. onBlur,
  6861. onContextMenu,
  6862. onFocus,
  6863. onMouseenter,
  6864. onMouseleave,
  6865. onClick,
  6866. onKeydown,
  6867. open,
  6868. id,
  6869. triggerRef: triggerRef2,
  6870. ns
  6871. };
  6872. }
  6873. });
  6874. function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
  6875. const _component_el_popper_trigger = resolveComponent("el-popper-trigger");
  6876. return openBlock(), createBlock(_component_el_popper_trigger, {
  6877. id: _ctx.id,
  6878. "virtual-ref": _ctx.virtualRef,
  6879. open: _ctx.open,
  6880. "virtual-triggering": _ctx.virtualTriggering,
  6881. class: normalizeClass(_ctx.ns.e("trigger")),
  6882. onBlur: _ctx.onBlur,
  6883. onClick: _ctx.onClick,
  6884. onContextmenu: _ctx.onContextMenu,
  6885. onFocus: _ctx.onFocus,
  6886. onMouseenter: _ctx.onMouseenter,
  6887. onMouseleave: _ctx.onMouseleave,
  6888. onKeydown: _ctx.onKeydown
  6889. }, {
  6890. default: withCtx(() => [
  6891. renderSlot(_ctx.$slots, "default")
  6892. ]),
  6893. _: 3
  6894. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  6895. }
  6896. 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"]]);
  6897. const { useModelToggleProps, useModelToggle, useModelToggleEmits } = createModelToggleComposable("visible");
  6898. const _sfc_main$V = defineComponent({
  6899. name: "ElTooltip",
  6900. components: {
  6901. ElPopper,
  6902. ElPopperArrow,
  6903. ElTooltipContent,
  6904. ElTooltipTrigger
  6905. },
  6906. props: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, useModelToggleProps), useTooltipContentProps), useTooltipTriggerProps), usePopperArrowProps), useTooltipProps),
  6907. emits: [...useModelToggleEmits, "before-show", "before-hide", "show", "hide"],
  6908. setup(props, { emit }) {
  6909. usePopperContainer();
  6910. const compatShowAfter = computed(() => {
  6911. if (!isUndefined(props.openDelay))
  6912. ;
  6913. return props.openDelay || props.showAfter;
  6914. });
  6915. const compatShowArrow = computed(() => {
  6916. if (!isUndefined(props.visibleArrow))
  6917. ;
  6918. return isBoolean(props.visibleArrow) ? props.visibleArrow : props.showArrow;
  6919. });
  6920. const id = useId();
  6921. const popperRef = ref(null);
  6922. const updatePopper = () => {
  6923. var _a2;
  6924. const popperComponent = unref(popperRef);
  6925. if (popperComponent) {
  6926. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  6927. }
  6928. };
  6929. const open = ref(false);
  6930. const { show, hide: hide2 } = useModelToggle({
  6931. indicator: open
  6932. });
  6933. const { onOpen, onClose } = useDelayedToggle({
  6934. showAfter: compatShowAfter,
  6935. hideAfter: toRef(props, "hideAfter"),
  6936. open: show,
  6937. close: hide2
  6938. });
  6939. const controlled = computed(() => isBoolean(props.visible));
  6940. provide(TOOLTIP_INJECTION_KEY, {
  6941. controlled,
  6942. id,
  6943. open: readonly(open),
  6944. trigger: toRef(props, "trigger"),
  6945. onOpen,
  6946. onClose,
  6947. onToggle: () => {
  6948. if (unref(open)) {
  6949. onClose();
  6950. } else {
  6951. onOpen();
  6952. }
  6953. },
  6954. onShow: () => {
  6955. emit("show");
  6956. },
  6957. onHide: () => {
  6958. emit("hide");
  6959. },
  6960. onBeforeShow: () => {
  6961. emit("before-show");
  6962. },
  6963. onBeforeHide: () => {
  6964. emit("before-hide");
  6965. },
  6966. updatePopper
  6967. });
  6968. watch(() => props.disabled, (disabled) => {
  6969. if (disabled && open.value) {
  6970. open.value = false;
  6971. }
  6972. });
  6973. return {
  6974. compatShowAfter,
  6975. compatShowArrow,
  6976. popperRef,
  6977. open,
  6978. hide: hide2,
  6979. updatePopper,
  6980. onOpen,
  6981. onClose
  6982. };
  6983. }
  6984. });
  6985. const _hoisted_1$B = ["innerHTML"];
  6986. const _hoisted_2$s = { key: 1 };
  6987. function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
  6988. const _component_el_tooltip_trigger = resolveComponent("el-tooltip-trigger");
  6989. const _component_el_popper_arrow = resolveComponent("el-popper-arrow");
  6990. const _component_el_tooltip_content = resolveComponent("el-tooltip-content");
  6991. const _component_el_popper = resolveComponent("el-popper");
  6992. return openBlock(), createBlock(_component_el_popper, { ref: "popperRef" }, {
  6993. default: withCtx(() => [
  6994. createVNode(_component_el_tooltip_trigger, {
  6995. disabled: _ctx.disabled,
  6996. trigger: _ctx.trigger,
  6997. "virtual-ref": _ctx.virtualRef,
  6998. "virtual-triggering": _ctx.virtualTriggering
  6999. }, {
  7000. default: withCtx(() => [
  7001. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  7002. ]),
  7003. _: 3
  7004. }, 8, ["disabled", "trigger", "virtual-ref", "virtual-triggering"]),
  7005. createVNode(_component_el_tooltip_content, {
  7006. "aria-label": _ctx.ariaLabel,
  7007. "boundaries-padding": _ctx.boundariesPadding,
  7008. content: _ctx.content,
  7009. disabled: _ctx.disabled,
  7010. effect: _ctx.effect,
  7011. enterable: _ctx.enterable,
  7012. "fallback-placements": _ctx.fallbackPlacements,
  7013. "hide-after": _ctx.hideAfter,
  7014. "gpu-acceleration": _ctx.gpuAcceleration,
  7015. offset: _ctx.offset,
  7016. persistent: _ctx.persistent,
  7017. "popper-class": _ctx.popperClass,
  7018. "popper-style": _ctx.popperStyle,
  7019. placement: _ctx.placement,
  7020. "popper-options": _ctx.popperOptions,
  7021. pure: _ctx.pure,
  7022. "raw-content": _ctx.rawContent,
  7023. "reference-el": _ctx.referenceEl,
  7024. "show-after": _ctx.compatShowAfter,
  7025. strategy: _ctx.strategy,
  7026. teleported: _ctx.teleported,
  7027. transition: _ctx.transition,
  7028. "z-index": _ctx.zIndex,
  7029. "append-to": _ctx.appendTo
  7030. }, {
  7031. default: withCtx(() => [
  7032. renderSlot(_ctx.$slots, "content", {}, () => [
  7033. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  7034. key: 0,
  7035. innerHTML: _ctx.content
  7036. }, null, 8, _hoisted_1$B)) : (openBlock(), createElementBlock("span", _hoisted_2$s, toDisplayString(_ctx.content), 1))
  7037. ]),
  7038. _ctx.compatShowArrow ? (openBlock(), createBlock(_component_el_popper_arrow, {
  7039. key: 0,
  7040. "arrow-offset": _ctx.arrowOffset
  7041. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  7042. ]),
  7043. _: 3
  7044. }, 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"])
  7045. ]),
  7046. _: 3
  7047. }, 512);
  7048. }
  7049. 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"]]);
  7050. const ElTooltip = withInstall(Tooltip);
  7051. const buttonTypes = [
  7052. "default",
  7053. "primary",
  7054. "success",
  7055. "warning",
  7056. "info",
  7057. "danger",
  7058. "text",
  7059. ""
  7060. ];
  7061. const buttonNativeTypes = ["button", "submit", "reset"];
  7062. const buttonProps = buildProps({
  7063. size: useSizeProp,
  7064. disabled: Boolean,
  7065. type: {
  7066. type: String,
  7067. values: buttonTypes,
  7068. default: ""
  7069. },
  7070. icon: {
  7071. type: iconPropType,
  7072. default: ""
  7073. },
  7074. nativeType: {
  7075. type: String,
  7076. values: buttonNativeTypes,
  7077. default: "button"
  7078. },
  7079. loading: Boolean,
  7080. loadingIcon: {
  7081. type: iconPropType,
  7082. default: () => loading
  7083. },
  7084. plain: Boolean,
  7085. autofocus: Boolean,
  7086. round: Boolean,
  7087. circle: Boolean,
  7088. color: String,
  7089. dark: Boolean,
  7090. autoInsertSpace: {
  7091. type: Boolean,
  7092. default: void 0
  7093. }
  7094. });
  7095. const buttonEmits = {
  7096. click: (evt) => evt instanceof MouseEvent
  7097. };
  7098. function bound01(n, max2) {
  7099. if (isOnePointZero(n)) {
  7100. n = "100%";
  7101. }
  7102. var isPercent = isPercentage(n);
  7103. n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
  7104. if (isPercent) {
  7105. n = parseInt(String(n * max2), 10) / 100;
  7106. }
  7107. if (Math.abs(n - max2) < 1e-6) {
  7108. return 1;
  7109. }
  7110. if (max2 === 360) {
  7111. n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
  7112. } else {
  7113. n = n % max2 / parseFloat(String(max2));
  7114. }
  7115. return n;
  7116. }
  7117. function clamp01(val) {
  7118. return Math.min(1, Math.max(0, val));
  7119. }
  7120. function isOnePointZero(n) {
  7121. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  7122. }
  7123. function isPercentage(n) {
  7124. return typeof n === "string" && n.indexOf("%") !== -1;
  7125. }
  7126. function boundAlpha(a2) {
  7127. a2 = parseFloat(a2);
  7128. if (isNaN(a2) || a2 < 0 || a2 > 1) {
  7129. a2 = 1;
  7130. }
  7131. return a2;
  7132. }
  7133. function convertToPercentage(n) {
  7134. if (n <= 1) {
  7135. return "".concat(Number(n) * 100, "%");
  7136. }
  7137. return n;
  7138. }
  7139. function pad2(c) {
  7140. return c.length === 1 ? "0" + c : String(c);
  7141. }
  7142. function rgbToRgb(r, g, b2) {
  7143. return {
  7144. r: bound01(r, 255) * 255,
  7145. g: bound01(g, 255) * 255,
  7146. b: bound01(b2, 255) * 255
  7147. };
  7148. }
  7149. function rgbToHsl(r, g, b2) {
  7150. r = bound01(r, 255);
  7151. g = bound01(g, 255);
  7152. b2 = bound01(b2, 255);
  7153. var max2 = Math.max(r, g, b2);
  7154. var min2 = Math.min(r, g, b2);
  7155. var h2 = 0;
  7156. var s2 = 0;
  7157. var l2 = (max2 + min2) / 2;
  7158. if (max2 === min2) {
  7159. s2 = 0;
  7160. h2 = 0;
  7161. } else {
  7162. var d2 = max2 - min2;
  7163. s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
  7164. switch (max2) {
  7165. case r:
  7166. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7167. break;
  7168. case g:
  7169. h2 = (b2 - r) / d2 + 2;
  7170. break;
  7171. case b2:
  7172. h2 = (r - g) / d2 + 4;
  7173. break;
  7174. }
  7175. h2 /= 6;
  7176. }
  7177. return { h: h2, s: s2, l: l2 };
  7178. }
  7179. function hue2rgb(p2, q, t) {
  7180. if (t < 0) {
  7181. t += 1;
  7182. }
  7183. if (t > 1) {
  7184. t -= 1;
  7185. }
  7186. if (t < 1 / 6) {
  7187. return p2 + (q - p2) * (6 * t);
  7188. }
  7189. if (t < 1 / 2) {
  7190. return q;
  7191. }
  7192. if (t < 2 / 3) {
  7193. return p2 + (q - p2) * (2 / 3 - t) * 6;
  7194. }
  7195. return p2;
  7196. }
  7197. function hslToRgb(h2, s2, l2) {
  7198. var r;
  7199. var g;
  7200. var b2;
  7201. h2 = bound01(h2, 360);
  7202. s2 = bound01(s2, 100);
  7203. l2 = bound01(l2, 100);
  7204. if (s2 === 0) {
  7205. g = l2;
  7206. b2 = l2;
  7207. r = l2;
  7208. } else {
  7209. var q = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
  7210. var p2 = 2 * l2 - q;
  7211. r = hue2rgb(p2, q, h2 + 1 / 3);
  7212. g = hue2rgb(p2, q, h2);
  7213. b2 = hue2rgb(p2, q, h2 - 1 / 3);
  7214. }
  7215. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7216. }
  7217. function rgbToHsv(r, g, b2) {
  7218. r = bound01(r, 255);
  7219. g = bound01(g, 255);
  7220. b2 = bound01(b2, 255);
  7221. var max2 = Math.max(r, g, b2);
  7222. var min2 = Math.min(r, g, b2);
  7223. var h2 = 0;
  7224. var v2 = max2;
  7225. var d2 = max2 - min2;
  7226. var s2 = max2 === 0 ? 0 : d2 / max2;
  7227. if (max2 === min2) {
  7228. h2 = 0;
  7229. } else {
  7230. switch (max2) {
  7231. case r:
  7232. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7233. break;
  7234. case g:
  7235. h2 = (b2 - r) / d2 + 2;
  7236. break;
  7237. case b2:
  7238. h2 = (r - g) / d2 + 4;
  7239. break;
  7240. }
  7241. h2 /= 6;
  7242. }
  7243. return { h: h2, s: s2, v: v2 };
  7244. }
  7245. function hsvToRgb(h2, s2, v2) {
  7246. h2 = bound01(h2, 360) * 6;
  7247. s2 = bound01(s2, 100);
  7248. v2 = bound01(v2, 100);
  7249. var i = Math.floor(h2);
  7250. var f = h2 - i;
  7251. var p2 = v2 * (1 - s2);
  7252. var q = v2 * (1 - f * s2);
  7253. var t = v2 * (1 - (1 - f) * s2);
  7254. var mod = i % 6;
  7255. var r = [v2, q, p2, p2, t, v2][mod];
  7256. var g = [t, v2, v2, q, p2, p2][mod];
  7257. var b2 = [p2, p2, t, v2, v2, q][mod];
  7258. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7259. }
  7260. function rgbToHex(r, g, b2, allow3Char) {
  7261. var hex2 = [
  7262. pad2(Math.round(r).toString(16)),
  7263. pad2(Math.round(g).toString(16)),
  7264. pad2(Math.round(b2).toString(16))
  7265. ];
  7266. if (allow3Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1))) {
  7267. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0);
  7268. }
  7269. return hex2.join("");
  7270. }
  7271. function rgbaToHex(r, g, b2, a2, allow4Char) {
  7272. var hex2 = [
  7273. pad2(Math.round(r).toString(16)),
  7274. pad2(Math.round(g).toString(16)),
  7275. pad2(Math.round(b2).toString(16)),
  7276. pad2(convertDecimalToHex(a2))
  7277. ];
  7278. 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))) {
  7279. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0);
  7280. }
  7281. return hex2.join("");
  7282. }
  7283. function convertDecimalToHex(d2) {
  7284. return Math.round(parseFloat(d2) * 255).toString(16);
  7285. }
  7286. function convertHexToDecimal(h2) {
  7287. return parseIntFromHex(h2) / 255;
  7288. }
  7289. function parseIntFromHex(val) {
  7290. return parseInt(val, 16);
  7291. }
  7292. function numberInputToObject(color) {
  7293. return {
  7294. r: color >> 16,
  7295. g: (color & 65280) >> 8,
  7296. b: color & 255
  7297. };
  7298. }
  7299. var names = {
  7300. aliceblue: "#f0f8ff",
  7301. antiquewhite: "#faebd7",
  7302. aqua: "#00ffff",
  7303. aquamarine: "#7fffd4",
  7304. azure: "#f0ffff",
  7305. beige: "#f5f5dc",
  7306. bisque: "#ffe4c4",
  7307. black: "#000000",
  7308. blanchedalmond: "#ffebcd",
  7309. blue: "#0000ff",
  7310. blueviolet: "#8a2be2",
  7311. brown: "#a52a2a",
  7312. burlywood: "#deb887",
  7313. cadetblue: "#5f9ea0",
  7314. chartreuse: "#7fff00",
  7315. chocolate: "#d2691e",
  7316. coral: "#ff7f50",
  7317. cornflowerblue: "#6495ed",
  7318. cornsilk: "#fff8dc",
  7319. crimson: "#dc143c",
  7320. cyan: "#00ffff",
  7321. darkblue: "#00008b",
  7322. darkcyan: "#008b8b",
  7323. darkgoldenrod: "#b8860b",
  7324. darkgray: "#a9a9a9",
  7325. darkgreen: "#006400",
  7326. darkgrey: "#a9a9a9",
  7327. darkkhaki: "#bdb76b",
  7328. darkmagenta: "#8b008b",
  7329. darkolivegreen: "#556b2f",
  7330. darkorange: "#ff8c00",
  7331. darkorchid: "#9932cc",
  7332. darkred: "#8b0000",
  7333. darksalmon: "#e9967a",
  7334. darkseagreen: "#8fbc8f",
  7335. darkslateblue: "#483d8b",
  7336. darkslategray: "#2f4f4f",
  7337. darkslategrey: "#2f4f4f",
  7338. darkturquoise: "#00ced1",
  7339. darkviolet: "#9400d3",
  7340. deeppink: "#ff1493",
  7341. deepskyblue: "#00bfff",
  7342. dimgray: "#696969",
  7343. dimgrey: "#696969",
  7344. dodgerblue: "#1e90ff",
  7345. firebrick: "#b22222",
  7346. floralwhite: "#fffaf0",
  7347. forestgreen: "#228b22",
  7348. fuchsia: "#ff00ff",
  7349. gainsboro: "#dcdcdc",
  7350. ghostwhite: "#f8f8ff",
  7351. goldenrod: "#daa520",
  7352. gold: "#ffd700",
  7353. gray: "#808080",
  7354. green: "#008000",
  7355. greenyellow: "#adff2f",
  7356. grey: "#808080",
  7357. honeydew: "#f0fff0",
  7358. hotpink: "#ff69b4",
  7359. indianred: "#cd5c5c",
  7360. indigo: "#4b0082",
  7361. ivory: "#fffff0",
  7362. khaki: "#f0e68c",
  7363. lavenderblush: "#fff0f5",
  7364. lavender: "#e6e6fa",
  7365. lawngreen: "#7cfc00",
  7366. lemonchiffon: "#fffacd",
  7367. lightblue: "#add8e6",
  7368. lightcoral: "#f08080",
  7369. lightcyan: "#e0ffff",
  7370. lightgoldenrodyellow: "#fafad2",
  7371. lightgray: "#d3d3d3",
  7372. lightgreen: "#90ee90",
  7373. lightgrey: "#d3d3d3",
  7374. lightpink: "#ffb6c1",
  7375. lightsalmon: "#ffa07a",
  7376. lightseagreen: "#20b2aa",
  7377. lightskyblue: "#87cefa",
  7378. lightslategray: "#778899",
  7379. lightslategrey: "#778899",
  7380. lightsteelblue: "#b0c4de",
  7381. lightyellow: "#ffffe0",
  7382. lime: "#00ff00",
  7383. limegreen: "#32cd32",
  7384. linen: "#faf0e6",
  7385. magenta: "#ff00ff",
  7386. maroon: "#800000",
  7387. mediumaquamarine: "#66cdaa",
  7388. mediumblue: "#0000cd",
  7389. mediumorchid: "#ba55d3",
  7390. mediumpurple: "#9370db",
  7391. mediumseagreen: "#3cb371",
  7392. mediumslateblue: "#7b68ee",
  7393. mediumspringgreen: "#00fa9a",
  7394. mediumturquoise: "#48d1cc",
  7395. mediumvioletred: "#c71585",
  7396. midnightblue: "#191970",
  7397. mintcream: "#f5fffa",
  7398. mistyrose: "#ffe4e1",
  7399. moccasin: "#ffe4b5",
  7400. navajowhite: "#ffdead",
  7401. navy: "#000080",
  7402. oldlace: "#fdf5e6",
  7403. olive: "#808000",
  7404. olivedrab: "#6b8e23",
  7405. orange: "#ffa500",
  7406. orangered: "#ff4500",
  7407. orchid: "#da70d6",
  7408. palegoldenrod: "#eee8aa",
  7409. palegreen: "#98fb98",
  7410. paleturquoise: "#afeeee",
  7411. palevioletred: "#db7093",
  7412. papayawhip: "#ffefd5",
  7413. peachpuff: "#ffdab9",
  7414. peru: "#cd853f",
  7415. pink: "#ffc0cb",
  7416. plum: "#dda0dd",
  7417. powderblue: "#b0e0e6",
  7418. purple: "#800080",
  7419. rebeccapurple: "#663399",
  7420. red: "#ff0000",
  7421. rosybrown: "#bc8f8f",
  7422. royalblue: "#4169e1",
  7423. saddlebrown: "#8b4513",
  7424. salmon: "#fa8072",
  7425. sandybrown: "#f4a460",
  7426. seagreen: "#2e8b57",
  7427. seashell: "#fff5ee",
  7428. sienna: "#a0522d",
  7429. silver: "#c0c0c0",
  7430. skyblue: "#87ceeb",
  7431. slateblue: "#6a5acd",
  7432. slategray: "#708090",
  7433. slategrey: "#708090",
  7434. snow: "#fffafa",
  7435. springgreen: "#00ff7f",
  7436. steelblue: "#4682b4",
  7437. tan: "#d2b48c",
  7438. teal: "#008080",
  7439. thistle: "#d8bfd8",
  7440. tomato: "#ff6347",
  7441. turquoise: "#40e0d0",
  7442. violet: "#ee82ee",
  7443. wheat: "#f5deb3",
  7444. white: "#ffffff",
  7445. whitesmoke: "#f5f5f5",
  7446. yellow: "#ffff00",
  7447. yellowgreen: "#9acd32"
  7448. };
  7449. function inputToRGB(color) {
  7450. var rgb = { r: 0, g: 0, b: 0 };
  7451. var a2 = 1;
  7452. var s2 = null;
  7453. var v2 = null;
  7454. var l2 = null;
  7455. var ok = false;
  7456. var format2 = false;
  7457. if (typeof color === "string") {
  7458. color = stringInputToObject(color);
  7459. }
  7460. if (typeof color === "object") {
  7461. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  7462. rgb = rgbToRgb(color.r, color.g, color.b);
  7463. ok = true;
  7464. format2 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  7465. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  7466. s2 = convertToPercentage(color.s);
  7467. v2 = convertToPercentage(color.v);
  7468. rgb = hsvToRgb(color.h, s2, v2);
  7469. ok = true;
  7470. format2 = "hsv";
  7471. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  7472. s2 = convertToPercentage(color.s);
  7473. l2 = convertToPercentage(color.l);
  7474. rgb = hslToRgb(color.h, s2, l2);
  7475. ok = true;
  7476. format2 = "hsl";
  7477. }
  7478. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  7479. a2 = color.a;
  7480. }
  7481. }
  7482. a2 = boundAlpha(a2);
  7483. return {
  7484. ok,
  7485. format: color.format || format2,
  7486. r: Math.min(255, Math.max(rgb.r, 0)),
  7487. g: Math.min(255, Math.max(rgb.g, 0)),
  7488. b: Math.min(255, Math.max(rgb.b, 0)),
  7489. a: a2
  7490. };
  7491. }
  7492. var CSS_INTEGER = "[-\\+]?\\d+%?";
  7493. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  7494. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  7495. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7496. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7497. var matchers = {
  7498. CSS_UNIT: new RegExp(CSS_UNIT),
  7499. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  7500. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  7501. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  7502. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  7503. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  7504. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  7505. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7506. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  7507. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7508. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  7509. };
  7510. function stringInputToObject(color) {
  7511. color = color.trim().toLowerCase();
  7512. if (color.length === 0) {
  7513. return false;
  7514. }
  7515. var named = false;
  7516. if (names[color]) {
  7517. color = names[color];
  7518. named = true;
  7519. } else if (color === "transparent") {
  7520. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  7521. }
  7522. var match = matchers.rgb.exec(color);
  7523. if (match) {
  7524. return { r: match[1], g: match[2], b: match[3] };
  7525. }
  7526. match = matchers.rgba.exec(color);
  7527. if (match) {
  7528. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  7529. }
  7530. match = matchers.hsl.exec(color);
  7531. if (match) {
  7532. return { h: match[1], s: match[2], l: match[3] };
  7533. }
  7534. match = matchers.hsla.exec(color);
  7535. if (match) {
  7536. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  7537. }
  7538. match = matchers.hsv.exec(color);
  7539. if (match) {
  7540. return { h: match[1], s: match[2], v: match[3] };
  7541. }
  7542. match = matchers.hsva.exec(color);
  7543. if (match) {
  7544. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  7545. }
  7546. match = matchers.hex8.exec(color);
  7547. if (match) {
  7548. return {
  7549. r: parseIntFromHex(match[1]),
  7550. g: parseIntFromHex(match[2]),
  7551. b: parseIntFromHex(match[3]),
  7552. a: convertHexToDecimal(match[4]),
  7553. format: named ? "name" : "hex8"
  7554. };
  7555. }
  7556. match = matchers.hex6.exec(color);
  7557. if (match) {
  7558. return {
  7559. r: parseIntFromHex(match[1]),
  7560. g: parseIntFromHex(match[2]),
  7561. b: parseIntFromHex(match[3]),
  7562. format: named ? "name" : "hex"
  7563. };
  7564. }
  7565. match = matchers.hex4.exec(color);
  7566. if (match) {
  7567. return {
  7568. r: parseIntFromHex(match[1] + match[1]),
  7569. g: parseIntFromHex(match[2] + match[2]),
  7570. b: parseIntFromHex(match[3] + match[3]),
  7571. a: convertHexToDecimal(match[4] + match[4]),
  7572. format: named ? "name" : "hex8"
  7573. };
  7574. }
  7575. match = matchers.hex3.exec(color);
  7576. if (match) {
  7577. return {
  7578. r: parseIntFromHex(match[1] + match[1]),
  7579. g: parseIntFromHex(match[2] + match[2]),
  7580. b: parseIntFromHex(match[3] + match[3]),
  7581. format: named ? "name" : "hex"
  7582. };
  7583. }
  7584. return false;
  7585. }
  7586. function isValidCSSUnit(color) {
  7587. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  7588. }
  7589. var TinyColor = function() {
  7590. function TinyColor2(color, opts) {
  7591. if (color === void 0) {
  7592. color = "";
  7593. }
  7594. if (opts === void 0) {
  7595. opts = {};
  7596. }
  7597. var _a2;
  7598. if (color instanceof TinyColor2) {
  7599. return color;
  7600. }
  7601. if (typeof color === "number") {
  7602. color = numberInputToObject(color);
  7603. }
  7604. this.originalInput = color;
  7605. var rgb = inputToRGB(color);
  7606. this.originalInput = color;
  7607. this.r = rgb.r;
  7608. this.g = rgb.g;
  7609. this.b = rgb.b;
  7610. this.a = rgb.a;
  7611. this.roundA = Math.round(100 * this.a) / 100;
  7612. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  7613. this.gradientType = opts.gradientType;
  7614. if (this.r < 1) {
  7615. this.r = Math.round(this.r);
  7616. }
  7617. if (this.g < 1) {
  7618. this.g = Math.round(this.g);
  7619. }
  7620. if (this.b < 1) {
  7621. this.b = Math.round(this.b);
  7622. }
  7623. this.isValid = rgb.ok;
  7624. }
  7625. TinyColor2.prototype.isDark = function() {
  7626. return this.getBrightness() < 128;
  7627. };
  7628. TinyColor2.prototype.isLight = function() {
  7629. return !this.isDark();
  7630. };
  7631. TinyColor2.prototype.getBrightness = function() {
  7632. var rgb = this.toRgb();
  7633. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  7634. };
  7635. TinyColor2.prototype.getLuminance = function() {
  7636. var rgb = this.toRgb();
  7637. var R;
  7638. var G;
  7639. var B;
  7640. var RsRGB = rgb.r / 255;
  7641. var GsRGB = rgb.g / 255;
  7642. var BsRGB = rgb.b / 255;
  7643. if (RsRGB <= 0.03928) {
  7644. R = RsRGB / 12.92;
  7645. } else {
  7646. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  7647. }
  7648. if (GsRGB <= 0.03928) {
  7649. G = GsRGB / 12.92;
  7650. } else {
  7651. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  7652. }
  7653. if (BsRGB <= 0.03928) {
  7654. B = BsRGB / 12.92;
  7655. } else {
  7656. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  7657. }
  7658. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  7659. };
  7660. TinyColor2.prototype.getAlpha = function() {
  7661. return this.a;
  7662. };
  7663. TinyColor2.prototype.setAlpha = function(alpha) {
  7664. this.a = boundAlpha(alpha);
  7665. this.roundA = Math.round(100 * this.a) / 100;
  7666. return this;
  7667. };
  7668. TinyColor2.prototype.toHsv = function() {
  7669. var hsv = rgbToHsv(this.r, this.g, this.b);
  7670. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  7671. };
  7672. TinyColor2.prototype.toHsvString = function() {
  7673. var hsv = rgbToHsv(this.r, this.g, this.b);
  7674. var h2 = Math.round(hsv.h * 360);
  7675. var s2 = Math.round(hsv.s * 100);
  7676. var v2 = Math.round(hsv.v * 100);
  7677. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%)") : "hsva(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%, ").concat(this.roundA, ")");
  7678. };
  7679. TinyColor2.prototype.toHsl = function() {
  7680. var hsl = rgbToHsl(this.r, this.g, this.b);
  7681. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  7682. };
  7683. TinyColor2.prototype.toHslString = function() {
  7684. var hsl = rgbToHsl(this.r, this.g, this.b);
  7685. var h2 = Math.round(hsl.h * 360);
  7686. var s2 = Math.round(hsl.s * 100);
  7687. var l2 = Math.round(hsl.l * 100);
  7688. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%)") : "hsla(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%, ").concat(this.roundA, ")");
  7689. };
  7690. TinyColor2.prototype.toHex = function(allow3Char) {
  7691. if (allow3Char === void 0) {
  7692. allow3Char = false;
  7693. }
  7694. return rgbToHex(this.r, this.g, this.b, allow3Char);
  7695. };
  7696. TinyColor2.prototype.toHexString = function(allow3Char) {
  7697. if (allow3Char === void 0) {
  7698. allow3Char = false;
  7699. }
  7700. return "#" + this.toHex(allow3Char);
  7701. };
  7702. TinyColor2.prototype.toHex8 = function(allow4Char) {
  7703. if (allow4Char === void 0) {
  7704. allow4Char = false;
  7705. }
  7706. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  7707. };
  7708. TinyColor2.prototype.toHex8String = function(allow4Char) {
  7709. if (allow4Char === void 0) {
  7710. allow4Char = false;
  7711. }
  7712. return "#" + this.toHex8(allow4Char);
  7713. };
  7714. TinyColor2.prototype.toRgb = function() {
  7715. return {
  7716. r: Math.round(this.r),
  7717. g: Math.round(this.g),
  7718. b: Math.round(this.b),
  7719. a: this.a
  7720. };
  7721. };
  7722. TinyColor2.prototype.toRgbString = function() {
  7723. var r = Math.round(this.r);
  7724. var g = Math.round(this.g);
  7725. var b2 = Math.round(this.b);
  7726. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b2, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b2, ", ").concat(this.roundA, ")");
  7727. };
  7728. TinyColor2.prototype.toPercentageRgb = function() {
  7729. var fmt = function(x2) {
  7730. return "".concat(Math.round(bound01(x2, 255) * 100), "%");
  7731. };
  7732. return {
  7733. r: fmt(this.r),
  7734. g: fmt(this.g),
  7735. b: fmt(this.b),
  7736. a: this.a
  7737. };
  7738. };
  7739. TinyColor2.prototype.toPercentageRgbString = function() {
  7740. var rnd = function(x2) {
  7741. return Math.round(bound01(x2, 255) * 100);
  7742. };
  7743. 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, ")");
  7744. };
  7745. TinyColor2.prototype.toName = function() {
  7746. if (this.a === 0) {
  7747. return "transparent";
  7748. }
  7749. if (this.a < 1) {
  7750. return false;
  7751. }
  7752. var hex2 = "#" + rgbToHex(this.r, this.g, this.b, false);
  7753. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  7754. var _b2 = _a2[_i], key = _b2[0], value = _b2[1];
  7755. if (hex2 === value) {
  7756. return key;
  7757. }
  7758. }
  7759. return false;
  7760. };
  7761. TinyColor2.prototype.toString = function(format2) {
  7762. var formatSet = Boolean(format2);
  7763. format2 = format2 !== null && format2 !== void 0 ? format2 : this.format;
  7764. var formattedString = false;
  7765. var hasAlpha = this.a < 1 && this.a >= 0;
  7766. var needsAlphaFormat = !formatSet && hasAlpha && (format2.startsWith("hex") || format2 === "name");
  7767. if (needsAlphaFormat) {
  7768. if (format2 === "name" && this.a === 0) {
  7769. return this.toName();
  7770. }
  7771. return this.toRgbString();
  7772. }
  7773. if (format2 === "rgb") {
  7774. formattedString = this.toRgbString();
  7775. }
  7776. if (format2 === "prgb") {
  7777. formattedString = this.toPercentageRgbString();
  7778. }
  7779. if (format2 === "hex" || format2 === "hex6") {
  7780. formattedString = this.toHexString();
  7781. }
  7782. if (format2 === "hex3") {
  7783. formattedString = this.toHexString(true);
  7784. }
  7785. if (format2 === "hex4") {
  7786. formattedString = this.toHex8String(true);
  7787. }
  7788. if (format2 === "hex8") {
  7789. formattedString = this.toHex8String();
  7790. }
  7791. if (format2 === "name") {
  7792. formattedString = this.toName();
  7793. }
  7794. if (format2 === "hsl") {
  7795. formattedString = this.toHslString();
  7796. }
  7797. if (format2 === "hsv") {
  7798. formattedString = this.toHsvString();
  7799. }
  7800. return formattedString || this.toHexString();
  7801. };
  7802. TinyColor2.prototype.toNumber = function() {
  7803. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  7804. };
  7805. TinyColor2.prototype.clone = function() {
  7806. return new TinyColor2(this.toString());
  7807. };
  7808. TinyColor2.prototype.lighten = function(amount) {
  7809. if (amount === void 0) {
  7810. amount = 10;
  7811. }
  7812. var hsl = this.toHsl();
  7813. hsl.l += amount / 100;
  7814. hsl.l = clamp01(hsl.l);
  7815. return new TinyColor2(hsl);
  7816. };
  7817. TinyColor2.prototype.brighten = function(amount) {
  7818. if (amount === void 0) {
  7819. amount = 10;
  7820. }
  7821. var rgb = this.toRgb();
  7822. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  7823. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  7824. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  7825. return new TinyColor2(rgb);
  7826. };
  7827. TinyColor2.prototype.darken = function(amount) {
  7828. if (amount === void 0) {
  7829. amount = 10;
  7830. }
  7831. var hsl = this.toHsl();
  7832. hsl.l -= amount / 100;
  7833. hsl.l = clamp01(hsl.l);
  7834. return new TinyColor2(hsl);
  7835. };
  7836. TinyColor2.prototype.tint = function(amount) {
  7837. if (amount === void 0) {
  7838. amount = 10;
  7839. }
  7840. return this.mix("white", amount);
  7841. };
  7842. TinyColor2.prototype.shade = function(amount) {
  7843. if (amount === void 0) {
  7844. amount = 10;
  7845. }
  7846. return this.mix("black", amount);
  7847. };
  7848. TinyColor2.prototype.desaturate = function(amount) {
  7849. if (amount === void 0) {
  7850. amount = 10;
  7851. }
  7852. var hsl = this.toHsl();
  7853. hsl.s -= amount / 100;
  7854. hsl.s = clamp01(hsl.s);
  7855. return new TinyColor2(hsl);
  7856. };
  7857. TinyColor2.prototype.saturate = function(amount) {
  7858. if (amount === void 0) {
  7859. amount = 10;
  7860. }
  7861. var hsl = this.toHsl();
  7862. hsl.s += amount / 100;
  7863. hsl.s = clamp01(hsl.s);
  7864. return new TinyColor2(hsl);
  7865. };
  7866. TinyColor2.prototype.greyscale = function() {
  7867. return this.desaturate(100);
  7868. };
  7869. TinyColor2.prototype.spin = function(amount) {
  7870. var hsl = this.toHsl();
  7871. var hue = (hsl.h + amount) % 360;
  7872. hsl.h = hue < 0 ? 360 + hue : hue;
  7873. return new TinyColor2(hsl);
  7874. };
  7875. TinyColor2.prototype.mix = function(color, amount) {
  7876. if (amount === void 0) {
  7877. amount = 50;
  7878. }
  7879. var rgb1 = this.toRgb();
  7880. var rgb2 = new TinyColor2(color).toRgb();
  7881. var p2 = amount / 100;
  7882. var rgba = {
  7883. r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
  7884. g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
  7885. b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
  7886. a: (rgb2.a - rgb1.a) * p2 + rgb1.a
  7887. };
  7888. return new TinyColor2(rgba);
  7889. };
  7890. TinyColor2.prototype.analogous = function(results, slices) {
  7891. if (results === void 0) {
  7892. results = 6;
  7893. }
  7894. if (slices === void 0) {
  7895. slices = 30;
  7896. }
  7897. var hsl = this.toHsl();
  7898. var part = 360 / slices;
  7899. var ret = [this];
  7900. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  7901. hsl.h = (hsl.h + part) % 360;
  7902. ret.push(new TinyColor2(hsl));
  7903. }
  7904. return ret;
  7905. };
  7906. TinyColor2.prototype.complement = function() {
  7907. var hsl = this.toHsl();
  7908. hsl.h = (hsl.h + 180) % 360;
  7909. return new TinyColor2(hsl);
  7910. };
  7911. TinyColor2.prototype.monochromatic = function(results) {
  7912. if (results === void 0) {
  7913. results = 6;
  7914. }
  7915. var hsv = this.toHsv();
  7916. var h2 = hsv.h;
  7917. var s2 = hsv.s;
  7918. var v2 = hsv.v;
  7919. var res = [];
  7920. var modification = 1 / results;
  7921. while (results--) {
  7922. res.push(new TinyColor2({ h: h2, s: s2, v: v2 }));
  7923. v2 = (v2 + modification) % 1;
  7924. }
  7925. return res;
  7926. };
  7927. TinyColor2.prototype.splitcomplement = function() {
  7928. var hsl = this.toHsl();
  7929. var h2 = hsl.h;
  7930. return [
  7931. this,
  7932. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  7933. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  7934. ];
  7935. };
  7936. TinyColor2.prototype.onBackground = function(background) {
  7937. var fg = this.toRgb();
  7938. var bg = new TinyColor2(background).toRgb();
  7939. return new TinyColor2({
  7940. r: bg.r + (fg.r - bg.r) * fg.a,
  7941. g: bg.g + (fg.g - bg.g) * fg.a,
  7942. b: bg.b + (fg.b - bg.b) * fg.a
  7943. });
  7944. };
  7945. TinyColor2.prototype.triad = function() {
  7946. return this.polyad(3);
  7947. };
  7948. TinyColor2.prototype.tetrad = function() {
  7949. return this.polyad(4);
  7950. };
  7951. TinyColor2.prototype.polyad = function(n) {
  7952. var hsl = this.toHsl();
  7953. var h2 = hsl.h;
  7954. var result = [this];
  7955. var increment = 360 / n;
  7956. for (var i = 1; i < n; i++) {
  7957. result.push(new TinyColor2({ h: (h2 + i * increment) % 360, s: hsl.s, l: hsl.l }));
  7958. }
  7959. return result;
  7960. };
  7961. TinyColor2.prototype.equals = function(color) {
  7962. return this.toRgbString() === new TinyColor2(color).toRgbString();
  7963. };
  7964. return TinyColor2;
  7965. }();
  7966. function darken(color, amount = 20) {
  7967. return color.mix("#141414", amount).toString();
  7968. }
  7969. function useButtonCustomStyle(props) {
  7970. const _disabled = useDisabled$1();
  7971. return computed(() => {
  7972. let styles = {};
  7973. const buttonColor = props.color;
  7974. if (buttonColor) {
  7975. const color = new TinyColor(buttonColor);
  7976. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  7977. if (props.plain) {
  7978. styles = {
  7979. "--el-button-bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  7980. "--el-button-text-color": buttonColor,
  7981. "--el-button-border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  7982. "--el-button-hover-text-color": "var(--el-color-white)",
  7983. "--el-button-hover-bg-color": buttonColor,
  7984. "--el-button-hover-border-color": buttonColor,
  7985. "--el-button-active-bg-color": activeBgColor,
  7986. "--el-button-active-text-color": "var(--el-color-white)",
  7987. "--el-button-active-border-color": activeBgColor
  7988. };
  7989. if (_disabled.value) {
  7990. styles["--el-button-disabled-bg-color"] = props.dark ? darken(color, 90) : color.tint(90).toString();
  7991. styles["--el-button-disabled-text-color"] = props.dark ? darken(color, 50) : color.tint(50).toString();
  7992. styles["--el-button-disabled-border-color"] = props.dark ? darken(color, 80) : color.tint(80).toString();
  7993. }
  7994. } else {
  7995. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  7996. const textColor = color.isDark() ? "var(--el-color-white)" : "var(--el-color-black)";
  7997. styles = {
  7998. "--el-button-bg-color": buttonColor,
  7999. "--el-button-text-color": textColor,
  8000. "--el-button-border-color": buttonColor,
  8001. "--el-button-hover-bg-color": hoverBgColor,
  8002. "--el-button-hover-text-color": textColor,
  8003. "--el-button-hover-border-color": hoverBgColor,
  8004. "--el-button-active-bg-color": activeBgColor,
  8005. "--el-button-active-border-color": activeBgColor
  8006. };
  8007. if (_disabled.value) {
  8008. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  8009. styles["--el-button-disabled-bg-color"] = disabledButtonColor;
  8010. styles["--el-button-disabled-text-color"] = props.dark ? "rgba(255, 255, 255, 0.5)" : "var(--el-color-white)";
  8011. styles["--el-button-disabled-border-color"] = disabledButtonColor;
  8012. }
  8013. }
  8014. }
  8015. return styles;
  8016. });
  8017. }
  8018. const _hoisted_1$A = ["disabled", "autofocus", "type"];
  8019. const __default__$f = {
  8020. name: "ElButton"
  8021. };
  8022. const _sfc_main$U = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$f), {
  8023. props: buttonProps,
  8024. emits: buttonEmits,
  8025. setup(__props, { expose, emit }) {
  8026. const props = __props;
  8027. const slots = useSlots();
  8028. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  8029. const globalConfig2 = useGlobalConfig("button");
  8030. const ns = useNamespace("button");
  8031. const { form } = useFormItem();
  8032. const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  8033. const _disabled = useDisabled$1();
  8034. const _ref = ref();
  8035. const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  8036. const autoInsertSpace = computed(() => {
  8037. var _a2, _b2, _c;
  8038. return (_c = (_b2 = props.autoInsertSpace) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  8039. });
  8040. const shouldAddSpace = computed(() => {
  8041. var _a2;
  8042. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  8043. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  8044. const slot = defaultSlot[0];
  8045. if ((slot == null ? void 0 : slot.type) === Text) {
  8046. const text = slot.children;
  8047. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  8048. }
  8049. }
  8050. return false;
  8051. });
  8052. const buttonStyle = useButtonCustomStyle(props);
  8053. const handleClick = (evt) => {
  8054. if (props.nativeType === "reset") {
  8055. form == null ? void 0 : form.resetFields();
  8056. }
  8057. emit("click", evt);
  8058. };
  8059. expose({
  8060. ref: _ref,
  8061. size: _size,
  8062. type: _type,
  8063. disabled: _disabled,
  8064. shouldAddSpace
  8065. });
  8066. return (_ctx, _cache) => {
  8067. return openBlock(), createElementBlock("button", {
  8068. ref_key: "_ref",
  8069. ref: _ref,
  8070. class: normalizeClass([
  8071. unref(ns).b(),
  8072. unref(ns).m(unref(_type)),
  8073. unref(ns).m(unref(_size)),
  8074. unref(ns).is("disabled", unref(_disabled)),
  8075. unref(ns).is("loading", _ctx.loading),
  8076. unref(ns).is("plain", _ctx.plain),
  8077. unref(ns).is("round", _ctx.round),
  8078. unref(ns).is("circle", _ctx.circle)
  8079. ]),
  8080. disabled: unref(_disabled) || _ctx.loading,
  8081. autofocus: _ctx.autofocus,
  8082. type: _ctx.nativeType,
  8083. style: normalizeStyle(unref(buttonStyle)),
  8084. onClick: handleClick
  8085. }, [
  8086. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  8087. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  8088. key: 1,
  8089. class: normalizeClass(unref(ns).is("loading"))
  8090. }, {
  8091. default: withCtx(() => [
  8092. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  8093. ]),
  8094. _: 1
  8095. }, 8, ["class"]))
  8096. ], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  8097. default: withCtx(() => [
  8098. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  8099. ]),
  8100. _: 3
  8101. })) : createCommentVNode("v-if", true),
  8102. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  8103. key: 2,
  8104. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  8105. }, [
  8106. renderSlot(_ctx.$slots, "default")
  8107. ], 2)) : createCommentVNode("v-if", true)
  8108. ], 14, _hoisted_1$A);
  8109. };
  8110. }
  8111. }));
  8112. var Button = /* @__PURE__ */ _export_sfc$1(_sfc_main$U, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
  8113. const buttonGroupProps = {
  8114. size: buttonProps.size,
  8115. type: buttonProps.type
  8116. };
  8117. const __default__$e = {
  8118. name: "ElButtonGroup"
  8119. };
  8120. const _sfc_main$T = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$e), {
  8121. props: buttonGroupProps,
  8122. setup(__props) {
  8123. const props = __props;
  8124. provide(buttonGroupContextKey, reactive({
  8125. size: toRef(props, "size"),
  8126. type: toRef(props, "type")
  8127. }));
  8128. const ns = useNamespace("button");
  8129. return (_ctx, _cache) => {
  8130. return openBlock(), createElementBlock("div", {
  8131. class: normalizeClass(`${unref(ns).b("group")}`)
  8132. }, [
  8133. renderSlot(_ctx.$slots, "default")
  8134. ], 2);
  8135. };
  8136. }
  8137. }));
  8138. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$T, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
  8139. const ElButton = withInstall(Button, {
  8140. ButtonGroup
  8141. });
  8142. withNoopInstall(ButtonGroup);
  8143. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  8144. var dayjs_min = { exports: {} };
  8145. (function(module2, exports2) {
  8146. !function(t, e) {
  8147. module2.exports = e();
  8148. }(commonjsGlobal, function() {
  8149. 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) {
  8150. var r2 = String(t2);
  8151. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  8152. }, g = { s: m2, z: function(t2) {
  8153. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  8154. return (e2 <= 0 ? "+" : "-") + m2(r2, 2, "0") + ":" + m2(i2, 2, "0");
  8155. }, m: function t2(e2, n2) {
  8156. if (e2.date() < n2.date())
  8157. return -t2(n2, e2);
  8158. 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);
  8159. return +(-(r2 + (n2 - i2) / (s3 ? i2 - u3 : u3 - i2)) || 0);
  8160. }, a: function(t2) {
  8161. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  8162. }, p: function(t2) {
  8163. 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$/, "");
  8164. }, u: function(t2) {
  8165. return t2 === void 0;
  8166. } }, v2 = "en", D2 = {};
  8167. D2[v2] = M2;
  8168. var p2 = function(t2) {
  8169. return t2 instanceof _2;
  8170. }, S2 = function t2(e2, n2, r2) {
  8171. var i2;
  8172. if (!e2)
  8173. return v2;
  8174. if (typeof e2 == "string") {
  8175. var s3 = e2.toLowerCase();
  8176. D2[s3] && (i2 = s3), n2 && (D2[s3] = n2, i2 = s3);
  8177. var u3 = e2.split("-");
  8178. if (!i2 && u3.length > 1)
  8179. return t2(u3[0]);
  8180. } else {
  8181. var a3 = e2.name;
  8182. D2[a3] = e2, i2 = a3;
  8183. }
  8184. return !r2 && i2 && (v2 = i2), i2 || !r2 && v2;
  8185. }, w2 = function(t2, e2) {
  8186. if (p2(t2))
  8187. return t2.clone();
  8188. var n2 = typeof e2 == "object" ? e2 : {};
  8189. return n2.date = t2, n2.args = arguments, new _2(n2);
  8190. }, O2 = g;
  8191. O2.l = S2, O2.i = p2, O2.w = function(t2, e2) {
  8192. return w2(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  8193. };
  8194. var _2 = function() {
  8195. function M3(t2) {
  8196. this.$L = S2(t2.locale, null, true), this.parse(t2);
  8197. }
  8198. var m3 = M3.prototype;
  8199. return m3.parse = function(t2) {
  8200. this.$d = function(t3) {
  8201. var e2 = t3.date, n2 = t3.utc;
  8202. if (e2 === null)
  8203. return new Date(NaN);
  8204. if (O2.u(e2))
  8205. return new Date();
  8206. if (e2 instanceof Date)
  8207. return new Date(e2);
  8208. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  8209. var r2 = e2.match(l2);
  8210. if (r2) {
  8211. var i2 = r2[2] - 1 || 0, s3 = (r2[7] || "0").substring(0, 3);
  8212. 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);
  8213. }
  8214. }
  8215. return new Date(e2);
  8216. }(t2), this.$x = t2.x || {}, this.init();
  8217. }, m3.init = function() {
  8218. var t2 = this.$d;
  8219. 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();
  8220. }, m3.$utils = function() {
  8221. return O2;
  8222. }, m3.isValid = function() {
  8223. return !(this.$d.toString() === $);
  8224. }, m3.isSame = function(t2, e2) {
  8225. var n2 = w2(t2);
  8226. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  8227. }, m3.isAfter = function(t2, e2) {
  8228. return w2(t2) < this.startOf(e2);
  8229. }, m3.isBefore = function(t2, e2) {
  8230. return this.endOf(e2) < w2(t2);
  8231. }, m3.$g = function(t2, e2, n2) {
  8232. return O2.u(t2) ? this[e2] : this.set(n2, t2);
  8233. }, m3.unix = function() {
  8234. return Math.floor(this.valueOf() / 1e3);
  8235. }, m3.valueOf = function() {
  8236. return this.$d.getTime();
  8237. }, m3.startOf = function(t2, e2) {
  8238. var n2 = this, r2 = !!O2.u(e2) || e2, h3 = O2.p(t2), $2 = function(t3, e3) {
  8239. var i2 = O2.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  8240. return r2 ? i2 : i2.endOf(a2);
  8241. }, l3 = function(t3, e3) {
  8242. return O2.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  8243. }, y2 = this.$W, M4 = this.$M, m4 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
  8244. switch (h3) {
  8245. case c:
  8246. return r2 ? $2(1, 0) : $2(31, 11);
  8247. case f:
  8248. return r2 ? $2(1, M4) : $2(0, M4 + 1);
  8249. case o2:
  8250. var v3 = this.$locale().weekStart || 0, D3 = (y2 < v3 ? y2 + 7 : y2) - v3;
  8251. return $2(r2 ? m4 - D3 : m4 + (6 - D3), M4);
  8252. case a2:
  8253. case d2:
  8254. return l3(g2 + "Hours", 0);
  8255. case u2:
  8256. return l3(g2 + "Minutes", 1);
  8257. case s2:
  8258. return l3(g2 + "Seconds", 2);
  8259. case i:
  8260. return l3(g2 + "Milliseconds", 3);
  8261. default:
  8262. return this.clone();
  8263. }
  8264. }, m3.endOf = function(t2) {
  8265. return this.startOf(t2, false);
  8266. }, m3.$set = function(t2, e2) {
  8267. 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;
  8268. if (o3 === f || o3 === c) {
  8269. var y2 = this.clone().set(d2, 1);
  8270. y2.$d[$2](l3), y2.init(), this.$d = y2.set(d2, Math.min(this.$D, y2.daysInMonth())).$d;
  8271. } else
  8272. $2 && this.$d[$2](l3);
  8273. return this.init(), this;
  8274. }, m3.set = function(t2, e2) {
  8275. return this.clone().$set(t2, e2);
  8276. }, m3.get = function(t2) {
  8277. return this[O2.p(t2)]();
  8278. }, m3.add = function(r2, h3) {
  8279. var d3, $2 = this;
  8280. r2 = Number(r2);
  8281. var l3 = O2.p(h3), y2 = function(t2) {
  8282. var e2 = w2($2);
  8283. return O2.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
  8284. };
  8285. if (l3 === f)
  8286. return this.set(f, this.$M + r2);
  8287. if (l3 === c)
  8288. return this.set(c, this.$y + r2);
  8289. if (l3 === a2)
  8290. return y2(1);
  8291. if (l3 === o2)
  8292. return y2(7);
  8293. var M4 = (d3 = {}, d3[s2] = e, d3[u2] = n, d3[i] = t, d3)[l3] || 1, m4 = this.$d.getTime() + r2 * M4;
  8294. return O2.w(m4, this);
  8295. }, m3.subtract = function(t2, e2) {
  8296. return this.add(-1 * t2, e2);
  8297. }, m3.format = function(t2) {
  8298. var e2 = this, n2 = this.$locale();
  8299. if (!this.isValid())
  8300. return n2.invalidDate || $;
  8301. 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) {
  8302. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s4);
  8303. }, c2 = function(t3) {
  8304. return O2.s(s3 % 12 || 12, t3, "0");
  8305. }, d3 = n2.meridiem || function(t3, e3, n3) {
  8306. var r3 = t3 < 12 ? "AM" : "PM";
  8307. return n3 ? r3.toLowerCase() : r3;
  8308. }, 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 };
  8309. return r2.replace(y, function(t3, e3) {
  8310. return e3 || l3[t3] || i2.replace(":", "");
  8311. });
  8312. }, m3.utcOffset = function() {
  8313. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  8314. }, m3.diff = function(r2, d3, $2) {
  8315. var l3, y2 = O2.p(d3), M4 = w2(r2), m4 = (M4.utcOffset() - this.utcOffset()) * e, g2 = this - M4, v3 = O2.m(this, M4);
  8316. 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);
  8317. }, m3.daysInMonth = function() {
  8318. return this.endOf(f).$D;
  8319. }, m3.$locale = function() {
  8320. return D2[this.$L];
  8321. }, m3.locale = function(t2, e2) {
  8322. if (!t2)
  8323. return this.$L;
  8324. var n2 = this.clone(), r2 = S2(t2, e2, true);
  8325. return r2 && (n2.$L = r2), n2;
  8326. }, m3.clone = function() {
  8327. return O2.w(this.$d, this);
  8328. }, m3.toDate = function() {
  8329. return new Date(this.valueOf());
  8330. }, m3.toJSON = function() {
  8331. return this.isValid() ? this.toISOString() : null;
  8332. }, m3.toISOString = function() {
  8333. return this.$d.toISOString();
  8334. }, m3.toString = function() {
  8335. return this.$d.toUTCString();
  8336. }, M3;
  8337. }(), T2 = _2.prototype;
  8338. return w2.prototype = T2, [["$ms", r], ["$s", i], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", f], ["$y", c], ["$D", d2]].forEach(function(t2) {
  8339. T2[t2[1]] = function(e2) {
  8340. return this.$g(e2, t2[0], t2[1]);
  8341. };
  8342. }), w2.extend = function(t2, e2) {
  8343. return t2.$i || (t2(e2, _2, w2), t2.$i = true), w2;
  8344. }, w2.locale = S2, w2.isDayjs = p2, w2.unix = function(t2) {
  8345. return w2(1e3 * t2);
  8346. }, w2.en = D2[v2], w2.Ls = D2, w2.p = {}, w2;
  8347. });
  8348. })(dayjs_min);
  8349. var dayjs = dayjs_min.exports;
  8350. var localeData$1 = { exports: {} };
  8351. (function(module2, exports2) {
  8352. !function(n, e) {
  8353. module2.exports = e();
  8354. }(commonjsGlobal, function() {
  8355. return function(n, e, t) {
  8356. var r = e.prototype, o2 = function(n2) {
  8357. return n2 && (n2.indexOf ? n2 : n2.s);
  8358. }, u2 = function(n2, e2, t2, r2, u3) {
  8359. var i2 = n2.name ? n2 : n2.$locale(), a3 = o2(i2[e2]), s3 = o2(i2[t2]), f = a3 || s3.map(function(n3) {
  8360. return n3.slice(0, r2);
  8361. });
  8362. if (!u3)
  8363. return f;
  8364. var d2 = i2.weekStart;
  8365. return f.map(function(n3, e3) {
  8366. return f[(e3 + (d2 || 0)) % 7];
  8367. });
  8368. }, i = function() {
  8369. return t.Ls[t.locale()];
  8370. }, a2 = function(n2, e2) {
  8371. return n2.formats[e2] || function(n3) {
  8372. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  8373. return e3 || t2.slice(1);
  8374. });
  8375. }(n2.formats[e2.toUpperCase()]);
  8376. }, s2 = function() {
  8377. var n2 = this;
  8378. return { months: function(e2) {
  8379. return e2 ? e2.format("MMMM") : u2(n2, "months");
  8380. }, monthsShort: function(e2) {
  8381. return e2 ? e2.format("MMM") : u2(n2, "monthsShort", "months", 3);
  8382. }, firstDayOfWeek: function() {
  8383. return n2.$locale().weekStart || 0;
  8384. }, weekdays: function(e2) {
  8385. return e2 ? e2.format("dddd") : u2(n2, "weekdays");
  8386. }, weekdaysMin: function(e2) {
  8387. return e2 ? e2.format("dd") : u2(n2, "weekdaysMin", "weekdays", 2);
  8388. }, weekdaysShort: function(e2) {
  8389. return e2 ? e2.format("ddd") : u2(n2, "weekdaysShort", "weekdays", 3);
  8390. }, longDateFormat: function(e2) {
  8391. return a2(n2.$locale(), e2);
  8392. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  8393. };
  8394. r.localeData = function() {
  8395. return s2.bind(this)();
  8396. }, t.localeData = function() {
  8397. var n2 = i();
  8398. return { firstDayOfWeek: function() {
  8399. return n2.weekStart || 0;
  8400. }, weekdays: function() {
  8401. return t.weekdays();
  8402. }, weekdaysShort: function() {
  8403. return t.weekdaysShort();
  8404. }, weekdaysMin: function() {
  8405. return t.weekdaysMin();
  8406. }, months: function() {
  8407. return t.months();
  8408. }, monthsShort: function() {
  8409. return t.monthsShort();
  8410. }, longDateFormat: function(e2) {
  8411. return a2(n2, e2);
  8412. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  8413. }, t.months = function() {
  8414. return u2(i(), "months");
  8415. }, t.monthsShort = function() {
  8416. return u2(i(), "monthsShort", "months", 3);
  8417. }, t.weekdays = function(n2) {
  8418. return u2(i(), "weekdays", null, null, n2);
  8419. }, t.weekdaysShort = function(n2) {
  8420. return u2(i(), "weekdaysShort", "weekdays", 3, n2);
  8421. }, t.weekdaysMin = function(n2) {
  8422. return u2(i(), "weekdaysMin", "weekdays", 2, n2);
  8423. };
  8424. };
  8425. });
  8426. })(localeData$1);
  8427. var localeData = localeData$1.exports;
  8428. var customParseFormat$1 = { exports: {} };
  8429. (function(module2, exports2) {
  8430. !function(e, t) {
  8431. module2.exports = t();
  8432. }(commonjsGlobal, function() {
  8433. 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) {
  8434. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  8435. };
  8436. var a2 = function(e2) {
  8437. return function(t2) {
  8438. this[e2] = +t2;
  8439. };
  8440. }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  8441. (this.zone || (this.zone = {})).offset = function(e3) {
  8442. if (!e3)
  8443. return 0;
  8444. if (e3 === "Z")
  8445. return 0;
  8446. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  8447. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  8448. }(e2);
  8449. }], h2 = function(e2) {
  8450. var t2 = o2[e2];
  8451. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  8452. }, u2 = function(e2, t2) {
  8453. var n2, r2 = o2.meridiem;
  8454. if (r2) {
  8455. for (var i2 = 1; i2 <= 24; i2 += 1)
  8456. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  8457. n2 = i2 > 12;
  8458. break;
  8459. }
  8460. } else
  8461. n2 = e2 === (t2 ? "pm" : "PM");
  8462. return n2;
  8463. }, d2 = { A: [i, function(e2) {
  8464. this.afternoon = u2(e2, false);
  8465. }], a: [i, function(e2) {
  8466. this.afternoon = u2(e2, true);
  8467. }], S: [/\d/, function(e2) {
  8468. this.milliseconds = 100 * +e2;
  8469. }], SS: [n, function(e2) {
  8470. this.milliseconds = 10 * +e2;
  8471. }], SSS: [/\d{3}/, function(e2) {
  8472. this.milliseconds = +e2;
  8473. }], 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) {
  8474. var t2 = o2.ordinal, n2 = e2.match(/\d+/);
  8475. if (this.day = n2[0], t2)
  8476. for (var r2 = 1; r2 <= 31; r2 += 1)
  8477. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  8478. }], M: [r, a2("month")], MM: [n, a2("month")], MMM: [i, function(e2) {
  8479. var t2 = h2("months"), n2 = (h2("monthsShort") || t2.map(function(e3) {
  8480. return e3.slice(0, 3);
  8481. })).indexOf(e2) + 1;
  8482. if (n2 < 1)
  8483. throw new Error();
  8484. this.month = n2 % 12 || n2;
  8485. }], MMMM: [i, function(e2) {
  8486. var t2 = h2("months").indexOf(e2) + 1;
  8487. if (t2 < 1)
  8488. throw new Error();
  8489. this.month = t2 % 12 || t2;
  8490. }], Y: [/[+-]?\d+/, a2("year")], YY: [n, function(e2) {
  8491. this.year = s2(e2);
  8492. }], YYYY: [/\d{4}/, a2("year")], Z: f, ZZ: f };
  8493. function c(n2) {
  8494. var r2, i2;
  8495. r2 = n2, i2 = o2 && o2.formats;
  8496. for (var s3 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  8497. var o3 = r3 && r3.toUpperCase();
  8498. return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  8499. return t3 || n4.slice(1);
  8500. });
  8501. })).match(t), a3 = s3.length, f2 = 0; f2 < a3; f2 += 1) {
  8502. var h3 = s3[f2], u3 = d2[h3], c2 = u3 && u3[0], l2 = u3 && u3[1];
  8503. s3[f2] = l2 ? { regex: c2, parser: l2 } : h3.replace(/^\[|\]$/g, "");
  8504. }
  8505. return function(e2) {
  8506. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a3; n3 += 1) {
  8507. var i3 = s3[n3];
  8508. if (typeof i3 == "string")
  8509. r3 += i3.length;
  8510. else {
  8511. var o3 = i3.regex, f3 = i3.parser, h4 = e2.slice(r3), u4 = o3.exec(h4)[0];
  8512. f3.call(t2, u4), e2 = e2.replace(u4, "");
  8513. }
  8514. }
  8515. return function(e3) {
  8516. var t3 = e3.afternoon;
  8517. if (t3 !== void 0) {
  8518. var n4 = e3.hours;
  8519. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  8520. }
  8521. }(t2), t2;
  8522. };
  8523. }
  8524. return function(e2, t2, n2) {
  8525. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s2 = e2.parseTwoDigitYear);
  8526. var r2 = t2.prototype, i2 = r2.parse;
  8527. r2.parse = function(e3) {
  8528. var t3 = e3.date, r3 = e3.utc, s3 = e3.args;
  8529. this.$u = r3;
  8530. var a3 = s3[1];
  8531. if (typeof a3 == "string") {
  8532. var f2 = s3[2] === true, h3 = s3[3] === true, u3 = f2 || h3, d3 = s3[2];
  8533. h3 && (d3 = s3[2]), o2 = this.$locale(), !f2 && d3 && (o2 = n2.Ls[d3]), this.$d = function(e4, t4, n3) {
  8534. try {
  8535. if (["x", "X"].indexOf(t4) > -1)
  8536. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  8537. 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;
  8538. i3 && !o3 || (Y2 = o3 > 0 ? o3 - 1 : l3.getMonth());
  8539. var p2 = a4 || 0, v2 = f3 || 0, D2 = h4 || 0, g = u4 || 0;
  8540. 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);
  8541. } catch (e5) {
  8542. return new Date("");
  8543. }
  8544. }(t3, a3, r3), this.init(), d3 && d3 !== true && (this.$L = this.locale(d3).$L), u3 && t3 != this.format(a3) && (this.$d = new Date("")), o2 = {};
  8545. } else if (a3 instanceof Array)
  8546. for (var l2 = a3.length, m2 = 1; m2 <= l2; m2 += 1) {
  8547. s3[1] = a3[m2 - 1];
  8548. var M2 = n2.apply(this, s3);
  8549. if (M2.isValid()) {
  8550. this.$d = M2.$d, this.$L = M2.$L, this.init();
  8551. break;
  8552. }
  8553. m2 === l2 && (this.$d = new Date(""));
  8554. }
  8555. else
  8556. i2.call(this, e3);
  8557. };
  8558. };
  8559. });
  8560. })(customParseFormat$1);
  8561. var customParseFormat = customParseFormat$1.exports;
  8562. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  8563. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  8564. const DEFAULT_FORMATS_DATEPICKER = {
  8565. date: DEFAULT_FORMATS_DATE,
  8566. week: "gggg[w]ww",
  8567. year: "YYYY",
  8568. month: "YYYY-MM",
  8569. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  8570. monthrange: "YYYY-MM",
  8571. daterange: DEFAULT_FORMATS_DATE,
  8572. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  8573. };
  8574. const timePickerDefaultProps = {
  8575. id: {
  8576. type: [Array, String]
  8577. },
  8578. name: {
  8579. type: [Array, String],
  8580. default: ""
  8581. },
  8582. popperClass: {
  8583. type: String,
  8584. default: ""
  8585. },
  8586. format: {
  8587. type: String
  8588. },
  8589. valueFormat: {
  8590. type: String
  8591. },
  8592. type: {
  8593. type: String,
  8594. default: ""
  8595. },
  8596. clearable: {
  8597. type: Boolean,
  8598. default: true
  8599. },
  8600. clearIcon: {
  8601. type: [String, Object],
  8602. default: circleClose
  8603. },
  8604. editable: {
  8605. type: Boolean,
  8606. default: true
  8607. },
  8608. prefixIcon: {
  8609. type: [String, Object],
  8610. default: ""
  8611. },
  8612. size: {
  8613. type: String,
  8614. validator: isValidComponentSize
  8615. },
  8616. readonly: {
  8617. type: Boolean,
  8618. default: false
  8619. },
  8620. disabled: {
  8621. type: Boolean,
  8622. default: false
  8623. },
  8624. placeholder: {
  8625. type: String,
  8626. default: ""
  8627. },
  8628. popperOptions: {
  8629. type: Object,
  8630. default: () => ({})
  8631. },
  8632. modelValue: {
  8633. type: [Date, Array, String, Number],
  8634. default: ""
  8635. },
  8636. rangeSeparator: {
  8637. type: String,
  8638. default: "-"
  8639. },
  8640. startPlaceholder: String,
  8641. endPlaceholder: String,
  8642. defaultValue: {
  8643. type: [Date, Array]
  8644. },
  8645. defaultTime: {
  8646. type: [Date, Array]
  8647. },
  8648. isRange: {
  8649. type: Boolean,
  8650. default: false
  8651. },
  8652. disabledHours: {
  8653. type: Function
  8654. },
  8655. disabledMinutes: {
  8656. type: Function
  8657. },
  8658. disabledSeconds: {
  8659. type: Function
  8660. },
  8661. disabledDate: {
  8662. type: Function
  8663. },
  8664. cellClassName: {
  8665. type: Function
  8666. },
  8667. shortcuts: {
  8668. type: Array,
  8669. default: () => []
  8670. },
  8671. arrowControl: {
  8672. type: Boolean,
  8673. default: false
  8674. },
  8675. validateEvent: {
  8676. type: Boolean,
  8677. default: true
  8678. },
  8679. unlinkPanels: Boolean
  8680. };
  8681. const dateEquals = function(a2, b2) {
  8682. const aIsDate = a2 instanceof Date;
  8683. const bIsDate = b2 instanceof Date;
  8684. if (aIsDate && bIsDate) {
  8685. return a2.getTime() === b2.getTime();
  8686. }
  8687. if (!aIsDate && !bIsDate) {
  8688. return a2 === b2;
  8689. }
  8690. return false;
  8691. };
  8692. const valueEquals = function(a2, b2) {
  8693. const aIsArray = Array.isArray(a2);
  8694. const bIsArray = Array.isArray(b2);
  8695. if (aIsArray && bIsArray) {
  8696. if (a2.length !== b2.length) {
  8697. return false;
  8698. }
  8699. return a2.every((item, index) => dateEquals(item, b2[index]));
  8700. }
  8701. if (!aIsArray && !bIsArray) {
  8702. return dateEquals(a2, b2);
  8703. }
  8704. return false;
  8705. };
  8706. const parser = function(date4, format2, lang) {
  8707. const day = isEmpty(format2) || format2 === "x" ? dayjs(date4).locale(lang) : dayjs(date4, format2).locale(lang);
  8708. return day.isValid() ? day : void 0;
  8709. };
  8710. const formatter = function(date4, format2, lang) {
  8711. if (isEmpty(format2))
  8712. return date4;
  8713. if (format2 === "x")
  8714. return +date4;
  8715. return dayjs(date4).locale(lang).format(format2);
  8716. };
  8717. const _sfc_main$S = defineComponent({
  8718. name: "Picker",
  8719. components: {
  8720. ElInput,
  8721. ElTooltip,
  8722. ElIcon
  8723. },
  8724. props: timePickerDefaultProps,
  8725. emits: [
  8726. "update:modelValue",
  8727. "change",
  8728. "focus",
  8729. "blur",
  8730. "calendar-change",
  8731. "panel-change",
  8732. "visible-change"
  8733. ],
  8734. setup(props, ctx) {
  8735. const { lang } = useLocale();
  8736. const nsDate = useNamespace("date");
  8737. const nsInput = useNamespace("input");
  8738. const nsRange = useNamespace("range");
  8739. const elForm2 = inject(formContextKey, {});
  8740. const elFormItem2 = inject(formItemContextKey, {});
  8741. const elPopperOptions = inject("ElPopperOptions", {});
  8742. const refPopper = ref();
  8743. const inputRef = ref();
  8744. const pickerVisible = ref(false);
  8745. const pickerActualVisible = ref(false);
  8746. const valueOnOpen = ref(null);
  8747. watch(pickerVisible, (val) => {
  8748. var _a2;
  8749. if (!val) {
  8750. userInput.value = null;
  8751. nextTick(() => {
  8752. emitChange(props.modelValue);
  8753. });
  8754. ctx.emit("blur");
  8755. blurInput();
  8756. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "blur").catch((err) => debugWarn()));
  8757. } else {
  8758. valueOnOpen.value = props.modelValue;
  8759. }
  8760. });
  8761. const emitChange = (val, isClear) => {
  8762. var _a2;
  8763. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  8764. ctx.emit("change", val);
  8765. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn()));
  8766. }
  8767. };
  8768. const emitInput = (val) => {
  8769. if (!valueEquals(props.modelValue, val)) {
  8770. let formatValue;
  8771. if (Array.isArray(val)) {
  8772. formatValue = val.map((_2) => formatter(_2, props.valueFormat, lang.value));
  8773. } else if (val) {
  8774. formatValue = formatter(val, props.valueFormat, lang.value);
  8775. }
  8776. ctx.emit("update:modelValue", val ? formatValue : val, lang.value);
  8777. }
  8778. };
  8779. const refInput = computed(() => {
  8780. if (inputRef.value) {
  8781. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  8782. return Array.from(_r.querySelectorAll("input"));
  8783. }
  8784. return [];
  8785. });
  8786. const refStartInput = computed(() => {
  8787. return refInput == null ? void 0 : refInput.value[0];
  8788. });
  8789. const refEndInput = computed(() => {
  8790. return refInput == null ? void 0 : refInput.value[1];
  8791. });
  8792. const setSelectionRange = (start2, end2, pos) => {
  8793. const _inputs = refInput.value;
  8794. if (!_inputs.length)
  8795. return;
  8796. if (!pos || pos === "min") {
  8797. _inputs[0].setSelectionRange(start2, end2);
  8798. _inputs[0].focus();
  8799. } else if (pos === "max") {
  8800. _inputs[1].setSelectionRange(start2, end2);
  8801. _inputs[1].focus();
  8802. }
  8803. };
  8804. const onPick = (date4 = "", visible = false) => {
  8805. pickerVisible.value = visible;
  8806. let result;
  8807. if (Array.isArray(date4)) {
  8808. result = date4.map((_2) => _2.toDate());
  8809. } else {
  8810. result = date4 ? date4.toDate() : date4;
  8811. }
  8812. userInput.value = null;
  8813. emitInput(result);
  8814. };
  8815. const onBeforeShow = () => {
  8816. pickerActualVisible.value = true;
  8817. };
  8818. const onShow = () => {
  8819. ctx.emit("visible-change", true);
  8820. };
  8821. const onHide = () => {
  8822. pickerActualVisible.value = false;
  8823. ctx.emit("visible-change", false);
  8824. };
  8825. const focus = (focusStartInput = true) => {
  8826. let input = refStartInput.value;
  8827. if (!focusStartInput && isRangeInput.value) {
  8828. input = refEndInput.value;
  8829. }
  8830. if (input) {
  8831. input.focus();
  8832. }
  8833. };
  8834. const handleFocus = (e) => {
  8835. if (props.readonly || pickerDisabled.value || pickerVisible.value)
  8836. return;
  8837. pickerVisible.value = true;
  8838. ctx.emit("focus", e);
  8839. };
  8840. const handleBlur = () => {
  8841. var _a2;
  8842. (_a2 = refPopper.value) == null ? void 0 : _a2.onClose();
  8843. blurInput();
  8844. };
  8845. const pickerDisabled = computed(() => {
  8846. return props.disabled || elForm2.disabled;
  8847. });
  8848. const parsedValue = computed(() => {
  8849. let result;
  8850. if (valueIsEmpty.value) {
  8851. if (pickerOptions.value.getDefaultValue) {
  8852. result = pickerOptions.value.getDefaultValue();
  8853. }
  8854. } else {
  8855. if (Array.isArray(props.modelValue)) {
  8856. result = props.modelValue.map((_2) => parser(_2, props.valueFormat, lang.value));
  8857. } else {
  8858. result = parser(props.modelValue, props.valueFormat, lang.value);
  8859. }
  8860. }
  8861. if (pickerOptions.value.getRangeAvailableTime) {
  8862. const availableResult = pickerOptions.value.getRangeAvailableTime(result);
  8863. if (!isEqual(availableResult, result)) {
  8864. result = availableResult;
  8865. emitInput(Array.isArray(result) ? result.map((_2) => _2.toDate()) : result.toDate());
  8866. }
  8867. }
  8868. if (Array.isArray(result) && result.some((_2) => !_2)) {
  8869. result = [];
  8870. }
  8871. return result;
  8872. });
  8873. const displayValue = computed(() => {
  8874. if (!pickerOptions.value.panelReady)
  8875. return;
  8876. const formattedValue = formatDayjsToString(parsedValue.value);
  8877. if (Array.isArray(userInput.value)) {
  8878. return [
  8879. userInput.value[0] || formattedValue && formattedValue[0] || "",
  8880. userInput.value[1] || formattedValue && formattedValue[1] || ""
  8881. ];
  8882. } else if (userInput.value !== null) {
  8883. return userInput.value;
  8884. }
  8885. if (!isTimePicker.value && valueIsEmpty.value)
  8886. return;
  8887. if (!pickerVisible.value && valueIsEmpty.value)
  8888. return;
  8889. if (formattedValue) {
  8890. return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
  8891. }
  8892. return "";
  8893. });
  8894. const isTimeLikePicker = computed(() => props.type.includes("time"));
  8895. const isTimePicker = computed(() => props.type.startsWith("time"));
  8896. const isDatesPicker = computed(() => props.type === "dates");
  8897. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock : calendar));
  8898. const showClose = ref(false);
  8899. const onClearIconClick = (event) => {
  8900. if (props.readonly || pickerDisabled.value)
  8901. return;
  8902. if (showClose.value) {
  8903. event.stopPropagation();
  8904. emitInput(null);
  8905. emitChange(null, true);
  8906. showClose.value = false;
  8907. pickerVisible.value = false;
  8908. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  8909. }
  8910. };
  8911. const valueIsEmpty = computed(() => {
  8912. return !props.modelValue || Array.isArray(props.modelValue) && !props.modelValue.length;
  8913. });
  8914. const onMouseEnter = () => {
  8915. if (props.readonly || pickerDisabled.value)
  8916. return;
  8917. if (!valueIsEmpty.value && props.clearable) {
  8918. showClose.value = true;
  8919. }
  8920. };
  8921. const onMouseLeave = () => {
  8922. showClose.value = false;
  8923. };
  8924. const isRangeInput = computed(() => {
  8925. return props.type.includes("range");
  8926. });
  8927. const pickerSize = useSize();
  8928. const popperPaneRef = computed(() => {
  8929. var _a2, _b2;
  8930. return (_b2 = (_a2 = refPopper.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  8931. });
  8932. const popperEl = computed(() => {
  8933. var _a2, _b2;
  8934. return (_b2 = (_a2 = unref(refPopper)) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  8935. });
  8936. const actualInputRef = computed(() => {
  8937. var _a2;
  8938. if (unref(isRangeInput)) {
  8939. return unref(inputRef);
  8940. }
  8941. return (_a2 = unref(inputRef)) == null ? void 0 : _a2.$el;
  8942. });
  8943. onClickOutside(actualInputRef, (e) => {
  8944. const unrefedPopperEl = unref(popperEl);
  8945. const inputEl = unref(actualInputRef);
  8946. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  8947. return;
  8948. pickerVisible.value = false;
  8949. });
  8950. const userInput = ref(null);
  8951. const handleChange2 = () => {
  8952. if (userInput.value) {
  8953. const value = parseUserInputToDayjs(displayValue.value);
  8954. if (value) {
  8955. if (isValidValue(value)) {
  8956. emitInput(Array.isArray(value) ? value.map((_2) => _2.toDate()) : value.toDate());
  8957. userInput.value = null;
  8958. }
  8959. }
  8960. }
  8961. if (userInput.value === "") {
  8962. emitInput(null);
  8963. emitChange(null);
  8964. userInput.value = null;
  8965. }
  8966. };
  8967. const blurInput = () => {
  8968. refInput.value.forEach((input) => input.blur());
  8969. };
  8970. const parseUserInputToDayjs = (value) => {
  8971. if (!value)
  8972. return null;
  8973. return pickerOptions.value.parseUserInput(value);
  8974. };
  8975. const formatDayjsToString = (value) => {
  8976. if (!value)
  8977. return null;
  8978. return pickerOptions.value.formatToString(value);
  8979. };
  8980. const isValidValue = (value) => {
  8981. return pickerOptions.value.isValidValue(value);
  8982. };
  8983. const handleKeydown = (event) => {
  8984. const code = event.code;
  8985. if (code === EVENT_CODE.esc) {
  8986. pickerVisible.value = false;
  8987. event.stopPropagation();
  8988. return;
  8989. }
  8990. if (code === EVENT_CODE.tab) {
  8991. if (!isRangeInput.value) {
  8992. handleChange2();
  8993. pickerVisible.value = false;
  8994. event.stopPropagation();
  8995. } else {
  8996. setTimeout(() => {
  8997. if (!refInput.value.includes(document.activeElement)) {
  8998. pickerVisible.value = false;
  8999. blurInput();
  9000. }
  9001. }, 0);
  9002. }
  9003. return;
  9004. }
  9005. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  9006. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  9007. handleChange2();
  9008. pickerVisible.value = false;
  9009. }
  9010. event.stopPropagation();
  9011. return;
  9012. }
  9013. if (userInput.value) {
  9014. event.stopPropagation();
  9015. return;
  9016. }
  9017. if (pickerOptions.value.handleKeydown) {
  9018. pickerOptions.value.handleKeydown(event);
  9019. }
  9020. };
  9021. const onUserInput = (e) => {
  9022. userInput.value = e;
  9023. };
  9024. const handleStartInput = (event) => {
  9025. if (userInput.value) {
  9026. userInput.value = [event.target.value, userInput.value[1]];
  9027. } else {
  9028. userInput.value = [event.target.value, null];
  9029. }
  9030. };
  9031. const handleEndInput = (event) => {
  9032. if (userInput.value) {
  9033. userInput.value = [userInput.value[0], event.target.value];
  9034. } else {
  9035. userInput.value = [null, event.target.value];
  9036. }
  9037. };
  9038. const handleStartChange = () => {
  9039. const value = parseUserInputToDayjs(userInput.value && userInput.value[0]);
  9040. if (value && value.isValid()) {
  9041. userInput.value = [formatDayjsToString(value), displayValue.value[1]];
  9042. const newValue = [value, parsedValue.value && parsedValue.value[1]];
  9043. if (isValidValue(newValue)) {
  9044. emitInput(newValue);
  9045. userInput.value = null;
  9046. }
  9047. }
  9048. };
  9049. const handleEndChange = () => {
  9050. const value = parseUserInputToDayjs(userInput.value && userInput.value[1]);
  9051. if (value && value.isValid()) {
  9052. userInput.value = [displayValue.value[0], formatDayjsToString(value)];
  9053. const newValue = [parsedValue.value && parsedValue.value[0], value];
  9054. if (isValidValue(newValue)) {
  9055. emitInput(newValue);
  9056. userInput.value = null;
  9057. }
  9058. }
  9059. };
  9060. const pickerOptions = ref({});
  9061. const onSetPickerOption = (e) => {
  9062. pickerOptions.value[e[0]] = e[1];
  9063. pickerOptions.value.panelReady = true;
  9064. };
  9065. const onCalendarChange = (e) => {
  9066. ctx.emit("calendar-change", e);
  9067. };
  9068. const onPanelChange = (value, mode, view2) => {
  9069. ctx.emit("panel-change", value, mode, view2);
  9070. };
  9071. provide("EP_PICKER_BASE", {
  9072. props
  9073. });
  9074. return {
  9075. nsDate,
  9076. nsInput,
  9077. nsRange,
  9078. elPopperOptions,
  9079. isDatesPicker,
  9080. handleEndChange,
  9081. handleStartChange,
  9082. handleStartInput,
  9083. handleEndInput,
  9084. onUserInput,
  9085. handleChange: handleChange2,
  9086. handleKeydown,
  9087. popperPaneRef,
  9088. onClickOutside,
  9089. pickerSize,
  9090. isRangeInput,
  9091. onMouseLeave,
  9092. onMouseEnter,
  9093. onClearIconClick,
  9094. showClose,
  9095. triggerIcon,
  9096. onPick,
  9097. handleFocus,
  9098. handleBlur,
  9099. pickerVisible,
  9100. pickerActualVisible,
  9101. displayValue,
  9102. parsedValue,
  9103. setSelectionRange,
  9104. refPopper,
  9105. inputRef,
  9106. pickerDisabled,
  9107. onSetPickerOption,
  9108. onCalendarChange,
  9109. onPanelChange,
  9110. focus,
  9111. onShow,
  9112. onBeforeShow,
  9113. onHide
  9114. };
  9115. }
  9116. });
  9117. const _hoisted_1$z = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9118. const _hoisted_2$r = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9119. function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
  9120. const _component_el_icon = resolveComponent("el-icon");
  9121. const _component_el_input = resolveComponent("el-input");
  9122. const _component_el_tooltip = resolveComponent("el-tooltip");
  9123. return openBlock(), createBlock(_component_el_tooltip, mergeProps({
  9124. ref: "refPopper",
  9125. visible: _ctx.pickerVisible,
  9126. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.pickerVisible = $event),
  9127. effect: "light",
  9128. pure: "",
  9129. trigger: "click"
  9130. }, _ctx.$attrs, {
  9131. "append-to-body": "",
  9132. transition: `${_ctx.nsDate.namespace.value}-zoom-in-top`,
  9133. "popper-class": [`${_ctx.nsDate.namespace.value}-picker__popper`, _ctx.popperClass],
  9134. "popper-options": _ctx.elPopperOptions,
  9135. "fallback-placements": ["bottom", "top", "right", "left"],
  9136. "gpu-acceleration": false,
  9137. "stop-popper-mouse-event": false,
  9138. "hide-after": 0,
  9139. persistent: "",
  9140. onBeforeShow: _ctx.onBeforeShow,
  9141. onShow: _ctx.onShow,
  9142. onHide: _ctx.onHide
  9143. }), {
  9144. default: withCtx(() => [
  9145. !_ctx.isRangeInput ? (openBlock(), createBlock(_component_el_input, {
  9146. key: 0,
  9147. id: _ctx.id,
  9148. ref: "inputRef",
  9149. "model-value": _ctx.displayValue,
  9150. name: _ctx.name,
  9151. size: _ctx.pickerSize,
  9152. disabled: _ctx.pickerDisabled,
  9153. placeholder: _ctx.placeholder,
  9154. class: normalizeClass([_ctx.nsDate.b("editor"), _ctx.nsDate.bm("editor", _ctx.type), _ctx.$attrs.class]),
  9155. style: normalizeStyle(_ctx.$attrs.style),
  9156. readonly: !_ctx.editable || _ctx.readonly || _ctx.isDatesPicker || _ctx.type === "week",
  9157. onInput: _ctx.onUserInput,
  9158. onFocus: _ctx.handleFocus,
  9159. onKeydown: _ctx.handleKeydown,
  9160. onChange: _ctx.handleChange,
  9161. onMouseenter: _ctx.onMouseEnter,
  9162. onMouseleave: _ctx.onMouseLeave,
  9163. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  9164. }, ["stop"]))
  9165. }, {
  9166. prefix: withCtx(() => [
  9167. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9168. key: 0,
  9169. class: normalizeClass(_ctx.nsInput.e("icon")),
  9170. onClick: _ctx.handleFocus
  9171. }, {
  9172. default: withCtx(() => [
  9173. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9174. ]),
  9175. _: 1
  9176. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9177. ]),
  9178. suffix: withCtx(() => [
  9179. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9180. key: 0,
  9181. class: normalizeClass(`${_ctx.nsInput.e("icon")} clear-icon`),
  9182. onClick: _ctx.onClearIconClick
  9183. }, {
  9184. default: withCtx(() => [
  9185. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9186. ]),
  9187. _: 1
  9188. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9189. ]),
  9190. _: 1
  9191. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "onInput", "onFocus", "onKeydown", "onChange", "onMouseenter", "onMouseleave"])) : (openBlock(), createElementBlock("div", {
  9192. key: 1,
  9193. ref: "inputRef",
  9194. class: normalizeClass([
  9195. _ctx.nsDate.b("editor"),
  9196. _ctx.nsDate.bm("editor", _ctx.type),
  9197. _ctx.nsInput.e("inner"),
  9198. _ctx.nsDate.is("disabled", _ctx.pickerDisabled),
  9199. _ctx.nsDate.is("active", _ctx.pickerVisible),
  9200. _ctx.nsRange.b("editor"),
  9201. _ctx.pickerSize ? _ctx.nsRange.bm("editor", _ctx.pickerSize) : "",
  9202. _ctx.$attrs.class
  9203. ]),
  9204. style: normalizeStyle(_ctx.$attrs.style),
  9205. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9206. onMouseenter: _cache[8] || (_cache[8] = (...args) => _ctx.onMouseEnter && _ctx.onMouseEnter(...args)),
  9207. onMouseleave: _cache[9] || (_cache[9] = (...args) => _ctx.onMouseLeave && _ctx.onMouseLeave(...args)),
  9208. onKeydown: _cache[10] || (_cache[10] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  9209. }, [
  9210. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9211. key: 0,
  9212. class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsRange.e("icon")]),
  9213. onClick: _ctx.handleFocus
  9214. }, {
  9215. default: withCtx(() => [
  9216. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9217. ]),
  9218. _: 1
  9219. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  9220. createElementVNode("input", {
  9221. id: _ctx.id && _ctx.id[0],
  9222. autocomplete: "off",
  9223. name: _ctx.name && _ctx.name[0],
  9224. placeholder: _ctx.startPlaceholder,
  9225. value: _ctx.displayValue && _ctx.displayValue[0],
  9226. disabled: _ctx.pickerDisabled,
  9227. readonly: !_ctx.editable || _ctx.readonly,
  9228. class: normalizeClass(_ctx.nsRange.b("input")),
  9229. onInput: _cache[1] || (_cache[1] = (...args) => _ctx.handleStartInput && _ctx.handleStartInput(...args)),
  9230. onChange: _cache[2] || (_cache[2] = (...args) => _ctx.handleStartChange && _ctx.handleStartChange(...args)),
  9231. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args))
  9232. }, null, 42, _hoisted_1$z),
  9233. renderSlot(_ctx.$slots, "range-separator", {}, () => [
  9234. createElementVNode("span", {
  9235. class: normalizeClass(_ctx.nsRange.b("separator"))
  9236. }, toDisplayString(_ctx.rangeSeparator), 3)
  9237. ]),
  9238. createElementVNode("input", {
  9239. id: _ctx.id && _ctx.id[1],
  9240. autocomplete: "off",
  9241. name: _ctx.name && _ctx.name[1],
  9242. placeholder: _ctx.endPlaceholder,
  9243. value: _ctx.displayValue && _ctx.displayValue[1],
  9244. disabled: _ctx.pickerDisabled,
  9245. readonly: !_ctx.editable || _ctx.readonly,
  9246. class: normalizeClass(_ctx.nsRange.b("input")),
  9247. onFocus: _cache[4] || (_cache[4] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9248. onInput: _cache[5] || (_cache[5] = (...args) => _ctx.handleEndInput && _ctx.handleEndInput(...args)),
  9249. onChange: _cache[6] || (_cache[6] = (...args) => _ctx.handleEndChange && _ctx.handleEndChange(...args))
  9250. }, null, 42, _hoisted_2$r),
  9251. _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9252. key: 1,
  9253. class: normalizeClass([
  9254. _ctx.nsInput.e("icon"),
  9255. _ctx.nsRange.e("close-icon"),
  9256. {
  9257. [_ctx.nsRange.e("close-icon--hidden")]: !_ctx.showClose
  9258. }
  9259. ]),
  9260. onClick: _ctx.onClearIconClick
  9261. }, {
  9262. default: withCtx(() => [
  9263. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9264. ]),
  9265. _: 1
  9266. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9267. ], 38))
  9268. ]),
  9269. content: withCtx(() => [
  9270. renderSlot(_ctx.$slots, "default", {
  9271. visible: _ctx.pickerVisible,
  9272. actualVisible: _ctx.pickerActualVisible,
  9273. parsedValue: _ctx.parsedValue,
  9274. format: _ctx.format,
  9275. unlinkPanels: _ctx.unlinkPanels,
  9276. type: _ctx.type,
  9277. defaultValue: _ctx.defaultValue,
  9278. onPick: _cache[11] || (_cache[11] = (...args) => _ctx.onPick && _ctx.onPick(...args)),
  9279. onSelectRange: _cache[12] || (_cache[12] = (...args) => _ctx.setSelectionRange && _ctx.setSelectionRange(...args)),
  9280. onSetPickerOption: _cache[13] || (_cache[13] = (...args) => _ctx.onSetPickerOption && _ctx.onSetPickerOption(...args)),
  9281. onCalendarChange: _cache[14] || (_cache[14] = (...args) => _ctx.onCalendarChange && _ctx.onCalendarChange(...args)),
  9282. onPanelChange: _cache[15] || (_cache[15] = (...args) => _ctx.onPanelChange && _ctx.onPanelChange(...args)),
  9283. onMousedown: _cache[16] || (_cache[16] = withModifiers(() => {
  9284. }, ["stop"]))
  9285. })
  9286. ]),
  9287. _: 3
  9288. }, 16, ["visible", "transition", "popper-class", "popper-options", "onBeforeShow", "onShow", "onHide"]);
  9289. }
  9290. 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"]]);
  9291. const nodeList = /* @__PURE__ */ new Map();
  9292. let startClick;
  9293. if (isClient$1) {
  9294. document.addEventListener("mousedown", (e) => startClick = e);
  9295. document.addEventListener("mouseup", (e) => {
  9296. for (const handlers of nodeList.values()) {
  9297. for (const { documentHandler } of handlers) {
  9298. documentHandler(e, startClick);
  9299. }
  9300. }
  9301. });
  9302. }
  9303. function createDocumentHandler(el, binding) {
  9304. let excludes = [];
  9305. if (Array.isArray(binding.arg)) {
  9306. excludes = binding.arg;
  9307. } else if (isElement$1(binding.arg)) {
  9308. excludes.push(binding.arg);
  9309. }
  9310. return function(mouseup, mousedown) {
  9311. const popperRef = binding.instance.popperRef;
  9312. const mouseUpTarget = mouseup.target;
  9313. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  9314. const isBound = !binding || !binding.instance;
  9315. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  9316. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  9317. const isSelf = el === mouseUpTarget;
  9318. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  9319. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  9320. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  9321. return;
  9322. }
  9323. binding.value(mouseup, mousedown);
  9324. };
  9325. }
  9326. const ClickOutside = {
  9327. beforeMount(el, binding) {
  9328. if (!nodeList.has(el)) {
  9329. nodeList.set(el, []);
  9330. }
  9331. nodeList.get(el).push({
  9332. documentHandler: createDocumentHandler(el, binding),
  9333. bindingFn: binding.value
  9334. });
  9335. },
  9336. updated(el, binding) {
  9337. if (!nodeList.has(el)) {
  9338. nodeList.set(el, []);
  9339. }
  9340. const handlers = nodeList.get(el);
  9341. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  9342. const newHandler = {
  9343. documentHandler: createDocumentHandler(el, binding),
  9344. bindingFn: binding.value
  9345. };
  9346. if (oldHandlerIndex >= 0) {
  9347. handlers.splice(oldHandlerIndex, 1, newHandler);
  9348. } else {
  9349. handlers.push(newHandler);
  9350. }
  9351. },
  9352. unmounted(el) {
  9353. nodeList.delete(el);
  9354. }
  9355. };
  9356. var RepeatClick = {
  9357. beforeMount(el, binding) {
  9358. let interval = null;
  9359. let startTime;
  9360. const handler3 = () => binding.value && binding.value();
  9361. const clear = () => {
  9362. if (Date.now() - startTime < 100) {
  9363. handler3();
  9364. }
  9365. clearInterval(interval);
  9366. interval = null;
  9367. };
  9368. on(el, "mousedown", (e) => {
  9369. if (e.button !== 0)
  9370. return;
  9371. startTime = Date.now();
  9372. once(document, "mouseup", clear);
  9373. clearInterval(interval);
  9374. interval = setInterval(handler3, 100);
  9375. });
  9376. }
  9377. };
  9378. var D = false, o, p, m, u, d, M, l, w, x, E, F, _, h, A, X;
  9379. function a() {
  9380. if (!D) {
  9381. D = true;
  9382. 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);
  9383. 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) {
  9384. o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
  9385. var r = /(?:Trident\/(\d+.\d+))/.exec(e);
  9386. 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;
  9387. } else
  9388. o = p = m = d = u = NaN;
  9389. if (i) {
  9390. if (i[1]) {
  9391. var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
  9392. l = t ? parseFloat(t[1].replace("_", ".")) : true;
  9393. } else
  9394. l = false;
  9395. w = !!i[2], x = !!i[3];
  9396. } else
  9397. l = w = x = false;
  9398. }
  9399. }
  9400. var v = { ie: function() {
  9401. return a() || o;
  9402. }, ieCompatibilityMode: function() {
  9403. return a() || M > o;
  9404. }, ie64: function() {
  9405. return v.ie() && F;
  9406. }, firefox: function() {
  9407. return a() || p;
  9408. }, opera: function() {
  9409. return a() || m;
  9410. }, webkit: function() {
  9411. return a() || u;
  9412. }, safari: function() {
  9413. return v.webkit();
  9414. }, chrome: function() {
  9415. return a() || d;
  9416. }, windows: function() {
  9417. return a() || w;
  9418. }, osx: function() {
  9419. return a() || l;
  9420. }, linux: function() {
  9421. return a() || x;
  9422. }, iphone: function() {
  9423. return a() || _;
  9424. }, mobile: function() {
  9425. return a() || _ || h || E || X;
  9426. }, nativeApp: function() {
  9427. return a() || A;
  9428. }, android: function() {
  9429. return a() || E;
  9430. }, ipad: function() {
  9431. return a() || h;
  9432. } }, b = v;
  9433. 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;
  9434. var O;
  9435. N.canUseDOM && (O = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true);
  9436. function L(e, n) {
  9437. if (!N.canUseDOM || n && !("addEventListener" in document))
  9438. return false;
  9439. var i = "on" + e, r = i in document;
  9440. if (!r) {
  9441. var t = document.createElement("div");
  9442. t.setAttribute(i, "return;"), r = typeof t[i] == "function";
  9443. }
  9444. return !r && O && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
  9445. }
  9446. var I = L;
  9447. var P = 10, T = 40, U = 800;
  9448. function S(e) {
  9449. var n = 0, i = 0, r = 0, t = 0;
  9450. 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 };
  9451. }
  9452. S.getEventType = function() {
  9453. return b.firefox() ? "DOMMouseScroll" : I("wheel") ? "wheel" : "mousewheel";
  9454. };
  9455. var W = S;
  9456. /**
  9457. * Checks if an event is supported in the current execution environment.
  9458. *
  9459. * NOTE: This will not work correctly for non-generic events such as `change`,
  9460. * `reset`, `load`, `error`, and `select`.
  9461. *
  9462. * Borrows from Modernizr.
  9463. *
  9464. * @param {string} eventNameSuffix Event name, e.g. "click".
  9465. * @param {?boolean} capture Check if the capture phase is supported.
  9466. * @return {boolean} True if the event is supported.
  9467. * @internal
  9468. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  9469. */
  9470. const mousewheel = function(element, callback) {
  9471. if (element && element.addEventListener) {
  9472. const fn2 = function(event) {
  9473. const normalized = W(event);
  9474. callback && Reflect.apply(callback, this, [event, normalized]);
  9475. };
  9476. if (isFirefox()) {
  9477. element.addEventListener("DOMMouseScroll", fn2);
  9478. } else {
  9479. element.onmousewheel = fn2;
  9480. }
  9481. }
  9482. };
  9483. const Mousewheel = {
  9484. beforeMount(el, binding) {
  9485. mousewheel(el, binding.value);
  9486. }
  9487. };
  9488. const makeList = (total, method4, methodFunc) => {
  9489. const arr = [];
  9490. const disabledArr = method4 && methodFunc();
  9491. for (let i = 0; i < total; i++) {
  9492. arr[i] = disabledArr ? disabledArr.includes(i) : false;
  9493. }
  9494. return arr;
  9495. };
  9496. const makeAvailableArr = (list) => {
  9497. return list.map((_2, index) => !_2 ? index : _2).filter((_2) => _2 !== true);
  9498. };
  9499. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  9500. const getHoursList = (role, compare) => {
  9501. return makeList(24, disabledHours, () => disabledHours(role, compare));
  9502. };
  9503. const getMinutesList = (hour, role, compare) => {
  9504. return makeList(60, disabledMinutes, () => disabledMinutes(hour, role, compare));
  9505. };
  9506. const getSecondsList = (hour, minute, role, compare) => {
  9507. return makeList(60, disabledSeconds, () => disabledSeconds(hour, minute, role, compare));
  9508. };
  9509. return {
  9510. getHoursList,
  9511. getMinutesList,
  9512. getSecondsList
  9513. };
  9514. };
  9515. const getAvailableArrs = (disabledHours, disabledMinutes, disabledSeconds) => {
  9516. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  9517. const getAvailableHours = (role, compare) => {
  9518. return makeAvailableArr(getHoursList(role, compare));
  9519. };
  9520. const getAvailableMinutes = (hour, role, compare) => {
  9521. return makeAvailableArr(getMinutesList(hour, role, compare));
  9522. };
  9523. const getAvailableSeconds = (hour, minute, role, compare) => {
  9524. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  9525. };
  9526. return {
  9527. getAvailableHours,
  9528. getAvailableMinutes,
  9529. getAvailableSeconds
  9530. };
  9531. };
  9532. const useOldValue = (props) => {
  9533. const oldValue = ref(props.parsedValue);
  9534. watch(() => props.visible, (val) => {
  9535. if (!val) {
  9536. oldValue.value = props.parsedValue;
  9537. }
  9538. });
  9539. return oldValue;
  9540. };
  9541. const _sfc_main$R = defineComponent({
  9542. directives: {
  9543. repeatClick: RepeatClick
  9544. },
  9545. components: {
  9546. ElScrollbar,
  9547. ElIcon,
  9548. ArrowUp: arrowUp,
  9549. ArrowDown: arrowDown
  9550. },
  9551. props: {
  9552. role: {
  9553. type: String,
  9554. required: true
  9555. },
  9556. spinnerDate: {
  9557. type: Object,
  9558. required: true
  9559. },
  9560. showSeconds: {
  9561. type: Boolean,
  9562. default: true
  9563. },
  9564. arrowControl: Boolean,
  9565. amPmMode: {
  9566. type: String,
  9567. default: ""
  9568. },
  9569. disabledHours: {
  9570. type: Function
  9571. },
  9572. disabledMinutes: {
  9573. type: Function
  9574. },
  9575. disabledSeconds: {
  9576. type: Function
  9577. }
  9578. },
  9579. emits: ["change", "select-range", "set-option"],
  9580. setup(props, ctx) {
  9581. const ns = useNamespace("time");
  9582. let isScrolling = false;
  9583. const debouncedResetScroll = debounce$1((type4) => {
  9584. isScrolling = false;
  9585. adjustCurrentSpinner(type4);
  9586. }, 200);
  9587. const currentScrollbar = ref(null);
  9588. const listHoursRef = ref(null);
  9589. const listMinutesRef = ref(null);
  9590. const listSecondsRef = ref(null);
  9591. const listRefsMap = {
  9592. hours: listHoursRef,
  9593. minutes: listMinutesRef,
  9594. seconds: listSecondsRef
  9595. };
  9596. const spinnerItems = computed(() => {
  9597. const arr = ["hours", "minutes", "seconds"];
  9598. return props.showSeconds ? arr : arr.slice(0, 2);
  9599. });
  9600. const hours = computed(() => {
  9601. return props.spinnerDate.hour();
  9602. });
  9603. const minutes = computed(() => {
  9604. return props.spinnerDate.minute();
  9605. });
  9606. const seconds = computed(() => {
  9607. return props.spinnerDate.second();
  9608. });
  9609. const timePartsMap = computed(() => ({
  9610. hours,
  9611. minutes,
  9612. seconds
  9613. }));
  9614. const hoursList = computed(() => {
  9615. return getHoursList(props.role);
  9616. });
  9617. const minutesList = computed(() => {
  9618. return getMinutesList(hours.value, props.role);
  9619. });
  9620. const secondsList = computed(() => {
  9621. return getSecondsList(hours.value, minutes.value, props.role);
  9622. });
  9623. const listMap = computed(() => ({
  9624. hours: hoursList,
  9625. minutes: minutesList,
  9626. seconds: secondsList
  9627. }));
  9628. const arrowHourList = computed(() => {
  9629. const hour = hours.value;
  9630. return [
  9631. hour > 0 ? hour - 1 : void 0,
  9632. hour,
  9633. hour < 23 ? hour + 1 : void 0
  9634. ];
  9635. });
  9636. const arrowMinuteList = computed(() => {
  9637. const minute = minutes.value;
  9638. return [
  9639. minute > 0 ? minute - 1 : void 0,
  9640. minute,
  9641. minute < 59 ? minute + 1 : void 0
  9642. ];
  9643. });
  9644. const arrowSecondList = computed(() => {
  9645. const second = seconds.value;
  9646. return [
  9647. second > 0 ? second - 1 : void 0,
  9648. second,
  9649. second < 59 ? second + 1 : void 0
  9650. ];
  9651. });
  9652. const arrowListMap = computed(() => ({
  9653. hours: arrowHourList,
  9654. minutes: arrowMinuteList,
  9655. seconds: arrowSecondList
  9656. }));
  9657. const getAmPmFlag = (hour) => {
  9658. const shouldShowAmPm = !!props.amPmMode;
  9659. if (!shouldShowAmPm)
  9660. return "";
  9661. const isCapital = props.amPmMode === "A";
  9662. let content2 = hour < 12 ? " am" : " pm";
  9663. if (isCapital)
  9664. content2 = content2.toUpperCase();
  9665. return content2;
  9666. };
  9667. const emitSelectRange = (type4) => {
  9668. if (type4 === "hours") {
  9669. ctx.emit("select-range", 0, 2);
  9670. } else if (type4 === "minutes") {
  9671. ctx.emit("select-range", 3, 5);
  9672. } else if (type4 === "seconds") {
  9673. ctx.emit("select-range", 6, 8);
  9674. }
  9675. currentScrollbar.value = type4;
  9676. };
  9677. const adjustCurrentSpinner = (type4) => {
  9678. adjustSpinner(type4, timePartsMap.value[type4].value);
  9679. };
  9680. const adjustSpinners = () => {
  9681. adjustCurrentSpinner("hours");
  9682. adjustCurrentSpinner("minutes");
  9683. adjustCurrentSpinner("seconds");
  9684. };
  9685. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  9686. const adjustSpinner = (type4, value) => {
  9687. if (props.arrowControl)
  9688. return;
  9689. const el = listRefsMap[type4];
  9690. if (el && el.$el) {
  9691. getScrollbarElement(el.$el).scrollTop = Math.max(0, value * typeItemHeight(type4));
  9692. }
  9693. };
  9694. const typeItemHeight = (type4) => {
  9695. const el = listRefsMap[type4];
  9696. return el.$el.querySelector("li").offsetHeight;
  9697. };
  9698. const onIncreaseClick = () => {
  9699. scrollDown(1);
  9700. };
  9701. const onDecreaseClick = () => {
  9702. scrollDown(-1);
  9703. };
  9704. const scrollDown = (step) => {
  9705. if (!currentScrollbar.value) {
  9706. emitSelectRange("hours");
  9707. }
  9708. const label = currentScrollbar.value;
  9709. let now2 = timePartsMap.value[label].value;
  9710. const total = currentScrollbar.value === "hours" ? 24 : 60;
  9711. now2 = (now2 + step + total) % total;
  9712. modifyDateField(label, now2);
  9713. adjustSpinner(label, now2);
  9714. nextTick(() => emitSelectRange(currentScrollbar.value));
  9715. };
  9716. const modifyDateField = (type4, value) => {
  9717. const list = listMap.value[type4].value;
  9718. const isDisabled = list[value];
  9719. if (isDisabled)
  9720. return;
  9721. switch (type4) {
  9722. case "hours":
  9723. ctx.emit("change", props.spinnerDate.hour(value).minute(minutes.value).second(seconds.value));
  9724. break;
  9725. case "minutes":
  9726. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(value).second(seconds.value));
  9727. break;
  9728. case "seconds":
  9729. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(minutes.value).second(value));
  9730. break;
  9731. }
  9732. };
  9733. const handleClick = (type4, { value, disabled }) => {
  9734. if (!disabled) {
  9735. modifyDateField(type4, value);
  9736. emitSelectRange(type4);
  9737. adjustSpinner(type4, value);
  9738. }
  9739. };
  9740. const handleScroll = (type4) => {
  9741. isScrolling = true;
  9742. debouncedResetScroll(type4);
  9743. 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);
  9744. modifyDateField(type4, value);
  9745. };
  9746. const scrollBarHeight = (type4) => {
  9747. return listRefsMap[type4].$el.offsetHeight;
  9748. };
  9749. const bindScrollEvent = () => {
  9750. const bindFunction = (type4) => {
  9751. if (listRefsMap[type4] && listRefsMap[type4].$el) {
  9752. getScrollbarElement(listRefsMap[type4].$el).onscroll = () => {
  9753. handleScroll(type4);
  9754. };
  9755. }
  9756. };
  9757. bindFunction("hours");
  9758. bindFunction("minutes");
  9759. bindFunction("seconds");
  9760. };
  9761. onMounted(() => {
  9762. nextTick(() => {
  9763. !props.arrowControl && bindScrollEvent();
  9764. adjustSpinners();
  9765. if (props.role === "start")
  9766. emitSelectRange("hours");
  9767. });
  9768. });
  9769. const setRef = (scrollbar, type4) => {
  9770. listRefsMap[type4] = scrollbar;
  9771. };
  9772. ctx.emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  9773. ctx.emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  9774. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  9775. watch(() => props.spinnerDate, () => {
  9776. if (isScrolling)
  9777. return;
  9778. adjustSpinners();
  9779. });
  9780. return {
  9781. ns,
  9782. setRef,
  9783. spinnerItems,
  9784. currentScrollbar,
  9785. hours,
  9786. minutes,
  9787. seconds,
  9788. hoursList,
  9789. minutesList,
  9790. arrowHourList,
  9791. arrowMinuteList,
  9792. arrowSecondList,
  9793. getAmPmFlag,
  9794. emitSelectRange,
  9795. adjustCurrentSpinner,
  9796. typeItemHeight,
  9797. listHoursRef,
  9798. listMinutesRef,
  9799. listSecondsRef,
  9800. onIncreaseClick,
  9801. onDecreaseClick,
  9802. handleClick,
  9803. secondsList,
  9804. timePartsMap,
  9805. arrowListMap,
  9806. listMap
  9807. };
  9808. }
  9809. });
  9810. const _hoisted_1$y = ["onClick"];
  9811. const _hoisted_2$q = ["onMouseenter"];
  9812. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  9813. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  9814. const _component_arrow_up = resolveComponent("arrow-up");
  9815. const _component_el_icon = resolveComponent("el-icon");
  9816. const _component_arrow_down = resolveComponent("arrow-down");
  9817. const _directive_repeat_click = resolveDirective("repeat-click");
  9818. return openBlock(), createElementBlock("div", {
  9819. class: normalizeClass([_ctx.ns.b("spinner"), { "has-seconds": _ctx.showSeconds }])
  9820. }, [
  9821. !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.spinnerItems, (item) => {
  9822. return openBlock(), createBlock(_component_el_scrollbar, {
  9823. key: item,
  9824. ref_for: true,
  9825. ref: (scollbar) => _ctx.setRef(scollbar, item),
  9826. class: normalizeClass(_ctx.ns.be("spinner", "wrapper")),
  9827. "wrap-style": "max-height: inherit;",
  9828. "view-class": _ctx.ns.be("spinner", "list"),
  9829. noresize: "",
  9830. tag: "ul",
  9831. onMouseenter: ($event) => _ctx.emitSelectRange(item),
  9832. onMousemove: ($event) => _ctx.adjustCurrentSpinner(item)
  9833. }, {
  9834. default: withCtx(() => [
  9835. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listMap[item].value, (disabled, key) => {
  9836. return openBlock(), createElementBlock("li", {
  9837. key,
  9838. class: normalizeClass([
  9839. _ctx.ns.be("spinner", "item"),
  9840. _ctx.ns.is("active", key === _ctx.timePartsMap[item].value),
  9841. _ctx.ns.is("disabled", disabled)
  9842. ]),
  9843. onClick: ($event) => _ctx.handleClick(item, { value: key, disabled })
  9844. }, [
  9845. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9846. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(key)), 1)
  9847. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  9848. createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
  9849. ], 2112))
  9850. ], 10, _hoisted_1$y);
  9851. }), 128))
  9852. ]),
  9853. _: 2
  9854. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  9855. }), 128)) : createCommentVNode("v-if", true),
  9856. _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.spinnerItems, (item) => {
  9857. return openBlock(), createElementBlock("div", {
  9858. key: item,
  9859. class: normalizeClass([_ctx.ns.be("spinner", "wrapper"), _ctx.ns.is("arrow")]),
  9860. onMouseenter: ($event) => _ctx.emitSelectRange(item)
  9861. }, [
  9862. withDirectives((openBlock(), createBlock(_component_el_icon, {
  9863. class: normalizeClass(["arrow-up", _ctx.ns.be("spinner", "arrow")])
  9864. }, {
  9865. default: withCtx(() => [
  9866. createVNode(_component_arrow_up)
  9867. ]),
  9868. _: 1
  9869. }, 8, ["class"])), [
  9870. [_directive_repeat_click, _ctx.onDecreaseClick]
  9871. ]),
  9872. withDirectives((openBlock(), createBlock(_component_el_icon, {
  9873. class: normalizeClass(["arrow-down", _ctx.ns.be("spinner", "arrow")])
  9874. }, {
  9875. default: withCtx(() => [
  9876. createVNode(_component_arrow_down)
  9877. ]),
  9878. _: 1
  9879. }, 8, ["class"])), [
  9880. [_directive_repeat_click, _ctx.onIncreaseClick]
  9881. ]),
  9882. createElementVNode("ul", {
  9883. class: normalizeClass(_ctx.ns.be("spinner", "list"))
  9884. }, [
  9885. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.arrowListMap[item].value, (time, key) => {
  9886. return openBlock(), createElementBlock("li", {
  9887. key,
  9888. class: normalizeClass([
  9889. _ctx.ns.be("spinner", "item"),
  9890. _ctx.ns.is("active", time === _ctx.timePartsMap[item].value),
  9891. _ctx.ns.is("disabled", _ctx.listMap[item].value[time])
  9892. ])
  9893. }, [
  9894. typeof time === "number" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9895. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9896. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(time)), 1)
  9897. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  9898. createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
  9899. ], 2112))
  9900. ], 2112)) : createCommentVNode("v-if", true)
  9901. ], 2);
  9902. }), 128))
  9903. ], 2)
  9904. ], 42, _hoisted_2$q);
  9905. }), 128)) : createCommentVNode("v-if", true)
  9906. ], 2);
  9907. }
  9908. 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"]]);
  9909. const _sfc_main$Q = defineComponent({
  9910. components: {
  9911. TimeSpinner
  9912. },
  9913. props: {
  9914. visible: Boolean,
  9915. actualVisible: {
  9916. type: Boolean,
  9917. default: void 0
  9918. },
  9919. datetimeRole: {
  9920. type: String
  9921. },
  9922. parsedValue: {
  9923. type: [Object, String]
  9924. },
  9925. format: {
  9926. type: String,
  9927. default: ""
  9928. }
  9929. },
  9930. emits: ["pick", "select-range", "set-picker-option"],
  9931. setup(props, ctx) {
  9932. const ns = useNamespace("time");
  9933. const { t, lang } = useLocale();
  9934. const selectionRange = ref([0, 2]);
  9935. const oldValue = useOldValue(props);
  9936. const transitionName = computed(() => {
  9937. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  9938. });
  9939. const showSeconds = computed(() => {
  9940. return props.format.includes("ss");
  9941. });
  9942. const amPmMode = computed(() => {
  9943. if (props.format.includes("A"))
  9944. return "A";
  9945. if (props.format.includes("a"))
  9946. return "a";
  9947. return "";
  9948. });
  9949. const isValidValue = (_date) => {
  9950. const parsedDate = dayjs(_date).locale(lang.value);
  9951. const result = getRangeAvailableTime(parsedDate);
  9952. return parsedDate.isSame(result);
  9953. };
  9954. const handleCancel = () => {
  9955. ctx.emit("pick", oldValue.value, false);
  9956. };
  9957. const handleConfirm = (visible = false, first = false) => {
  9958. if (first)
  9959. return;
  9960. ctx.emit("pick", props.parsedValue, visible);
  9961. };
  9962. const handleChange2 = (_date) => {
  9963. if (!props.visible) {
  9964. return;
  9965. }
  9966. const result = getRangeAvailableTime(_date).millisecond(0);
  9967. ctx.emit("pick", result, true);
  9968. };
  9969. const setSelectionRange = (start2, end2) => {
  9970. ctx.emit("select-range", start2, end2);
  9971. selectionRange.value = [start2, end2];
  9972. };
  9973. const changeSelectionRange = (step) => {
  9974. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  9975. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  9976. const index = list.indexOf(selectionRange.value[0]);
  9977. const next = (index + step + list.length) % list.length;
  9978. timePickerOptions["start_emitSelectRange"](mapping[next]);
  9979. };
  9980. const handleKeydown = (event) => {
  9981. const code = event.code;
  9982. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  9983. const step = code === EVENT_CODE.left ? -1 : 1;
  9984. changeSelectionRange(step);
  9985. event.preventDefault();
  9986. return;
  9987. }
  9988. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  9989. const step = code === EVENT_CODE.up ? -1 : 1;
  9990. timePickerOptions["start_scrollDown"](step);
  9991. event.preventDefault();
  9992. return;
  9993. }
  9994. };
  9995. const getRangeAvailableTime = (date4) => {
  9996. const availableMap = {
  9997. hour: getAvailableHours,
  9998. minute: getAvailableMinutes,
  9999. second: getAvailableSeconds
  10000. };
  10001. let result = date4;
  10002. ["hour", "minute", "second"].forEach((_2) => {
  10003. if (availableMap[_2]) {
  10004. let availableArr;
  10005. const method4 = availableMap[_2];
  10006. if (_2 === "minute") {
  10007. availableArr = method4(result.hour(), props.datetimeRole);
  10008. } else if (_2 === "second") {
  10009. availableArr = method4(result.hour(), result.minute(), props.datetimeRole);
  10010. } else {
  10011. availableArr = method4(props.datetimeRole);
  10012. }
  10013. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10014. result = result[_2](availableArr[0]);
  10015. }
  10016. }
  10017. });
  10018. return result;
  10019. };
  10020. const parseUserInput = (value) => {
  10021. if (!value)
  10022. return null;
  10023. return dayjs(value, props.format).locale(lang.value);
  10024. };
  10025. const formatToString = (value) => {
  10026. if (!value)
  10027. return null;
  10028. return value.format(props.format);
  10029. };
  10030. const getDefaultValue = () => {
  10031. return dayjs(defaultValue).locale(lang.value);
  10032. };
  10033. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10034. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10035. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10036. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10037. ctx.emit("set-picker-option", [
  10038. "getRangeAvailableTime",
  10039. getRangeAvailableTime
  10040. ]);
  10041. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10042. const timePickerOptions = {};
  10043. const onSetOption = (e) => {
  10044. timePickerOptions[e[0]] = e[1];
  10045. };
  10046. const pickerBase = inject("EP_PICKER_BASE");
  10047. const {
  10048. arrowControl,
  10049. disabledHours,
  10050. disabledMinutes,
  10051. disabledSeconds,
  10052. defaultValue
  10053. } = pickerBase.props;
  10054. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours, disabledMinutes, disabledSeconds);
  10055. return {
  10056. ns,
  10057. transitionName,
  10058. arrowControl,
  10059. onSetOption,
  10060. t,
  10061. handleConfirm,
  10062. handleChange: handleChange2,
  10063. setSelectionRange,
  10064. amPmMode,
  10065. showSeconds,
  10066. handleCancel,
  10067. disabledHours,
  10068. disabledMinutes,
  10069. disabledSeconds
  10070. };
  10071. }
  10072. });
  10073. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  10074. const _component_time_spinner = resolveComponent("time-spinner");
  10075. return openBlock(), createBlock(Transition, { name: _ctx.transitionName }, {
  10076. default: withCtx(() => [
  10077. _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  10078. key: 0,
  10079. class: normalizeClass(_ctx.ns.b("panel"))
  10080. }, [
  10081. createElementVNode("div", {
  10082. class: normalizeClass([_ctx.ns.be("panel", "content"), { "has-seconds": _ctx.showSeconds }])
  10083. }, [
  10084. createVNode(_component_time_spinner, {
  10085. ref: "spinner",
  10086. role: _ctx.datetimeRole || "start",
  10087. "arrow-control": _ctx.arrowControl,
  10088. "show-seconds": _ctx.showSeconds,
  10089. "am-pm-mode": _ctx.amPmMode,
  10090. "spinner-date": _ctx.parsedValue,
  10091. "disabled-hours": _ctx.disabledHours,
  10092. "disabled-minutes": _ctx.disabledMinutes,
  10093. "disabled-seconds": _ctx.disabledSeconds,
  10094. onChange: _ctx.handleChange,
  10095. onSetOption: _ctx.onSetOption,
  10096. onSelectRange: _ctx.setSelectionRange
  10097. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10098. ], 2),
  10099. createElementVNode("div", {
  10100. class: normalizeClass(_ctx.ns.be("panel", "footer"))
  10101. }, [
  10102. createElementVNode("button", {
  10103. type: "button",
  10104. class: normalizeClass([_ctx.ns.be("panel", "btn"), "cancel"]),
  10105. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleCancel && _ctx.handleCancel(...args))
  10106. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10107. createElementVNode("button", {
  10108. type: "button",
  10109. class: normalizeClass([_ctx.ns.be("panel", "btn"), "confirm"]),
  10110. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10111. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 3)
  10112. ], 2)
  10113. ], 2)) : createCommentVNode("v-if", true)
  10114. ]),
  10115. _: 1
  10116. }, 8, ["name"]);
  10117. }
  10118. 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"]]);
  10119. const makeSelectRange = (start2, end2) => {
  10120. const result = [];
  10121. for (let i = start2; i <= end2; i++) {
  10122. result.push(i);
  10123. }
  10124. return result;
  10125. };
  10126. const _sfc_main$P = defineComponent({
  10127. components: { TimeSpinner },
  10128. props: {
  10129. visible: Boolean,
  10130. actualVisible: Boolean,
  10131. parsedValue: {
  10132. type: [Array]
  10133. },
  10134. format: {
  10135. type: String,
  10136. default: ""
  10137. }
  10138. },
  10139. emits: ["pick", "select-range", "set-picker-option"],
  10140. setup(props, ctx) {
  10141. const { t, lang } = useLocale();
  10142. const nsTime = useNamespace("time");
  10143. const nsPicker = useNamespace("picker");
  10144. const minDate = computed(() => props.parsedValue[0]);
  10145. const maxDate = computed(() => props.parsedValue[1]);
  10146. const oldValue = useOldValue(props);
  10147. const handleCancel = () => {
  10148. ctx.emit("pick", oldValue.value, false);
  10149. };
  10150. const showSeconds = computed(() => {
  10151. return props.format.includes("ss");
  10152. });
  10153. const amPmMode = computed(() => {
  10154. if (props.format.includes("A"))
  10155. return "A";
  10156. if (props.format.includes("a"))
  10157. return "a";
  10158. return "";
  10159. });
  10160. const minSelectableRange = ref([]);
  10161. const maxSelectableRange = ref([]);
  10162. const handleConfirm = (visible = false) => {
  10163. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  10164. };
  10165. const handleMinChange = (date4) => {
  10166. handleChange2(date4.millisecond(0), maxDate.value);
  10167. };
  10168. const handleMaxChange = (date4) => {
  10169. handleChange2(minDate.value, date4.millisecond(0));
  10170. };
  10171. const isValidValue = (_date) => {
  10172. const parsedDate = _date.map((_2) => dayjs(_2).locale(lang.value));
  10173. const result = getRangeAvailableTime(parsedDate);
  10174. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  10175. };
  10176. const handleChange2 = (_minDate, _maxDate) => {
  10177. ctx.emit("pick", [_minDate, _maxDate], true);
  10178. };
  10179. const btnConfirmDisabled = computed(() => {
  10180. return minDate.value > maxDate.value;
  10181. });
  10182. const selectionRange = ref([0, 2]);
  10183. const setMinSelectionRange = (start2, end2) => {
  10184. ctx.emit("select-range", start2, end2, "min");
  10185. selectionRange.value = [start2, end2];
  10186. };
  10187. const offset2 = computed(() => showSeconds.value ? 11 : 8);
  10188. const setMaxSelectionRange = (start2, end2) => {
  10189. ctx.emit("select-range", start2, end2, "max");
  10190. selectionRange.value = [start2 + offset2.value, end2 + offset2.value];
  10191. };
  10192. const changeSelectionRange = (step) => {
  10193. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  10194. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  10195. const index = list.indexOf(selectionRange.value[0]);
  10196. const next = (index + step + list.length) % list.length;
  10197. const half = list.length / 2;
  10198. if (next < half) {
  10199. timePickerOptions["start_emitSelectRange"](mapping[next]);
  10200. } else {
  10201. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  10202. }
  10203. };
  10204. const handleKeydown = (event) => {
  10205. const code = event.code;
  10206. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  10207. const step = code === EVENT_CODE.left ? -1 : 1;
  10208. changeSelectionRange(step);
  10209. event.preventDefault();
  10210. return;
  10211. }
  10212. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  10213. const step = code === EVENT_CODE.up ? -1 : 1;
  10214. const role = selectionRange.value[0] < offset2.value ? "start" : "end";
  10215. timePickerOptions[`${role}_scrollDown`](step);
  10216. event.preventDefault();
  10217. return;
  10218. }
  10219. };
  10220. const disabledHours_ = (role, compare) => {
  10221. const defaultDisable = disabledHours ? disabledHours(role) : [];
  10222. const isStart = role === "start";
  10223. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10224. const compareHour = compareDate.hour();
  10225. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  10226. return union$1(defaultDisable, nextDisable);
  10227. };
  10228. const disabledMinutes_ = (hour, role, compare) => {
  10229. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  10230. const isStart = role === "start";
  10231. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10232. const compareHour = compareDate.hour();
  10233. if (hour !== compareHour) {
  10234. return defaultDisable;
  10235. }
  10236. const compareMinute = compareDate.minute();
  10237. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  10238. return union$1(defaultDisable, nextDisable);
  10239. };
  10240. const disabledSeconds_ = (hour, minute, role, compare) => {
  10241. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  10242. const isStart = role === "start";
  10243. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10244. const compareHour = compareDate.hour();
  10245. const compareMinute = compareDate.minute();
  10246. if (hour !== compareHour || minute !== compareMinute) {
  10247. return defaultDisable;
  10248. }
  10249. const compareSecond = compareDate.second();
  10250. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  10251. return union$1(defaultDisable, nextDisable);
  10252. };
  10253. const getRangeAvailableTime = (dates) => {
  10254. return dates.map((_2, index) => getRangeAvailableTimeEach(dates[0], dates[1], index === 0 ? "start" : "end"));
  10255. };
  10256. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours_, disabledMinutes_, disabledSeconds_);
  10257. const getRangeAvailableTimeEach = (startDate, endDate, role) => {
  10258. const availableMap = {
  10259. hour: getAvailableHours,
  10260. minute: getAvailableMinutes,
  10261. second: getAvailableSeconds
  10262. };
  10263. const isStart = role === "start";
  10264. let result = isStart ? startDate : endDate;
  10265. const compareDate = isStart ? endDate : startDate;
  10266. ["hour", "minute", "second"].forEach((_2) => {
  10267. if (availableMap[_2]) {
  10268. let availableArr;
  10269. const method4 = availableMap[_2];
  10270. if (_2 === "minute") {
  10271. availableArr = method4(result.hour(), role, compareDate);
  10272. } else if (_2 === "second") {
  10273. availableArr = method4(result.hour(), result.minute(), role, compareDate);
  10274. } else {
  10275. availableArr = method4(role, compareDate);
  10276. }
  10277. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10278. const pos = isStart ? 0 : availableArr.length - 1;
  10279. result = result[_2](availableArr[pos]);
  10280. }
  10281. }
  10282. });
  10283. return result;
  10284. };
  10285. const parseUserInput = (value) => {
  10286. if (!value)
  10287. return null;
  10288. if (Array.isArray(value)) {
  10289. return value.map((_2) => dayjs(_2, props.format).locale(lang.value));
  10290. }
  10291. return dayjs(value, props.format).locale(lang.value);
  10292. };
  10293. const formatToString = (value) => {
  10294. if (!value)
  10295. return null;
  10296. if (Array.isArray(value)) {
  10297. return value.map((_2) => _2.format(props.format));
  10298. }
  10299. return value.format(props.format);
  10300. };
  10301. const getDefaultValue = () => {
  10302. if (Array.isArray(defaultValue)) {
  10303. return defaultValue.map((_2) => dayjs(_2).locale(lang.value));
  10304. }
  10305. const defaultDay = dayjs(defaultValue).locale(lang.value);
  10306. return [defaultDay, defaultDay.add(60, "m")];
  10307. };
  10308. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10309. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10310. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10311. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10312. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10313. ctx.emit("set-picker-option", [
  10314. "getRangeAvailableTime",
  10315. getRangeAvailableTime
  10316. ]);
  10317. const timePickerOptions = {};
  10318. const onSetOption = (e) => {
  10319. timePickerOptions[e[0]] = e[1];
  10320. };
  10321. const pickerBase = inject("EP_PICKER_BASE");
  10322. const {
  10323. arrowControl,
  10324. disabledHours,
  10325. disabledMinutes,
  10326. disabledSeconds,
  10327. defaultValue
  10328. } = pickerBase.props;
  10329. return {
  10330. nsTime,
  10331. nsPicker,
  10332. arrowControl,
  10333. onSetOption,
  10334. setMaxSelectionRange,
  10335. setMinSelectionRange,
  10336. btnConfirmDisabled,
  10337. handleCancel,
  10338. handleConfirm,
  10339. t,
  10340. showSeconds,
  10341. minDate,
  10342. maxDate,
  10343. amPmMode,
  10344. handleMinChange,
  10345. handleMaxChange,
  10346. minSelectableRange,
  10347. maxSelectableRange,
  10348. disabledHours_,
  10349. disabledMinutes_,
  10350. disabledSeconds_
  10351. };
  10352. }
  10353. });
  10354. const _hoisted_1$x = ["disabled"];
  10355. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  10356. const _component_time_spinner = resolveComponent("time-spinner");
  10357. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  10358. key: 0,
  10359. class: normalizeClass([_ctx.nsTime.b("range-picker"), _ctx.nsPicker.b("panel")])
  10360. }, [
  10361. createElementVNode("div", {
  10362. class: normalizeClass(_ctx.nsTime.be("range-picker", "content"))
  10363. }, [
  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.startTime")), 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: "minSpinner",
  10380. role: "start",
  10381. "show-seconds": _ctx.showSeconds,
  10382. "am-pm-mode": _ctx.amPmMode,
  10383. "arrow-control": _ctx.arrowControl,
  10384. "spinner-date": _ctx.minDate,
  10385. "disabled-hours": _ctx.disabledHours_,
  10386. "disabled-minutes": _ctx.disabledMinutes_,
  10387. "disabled-seconds": _ctx.disabledSeconds_,
  10388. onChange: _ctx.handleMinChange,
  10389. onSetOption: _ctx.onSetOption,
  10390. onSelectRange: _ctx.setMinSelectionRange
  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. createElementVNode("div", {
  10395. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10396. }, [
  10397. createElementVNode("div", {
  10398. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10399. }, toDisplayString(_ctx.t("el.datepicker.endTime")), 3),
  10400. createElementVNode("div", {
  10401. class: normalizeClass([
  10402. _ctx.nsTime.be("range-picker", "body"),
  10403. _ctx.nsTime.be("panel", "content"),
  10404. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10405. { "has-seconds": _ctx.showSeconds }
  10406. ])
  10407. }, [
  10408. createVNode(_component_time_spinner, {
  10409. ref: "maxSpinner",
  10410. role: "end",
  10411. "show-seconds": _ctx.showSeconds,
  10412. "am-pm-mode": _ctx.amPmMode,
  10413. "arrow-control": _ctx.arrowControl,
  10414. "spinner-date": _ctx.maxDate,
  10415. "disabled-hours": _ctx.disabledHours_,
  10416. "disabled-minutes": _ctx.disabledMinutes_,
  10417. "disabled-seconds": _ctx.disabledSeconds_,
  10418. onChange: _ctx.handleMaxChange,
  10419. onSetOption: _ctx.onSetOption,
  10420. onSelectRange: _ctx.setMaxSelectionRange
  10421. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10422. ], 2)
  10423. ], 2)
  10424. ], 2),
  10425. createElementVNode("div", {
  10426. class: normalizeClass(_ctx.nsTime.be("panel", "footer"))
  10427. }, [
  10428. createElementVNode("button", {
  10429. type: "button",
  10430. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "cancel"]),
  10431. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleCancel())
  10432. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10433. createElementVNode("button", {
  10434. type: "button",
  10435. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "confirm"]),
  10436. disabled: _ctx.btnConfirmDisabled,
  10437. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10438. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 11, _hoisted_1$x)
  10439. ], 2)
  10440. ], 2)) : createCommentVNode("v-if", true);
  10441. }
  10442. 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"]]);
  10443. dayjs.extend(customParseFormat);
  10444. var TimePicker = defineComponent({
  10445. name: "ElTimePicker",
  10446. install: null,
  10447. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  10448. isRange: {
  10449. type: Boolean,
  10450. default: false
  10451. }
  10452. }),
  10453. emits: ["update:modelValue"],
  10454. setup(props, ctx) {
  10455. const commonPicker = ref(null);
  10456. const type4 = props.isRange ? "timerange" : "time";
  10457. const panel = props.isRange ? TimeRangePanel : TimePickPanel;
  10458. const refProps = __spreadProps(__spreadValues({}, props), {
  10459. focus: () => {
  10460. var _a2;
  10461. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleFocus();
  10462. },
  10463. blur: () => {
  10464. var _a2;
  10465. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleBlur();
  10466. }
  10467. });
  10468. provide("ElPopperOptions", props.popperOptions);
  10469. ctx.expose(refProps);
  10470. return () => {
  10471. var _a2;
  10472. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_TIME;
  10473. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  10474. format: format2,
  10475. type: type4,
  10476. ref: commonPicker,
  10477. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  10478. }), {
  10479. default: (scopedProps) => h$1(panel, scopedProps)
  10480. });
  10481. };
  10482. }
  10483. });
  10484. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  10485. const extractDateFormat = (format2) => {
  10486. return format2.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  10487. };
  10488. const extractTimeFormat = (format2) => {
  10489. return format2.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  10490. };
  10491. const _TimePicker = TimePicker;
  10492. _TimePicker.install = (app) => {
  10493. app.component(_TimePicker.name, _TimePicker);
  10494. };
  10495. const ElTimePicker = _TimePicker;
  10496. const useCheckboxProps = {
  10497. modelValue: {
  10498. type: [Boolean, Number, String],
  10499. default: () => void 0
  10500. },
  10501. label: {
  10502. type: [String, Boolean, Number, Object]
  10503. },
  10504. indeterminate: Boolean,
  10505. disabled: Boolean,
  10506. checked: Boolean,
  10507. name: {
  10508. type: String,
  10509. default: void 0
  10510. },
  10511. trueLabel: {
  10512. type: [String, Number],
  10513. default: void 0
  10514. },
  10515. falseLabel: {
  10516. type: [String, Number],
  10517. default: void 0
  10518. },
  10519. tabindex: [String, Number],
  10520. size: String
  10521. };
  10522. const useCheckboxGroup = () => {
  10523. const elForm2 = inject(formContextKey, {});
  10524. const elFormItem2 = inject(formItemContextKey, {});
  10525. const checkboxGroup = inject("CheckboxGroup", {});
  10526. const isGroup = computed(() => checkboxGroup && (checkboxGroup == null ? void 0 : checkboxGroup.name) === "ElCheckboxGroup");
  10527. const elFormItemSize = computed(() => {
  10528. return elFormItem2.size;
  10529. });
  10530. return {
  10531. isGroup,
  10532. checkboxGroup,
  10533. elForm: elForm2,
  10534. elFormItemSize,
  10535. elFormItem: elFormItem2
  10536. };
  10537. };
  10538. const useModel = (props) => {
  10539. const selfModel = ref(false);
  10540. const { emit } = getCurrentInstance();
  10541. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10542. const isLimitExceeded = ref(false);
  10543. const model = computed({
  10544. get() {
  10545. var _a2, _b2;
  10546. return isGroup.value ? (_a2 = checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b2 = props.modelValue) != null ? _b2 : selfModel.value;
  10547. },
  10548. set(val) {
  10549. var _a2;
  10550. if (isGroup.value && Array.isArray(val)) {
  10551. isLimitExceeded.value = checkboxGroup.max !== void 0 && val.length > checkboxGroup.max.value;
  10552. isLimitExceeded.value === false && ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _a2.call(checkboxGroup, val));
  10553. } else {
  10554. emit(UPDATE_MODEL_EVENT, val);
  10555. selfModel.value = val;
  10556. }
  10557. }
  10558. });
  10559. return {
  10560. model,
  10561. isLimitExceeded
  10562. };
  10563. };
  10564. const useCheckboxStatus = (props, { model }) => {
  10565. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10566. const focus = ref(false);
  10567. const size = useSize(checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize, { prop: true });
  10568. const isChecked = computed(() => {
  10569. const value = model.value;
  10570. if (toTypeString(value) === "[object Boolean]") {
  10571. return value;
  10572. } else if (Array.isArray(value)) {
  10573. return value.includes(props.label);
  10574. } else if (value !== null && value !== void 0) {
  10575. return value === props.trueLabel;
  10576. } else {
  10577. return !!value;
  10578. }
  10579. });
  10580. const checkboxSize = useSize(computed(() => {
  10581. var _a2;
  10582. return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize) == null ? void 0 : _a2.value : void 0;
  10583. }));
  10584. return {
  10585. isChecked,
  10586. focus,
  10587. size,
  10588. checkboxSize
  10589. };
  10590. };
  10591. const useDisabled = (props, {
  10592. model,
  10593. isChecked
  10594. }) => {
  10595. const { elForm: elForm2, isGroup, checkboxGroup } = useCheckboxGroup();
  10596. const isLimitDisabled = computed(() => {
  10597. var _a2, _b2;
  10598. const max2 = (_a2 = checkboxGroup.max) == null ? void 0 : _a2.value;
  10599. const min2 = (_b2 = checkboxGroup.min) == null ? void 0 : _b2.value;
  10600. return !!(max2 || min2) && model.value.length >= max2 && !isChecked.value || model.value.length <= min2 && isChecked.value;
  10601. });
  10602. const isDisabled = computed(() => {
  10603. var _a2, _b2;
  10604. const disabled = props.disabled || elForm2.disabled;
  10605. return (_b2 = isGroup.value ? ((_a2 = checkboxGroup.disabled) == null ? void 0 : _a2.value) || disabled || isLimitDisabled.value : props.disabled || elForm2.disabled) != null ? _b2 : false;
  10606. });
  10607. return {
  10608. isDisabled,
  10609. isLimitDisabled
  10610. };
  10611. };
  10612. const setStoreValue = (props, { model }) => {
  10613. function addToStore() {
  10614. if (Array.isArray(model.value) && !model.value.includes(props.label)) {
  10615. model.value.push(props.label);
  10616. } else {
  10617. model.value = props.trueLabel || true;
  10618. }
  10619. }
  10620. props.checked && addToStore();
  10621. };
  10622. const useEvent$1 = (props, { isLimitExceeded }) => {
  10623. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  10624. const { emit } = getCurrentInstance();
  10625. function handleChange2(e) {
  10626. var _a2, _b2;
  10627. if (isLimitExceeded.value)
  10628. return;
  10629. const target = e.target;
  10630. const value = target.checked ? (_a2 = props.trueLabel) != null ? _a2 : true : (_b2 = props.falseLabel) != null ? _b2 : false;
  10631. emit("change", value, e);
  10632. }
  10633. watch(() => props.modelValue, () => {
  10634. var _a2;
  10635. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  10636. });
  10637. return {
  10638. handleChange: handleChange2
  10639. };
  10640. };
  10641. const useCheckbox = (props) => {
  10642. const { model, isLimitExceeded } = useModel(props);
  10643. const { focus, size, isChecked, checkboxSize } = useCheckboxStatus(props, {
  10644. model
  10645. });
  10646. const { isDisabled } = useDisabled(props, { model, isChecked });
  10647. const { handleChange: handleChange2 } = useEvent$1(props, { isLimitExceeded });
  10648. setStoreValue(props, { model });
  10649. return {
  10650. isChecked,
  10651. isDisabled,
  10652. checkboxSize,
  10653. model,
  10654. handleChange: handleChange2,
  10655. focus,
  10656. size
  10657. };
  10658. };
  10659. const _sfc_main$O = defineComponent({
  10660. name: "ElCheckbox",
  10661. props: {
  10662. modelValue: {
  10663. type: [Number, String, Boolean],
  10664. default: () => void 0
  10665. },
  10666. label: {
  10667. type: [String, Boolean, Number, Object]
  10668. },
  10669. indeterminate: Boolean,
  10670. disabled: Boolean,
  10671. checked: Boolean,
  10672. name: {
  10673. type: String,
  10674. default: void 0
  10675. },
  10676. trueLabel: {
  10677. type: [String, Number],
  10678. default: void 0
  10679. },
  10680. falseLabel: {
  10681. type: [String, Number],
  10682. default: void 0
  10683. },
  10684. id: {
  10685. type: String,
  10686. default: void 0
  10687. },
  10688. controls: {
  10689. type: String,
  10690. default: void 0
  10691. },
  10692. border: Boolean,
  10693. size: {
  10694. type: String,
  10695. validator: isValidComponentSize
  10696. },
  10697. tabindex: [String, Number]
  10698. },
  10699. emits: [UPDATE_MODEL_EVENT, "change"],
  10700. setup(props) {
  10701. const ns = useNamespace("checkbox");
  10702. return __spreadValues({
  10703. ns
  10704. }, useCheckbox(props));
  10705. }
  10706. });
  10707. const _hoisted_1$w = ["id", "aria-controls"];
  10708. const _hoisted_2$p = ["tabindex", "role", "aria-checked"];
  10709. const _hoisted_3$g = ["aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
  10710. const _hoisted_4$d = ["aria-hidden", "disabled", "value", "name", "tabindex"];
  10711. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  10712. return openBlock(), createElementBlock("label", {
  10713. id: _ctx.id,
  10714. class: normalizeClass([
  10715. _ctx.ns.b(),
  10716. _ctx.ns.m(_ctx.checkboxSize),
  10717. _ctx.ns.is("disabled", _ctx.isDisabled),
  10718. _ctx.ns.is("bordered", _ctx.border),
  10719. _ctx.ns.is("checked", _ctx.isChecked)
  10720. ]),
  10721. "aria-controls": _ctx.indeterminate ? _ctx.controls : null
  10722. }, [
  10723. createElementVNode("span", {
  10724. class: normalizeClass([
  10725. _ctx.ns.e("input"),
  10726. _ctx.ns.is("disabled", _ctx.isDisabled),
  10727. _ctx.ns.is("checked", _ctx.isChecked),
  10728. _ctx.ns.is("indeterminate", _ctx.indeterminate),
  10729. _ctx.ns.is("focus", _ctx.focus)
  10730. ]),
  10731. tabindex: _ctx.indeterminate ? 0 : void 0,
  10732. role: _ctx.indeterminate ? "checkbox" : void 0,
  10733. "aria-checked": _ctx.indeterminate ? "mixed" : false
  10734. }, [
  10735. createElementVNode("span", {
  10736. class: normalizeClass(_ctx.ns.e("inner"))
  10737. }, null, 2),
  10738. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10739. key: 0,
  10740. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10741. class: normalizeClass(_ctx.ns.e("original")),
  10742. type: "checkbox",
  10743. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10744. name: _ctx.name,
  10745. tabindex: _ctx.tabindex,
  10746. disabled: _ctx.isDisabled,
  10747. "true-value": _ctx.trueLabel,
  10748. "false-value": _ctx.falseLabel,
  10749. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10750. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10751. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10752. }, null, 42, _hoisted_3$g)), [
  10753. [vModelCheckbox, _ctx.model]
  10754. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10755. key: 1,
  10756. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10757. class: normalizeClass(_ctx.ns.e("original")),
  10758. type: "checkbox",
  10759. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10760. disabled: _ctx.isDisabled,
  10761. value: _ctx.label,
  10762. name: _ctx.name,
  10763. tabindex: _ctx.tabindex,
  10764. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10765. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10766. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10767. }, null, 42, _hoisted_4$d)), [
  10768. [vModelCheckbox, _ctx.model]
  10769. ])
  10770. ], 10, _hoisted_2$p),
  10771. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  10772. key: 0,
  10773. class: normalizeClass(_ctx.ns.e("label"))
  10774. }, [
  10775. renderSlot(_ctx.$slots, "default"),
  10776. !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10777. createTextVNode(toDisplayString(_ctx.label), 1)
  10778. ], 2112)) : createCommentVNode("v-if", true)
  10779. ], 2)) : createCommentVNode("v-if", true)
  10780. ], 10, _hoisted_1$w);
  10781. }
  10782. 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"]]);
  10783. const _sfc_main$N = defineComponent({
  10784. name: "ElCheckboxButton",
  10785. props: useCheckboxProps,
  10786. emits: [UPDATE_MODEL_EVENT, "change"],
  10787. setup(props) {
  10788. const { focus, isChecked, isDisabled, size, model, handleChange: handleChange2 } = useCheckbox(props);
  10789. const { checkboxGroup } = useCheckboxGroup();
  10790. const ns = useNamespace("checkbox");
  10791. const activeStyle = computed(() => {
  10792. var _a2, _b2, _c, _d;
  10793. const fillValue = (_b2 = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b2 : "";
  10794. return {
  10795. backgroundColor: fillValue,
  10796. borderColor: fillValue,
  10797. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  10798. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : null
  10799. };
  10800. });
  10801. return {
  10802. focus,
  10803. isChecked,
  10804. isDisabled,
  10805. model,
  10806. handleChange: handleChange2,
  10807. activeStyle,
  10808. size,
  10809. ns
  10810. };
  10811. }
  10812. });
  10813. const _hoisted_1$v = ["aria-checked", "aria-disabled"];
  10814. const _hoisted_2$o = ["name", "tabindex", "disabled", "true-value", "false-value"];
  10815. const _hoisted_3$f = ["name", "tabindex", "disabled", "value"];
  10816. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  10817. return openBlock(), createElementBlock("label", {
  10818. class: normalizeClass([
  10819. _ctx.ns.b("button"),
  10820. _ctx.ns.bm("button", _ctx.size),
  10821. _ctx.ns.is("disabled", _ctx.isDisabled),
  10822. _ctx.ns.is("checked", _ctx.isChecked),
  10823. _ctx.ns.is("focus", _ctx.focus)
  10824. ]),
  10825. role: "checkbox",
  10826. "aria-checked": _ctx.isChecked,
  10827. "aria-disabled": _ctx.isDisabled
  10828. }, [
  10829. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10830. key: 0,
  10831. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10832. class: normalizeClass(_ctx.ns.be("button", "original")),
  10833. type: "checkbox",
  10834. name: _ctx.name,
  10835. tabindex: _ctx.tabindex,
  10836. disabled: _ctx.isDisabled,
  10837. "true-value": _ctx.trueLabel,
  10838. "false-value": _ctx.falseLabel,
  10839. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10840. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10841. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10842. }, null, 42, _hoisted_2$o)), [
  10843. [vModelCheckbox, _ctx.model]
  10844. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10845. key: 1,
  10846. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10847. class: normalizeClass(_ctx.ns.be("button", "original")),
  10848. type: "checkbox",
  10849. name: _ctx.name,
  10850. tabindex: _ctx.tabindex,
  10851. disabled: _ctx.isDisabled,
  10852. value: _ctx.label,
  10853. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10854. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10855. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10856. }, null, 42, _hoisted_3$f)), [
  10857. [vModelCheckbox, _ctx.model]
  10858. ]),
  10859. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  10860. key: 2,
  10861. class: normalizeClass(_ctx.ns.be("button", "inner")),
  10862. style: normalizeStyle(_ctx.isChecked ? _ctx.activeStyle : null)
  10863. }, [
  10864. renderSlot(_ctx.$slots, "default", {}, () => [
  10865. createTextVNode(toDisplayString(_ctx.label), 1)
  10866. ])
  10867. ], 6)) : createCommentVNode("v-if", true)
  10868. ], 10, _hoisted_1$v);
  10869. }
  10870. 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"]]);
  10871. const _sfc_main$M = defineComponent({
  10872. name: "ElCheckboxGroup",
  10873. props: {
  10874. modelValue: {
  10875. type: Array,
  10876. default: () => []
  10877. },
  10878. disabled: Boolean,
  10879. min: {
  10880. type: Number,
  10881. default: void 0
  10882. },
  10883. max: {
  10884. type: Number,
  10885. default: void 0
  10886. },
  10887. size: {
  10888. type: String,
  10889. validator: isValidComponentSize
  10890. },
  10891. fill: {
  10892. type: String,
  10893. default: void 0
  10894. },
  10895. textColor: {
  10896. type: String,
  10897. default: void 0
  10898. },
  10899. tag: {
  10900. type: String,
  10901. default: "div"
  10902. }
  10903. },
  10904. emits: [UPDATE_MODEL_EVENT, "change"],
  10905. setup(props, { emit, slots }) {
  10906. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  10907. const checkboxGroupSize = useSize();
  10908. const ns = useNamespace("checkbox");
  10909. const changeEvent = (value) => {
  10910. emit(UPDATE_MODEL_EVENT, value);
  10911. nextTick(() => {
  10912. emit("change", value);
  10913. });
  10914. };
  10915. const modelValue = computed({
  10916. get() {
  10917. return props.modelValue;
  10918. },
  10919. set(val) {
  10920. changeEvent(val);
  10921. }
  10922. });
  10923. provide("CheckboxGroup", __spreadProps(__spreadValues({
  10924. name: "ElCheckboxGroup",
  10925. modelValue
  10926. }, toRefs(props)), {
  10927. checkboxGroupSize,
  10928. changeEvent
  10929. }));
  10930. watch(() => props.modelValue, () => {
  10931. var _a2;
  10932. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  10933. });
  10934. return () => {
  10935. return h$1(props.tag, {
  10936. class: ns.b("group"),
  10937. role: "group",
  10938. "aria-label": "checkbox-group"
  10939. }, [renderSlot(slots, "default")]);
  10940. };
  10941. }
  10942. });
  10943. var CheckboxGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);
  10944. const ElCheckbox = withInstall(Checkbox, {
  10945. CheckboxButton,
  10946. CheckboxGroup
  10947. });
  10948. withNoopInstall(CheckboxButton);
  10949. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  10950. const radioPropsBase = buildProps({
  10951. size: useSizeProp,
  10952. disabled: Boolean,
  10953. label: {
  10954. type: [String, Number, Boolean],
  10955. default: ""
  10956. }
  10957. });
  10958. const radioProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  10959. modelValue: {
  10960. type: [String, Number, Boolean],
  10961. default: ""
  10962. },
  10963. name: {
  10964. type: String,
  10965. default: ""
  10966. },
  10967. border: Boolean
  10968. }));
  10969. const radioEmits = {
  10970. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  10971. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  10972. };
  10973. const useRadio = (props, emit) => {
  10974. const radioRef = ref();
  10975. const radioGroup = inject(radioGroupKey, void 0);
  10976. const isGroup = computed(() => !!radioGroup);
  10977. const modelValue = computed({
  10978. get() {
  10979. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  10980. },
  10981. set(val) {
  10982. if (isGroup.value) {
  10983. radioGroup.changeEvent(val);
  10984. } else {
  10985. emit(UPDATE_MODEL_EVENT, val);
  10986. }
  10987. radioRef.value.checked = props.modelValue === props.label;
  10988. }
  10989. });
  10990. const size = useSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
  10991. const disabled = useDisabled$1(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  10992. const focus = ref(false);
  10993. const tabIndex = computed(() => {
  10994. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  10995. });
  10996. return {
  10997. radioRef,
  10998. isGroup,
  10999. radioGroup,
  11000. focus,
  11001. size,
  11002. disabled,
  11003. tabIndex,
  11004. modelValue
  11005. };
  11006. };
  11007. const _sfc_main$L = defineComponent({
  11008. name: "ElRadio",
  11009. props: radioProps,
  11010. emits: radioEmits,
  11011. setup(props, { emit }) {
  11012. const ns = useNamespace("radio");
  11013. const { radioRef, isGroup, focus, size, disabled, tabIndex, modelValue } = useRadio(props, emit);
  11014. function handleChange2() {
  11015. nextTick(() => emit("change", modelValue.value));
  11016. }
  11017. return {
  11018. ns,
  11019. focus,
  11020. isGroup,
  11021. modelValue,
  11022. tabIndex,
  11023. size,
  11024. disabled,
  11025. radioRef,
  11026. handleChange: handleChange2
  11027. };
  11028. }
  11029. });
  11030. const _hoisted_1$u = ["aria-checked", "aria-disabled", "tabindex"];
  11031. const _hoisted_2$n = ["value", "name", "disabled"];
  11032. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  11033. return openBlock(), createElementBlock("label", {
  11034. class: normalizeClass([
  11035. _ctx.ns.b(),
  11036. _ctx.ns.is("disabled", _ctx.disabled),
  11037. _ctx.ns.is("focus", _ctx.focus),
  11038. _ctx.ns.is("bordered", _ctx.border),
  11039. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label),
  11040. _ctx.ns.m(_ctx.size)
  11041. ]),
  11042. role: "radio",
  11043. "aria-checked": _ctx.modelValue === _ctx.label,
  11044. "aria-disabled": _ctx.disabled,
  11045. tabindex: _ctx.tabIndex,
  11046. onKeydown: _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11047. }, [
  11048. createElementVNode("span", {
  11049. class: normalizeClass([
  11050. _ctx.ns.e("input"),
  11051. _ctx.ns.is("disabled", _ctx.disabled),
  11052. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label)
  11053. ])
  11054. }, [
  11055. createElementVNode("span", {
  11056. class: normalizeClass(_ctx.ns.e("inner"))
  11057. }, null, 2),
  11058. withDirectives(createElementVNode("input", {
  11059. ref: "radioRef",
  11060. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11061. class: normalizeClass(_ctx.ns.e("original")),
  11062. value: _ctx.label,
  11063. type: "radio",
  11064. "aria-hidden": "true",
  11065. name: _ctx.name,
  11066. disabled: _ctx.disabled,
  11067. tabindex: "-1",
  11068. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11069. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false),
  11070. onChange: _cache[3] || (_cache[3] = (...args) => _ctx.handleChange && _ctx.handleChange(...args))
  11071. }, null, 42, _hoisted_2$n), [
  11072. [vModelRadio, _ctx.modelValue]
  11073. ])
  11074. ], 2),
  11075. createElementVNode("span", {
  11076. class: normalizeClass(_ctx.ns.e("label")),
  11077. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {
  11078. }, ["stop"]))
  11079. }, [
  11080. renderSlot(_ctx.$slots, "default", {}, () => [
  11081. createTextVNode(toDisplayString(_ctx.label), 1)
  11082. ])
  11083. ], 34)
  11084. ], 42, _hoisted_1$u);
  11085. }
  11086. 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"]]);
  11087. const radioButtonProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  11088. name: {
  11089. type: String,
  11090. default: ""
  11091. }
  11092. }));
  11093. const _sfc_main$K = defineComponent({
  11094. name: "ElRadioButton",
  11095. props: radioButtonProps,
  11096. setup(props, { emit }) {
  11097. const ns = useNamespace("radio");
  11098. const {
  11099. radioRef,
  11100. isGroup,
  11101. focus,
  11102. size,
  11103. disabled,
  11104. tabIndex,
  11105. modelValue,
  11106. radioGroup
  11107. } = useRadio(props, emit);
  11108. const activeStyle = computed(() => {
  11109. return {
  11110. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11111. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11112. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  11113. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  11114. };
  11115. });
  11116. return {
  11117. ns,
  11118. isGroup,
  11119. size,
  11120. disabled,
  11121. tabIndex,
  11122. modelValue,
  11123. focus,
  11124. activeStyle,
  11125. radioRef
  11126. };
  11127. }
  11128. });
  11129. const _hoisted_1$t = ["aria-checked", "aria-disabled", "tabindex"];
  11130. const _hoisted_2$m = ["value", "name", "disabled"];
  11131. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  11132. return openBlock(), createElementBlock("label", {
  11133. class: normalizeClass([
  11134. _ctx.ns.b("button"),
  11135. _ctx.ns.is("active", _ctx.modelValue === _ctx.label),
  11136. _ctx.ns.is("disabled", _ctx.disabled),
  11137. _ctx.ns.is("focus", _ctx.focus),
  11138. _ctx.ns.bm("button", _ctx.size)
  11139. ]),
  11140. role: "radio",
  11141. "aria-checked": _ctx.modelValue === _ctx.label,
  11142. "aria-disabled": _ctx.disabled,
  11143. tabindex: _ctx.tabIndex,
  11144. onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11145. }, [
  11146. withDirectives(createElementVNode("input", {
  11147. ref: "radioRef",
  11148. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11149. class: normalizeClass(_ctx.ns.be("button", "original-radio")),
  11150. value: _ctx.label,
  11151. type: "radio",
  11152. name: _ctx.name,
  11153. disabled: _ctx.disabled,
  11154. tabindex: "-1",
  11155. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11156. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false)
  11157. }, null, 42, _hoisted_2$m), [
  11158. [vModelRadio, _ctx.modelValue]
  11159. ]),
  11160. createElementVNode("span", {
  11161. class: normalizeClass(_ctx.ns.be("button", "inner")),
  11162. style: normalizeStyle(_ctx.modelValue === _ctx.label ? _ctx.activeStyle : {}),
  11163. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  11164. }, ["stop"]))
  11165. }, [
  11166. renderSlot(_ctx.$slots, "default", {}, () => [
  11167. createTextVNode(toDisplayString(_ctx.label), 1)
  11168. ])
  11169. ], 38)
  11170. ], 42, _hoisted_1$t);
  11171. }
  11172. 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"]]);
  11173. const radioGroupProps = buildProps({
  11174. size: useSizeProp,
  11175. disabled: Boolean,
  11176. modelValue: {
  11177. type: [String, Number, Boolean],
  11178. default: ""
  11179. },
  11180. fill: {
  11181. type: String,
  11182. default: ""
  11183. },
  11184. textColor: {
  11185. type: String,
  11186. default: ""
  11187. }
  11188. });
  11189. const radioGroupEmits = radioEmits;
  11190. const _sfc_main$J = defineComponent({
  11191. name: "ElRadioGroup",
  11192. props: radioGroupProps,
  11193. emits: radioGroupEmits,
  11194. setup(props, ctx) {
  11195. const ns = useNamespace("radio");
  11196. const radioGroupRef = ref();
  11197. const { formItem } = useFormItem();
  11198. const changeEvent = (value) => {
  11199. ctx.emit(UPDATE_MODEL_EVENT, value);
  11200. nextTick(() => ctx.emit("change", value));
  11201. };
  11202. const handleKeydown = (e) => {
  11203. if (!radioGroupRef.value)
  11204. return;
  11205. const target = e.target;
  11206. const className = target.nodeName === "INPUT" ? "[type=radio]" : "[role=radio]";
  11207. const radios = radioGroupRef.value.querySelectorAll(className);
  11208. const length = radios.length;
  11209. const index = Array.from(radios).indexOf(target);
  11210. const roleRadios = radioGroupRef.value.querySelectorAll("[role=radio]");
  11211. let nextIndex = null;
  11212. switch (e.code) {
  11213. case EVENT_CODE.left:
  11214. case EVENT_CODE.up:
  11215. e.stopPropagation();
  11216. e.preventDefault();
  11217. nextIndex = index === 0 ? length - 1 : index - 1;
  11218. break;
  11219. case EVENT_CODE.right:
  11220. case EVENT_CODE.down:
  11221. e.stopPropagation();
  11222. e.preventDefault();
  11223. nextIndex = index === length - 1 ? 0 : index + 1;
  11224. break;
  11225. }
  11226. if (nextIndex === null)
  11227. return;
  11228. roleRadios[nextIndex].click();
  11229. roleRadios[nextIndex].focus();
  11230. };
  11231. onMounted(() => {
  11232. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  11233. const firstLabel = radios[0];
  11234. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  11235. firstLabel.tabIndex = 0;
  11236. }
  11237. });
  11238. provide(radioGroupKey, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  11239. changeEvent
  11240. })));
  11241. watch(() => props.modelValue, () => formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  11242. return {
  11243. ns,
  11244. radioGroupRef,
  11245. handleKeydown
  11246. };
  11247. }
  11248. });
  11249. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  11250. return openBlock(), createElementBlock("div", {
  11251. ref: "radioGroupRef",
  11252. class: normalizeClass(_ctx.ns.b("group")),
  11253. role: "radiogroup",
  11254. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  11255. }, [
  11256. renderSlot(_ctx.$slots, "default")
  11257. ], 34);
  11258. }
  11259. 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"]]);
  11260. const ElRadio = withInstall(Radio, {
  11261. RadioButton,
  11262. RadioGroup
  11263. });
  11264. const ElRadioGroup = withNoopInstall(RadioGroup);
  11265. const ElRadioButton = withNoopInstall(RadioButton);
  11266. var NodeContent = defineComponent({
  11267. name: "NodeContent",
  11268. setup() {
  11269. const ns = useNamespace("cascader-node");
  11270. return {
  11271. ns
  11272. };
  11273. },
  11274. render() {
  11275. const { ns } = this;
  11276. const { node, panel } = this.$parent;
  11277. const { data: data2, label } = node;
  11278. const { renderLabelFn } = panel;
  11279. return h$1("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data: data2 }) : label);
  11280. }
  11281. });
  11282. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  11283. const _sfc_main$I = defineComponent({
  11284. name: "ElCascaderNode",
  11285. components: {
  11286. ElCheckbox,
  11287. ElRadio,
  11288. NodeContent,
  11289. ElIcon,
  11290. Check: check,
  11291. Loading: loading,
  11292. ArrowRight: arrowRight
  11293. },
  11294. props: {
  11295. node: {
  11296. type: Object,
  11297. required: true
  11298. },
  11299. menuId: String
  11300. },
  11301. emits: ["expand"],
  11302. setup(props, { emit }) {
  11303. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11304. const ns = useNamespace("cascader-node");
  11305. const isHoverMenu = computed(() => panel.isHoverMenu);
  11306. const multiple = computed(() => panel.config.multiple);
  11307. const checkStrictly = computed(() => panel.config.checkStrictly);
  11308. const checkedNodeId = computed(() => {
  11309. var _a2;
  11310. return (_a2 = panel.checkedNodes[0]) == null ? void 0 : _a2.uid;
  11311. });
  11312. const isDisabled = computed(() => props.node.isDisabled);
  11313. const isLeaf2 = computed(() => props.node.isLeaf);
  11314. const expandable = computed(() => checkStrictly.value && !isLeaf2.value || !isDisabled.value);
  11315. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  11316. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  11317. const isInPath = (node) => {
  11318. var _a2;
  11319. const { level, uid: uid2 } = props.node;
  11320. return ((_a2 = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a2.uid) === uid2;
  11321. };
  11322. const doExpand = () => {
  11323. if (inExpandingPath.value)
  11324. return;
  11325. panel.expandNode(props.node);
  11326. };
  11327. const doCheck = (checked) => {
  11328. const { node } = props;
  11329. if (checked === node.checked)
  11330. return;
  11331. panel.handleCheckChange(node, checked);
  11332. };
  11333. const doLoad = () => {
  11334. panel.lazyLoad(props.node, () => {
  11335. if (!isLeaf2.value)
  11336. doExpand();
  11337. });
  11338. };
  11339. const handleHoverExpand = (e) => {
  11340. if (!isHoverMenu.value)
  11341. return;
  11342. handleExpand();
  11343. !isLeaf2.value && emit("expand", e);
  11344. };
  11345. const handleExpand = () => {
  11346. const { node } = props;
  11347. if (!expandable.value || node.loading)
  11348. return;
  11349. node.loaded ? doExpand() : doLoad();
  11350. };
  11351. const handleClick = () => {
  11352. if (isHoverMenu.value && !isLeaf2.value)
  11353. return;
  11354. if (isLeaf2.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  11355. handleCheck(true);
  11356. } else {
  11357. handleExpand();
  11358. }
  11359. };
  11360. const handleSelectCheck = (checked) => {
  11361. if (checkStrictly.value) {
  11362. doCheck(checked);
  11363. if (props.node.loaded) {
  11364. doExpand();
  11365. }
  11366. } else {
  11367. handleCheck(checked);
  11368. }
  11369. };
  11370. const handleCheck = (checked) => {
  11371. if (!props.node.loaded) {
  11372. doLoad();
  11373. } else {
  11374. doCheck(checked);
  11375. !checkStrictly.value && doExpand();
  11376. }
  11377. };
  11378. return {
  11379. panel,
  11380. isHoverMenu,
  11381. multiple,
  11382. checkStrictly,
  11383. checkedNodeId,
  11384. isDisabled,
  11385. isLeaf: isLeaf2,
  11386. expandable,
  11387. inExpandingPath,
  11388. inCheckedPath,
  11389. ns,
  11390. handleHoverExpand,
  11391. handleExpand,
  11392. handleClick,
  11393. handleCheck,
  11394. handleSelectCheck
  11395. };
  11396. }
  11397. });
  11398. const _hoisted_1$s = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  11399. const _hoisted_2$l = /* @__PURE__ */ createElementVNode("span", null, null, -1);
  11400. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  11401. const _component_el_checkbox = resolveComponent("el-checkbox");
  11402. const _component_el_radio = resolveComponent("el-radio");
  11403. const _component_check = resolveComponent("check");
  11404. const _component_el_icon = resolveComponent("el-icon");
  11405. const _component_node_content = resolveComponent("node-content");
  11406. const _component_loading = resolveComponent("loading");
  11407. const _component_arrow_right = resolveComponent("arrow-right");
  11408. return openBlock(), createElementBlock("li", {
  11409. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  11410. role: "menuitem",
  11411. "aria-haspopup": !_ctx.isLeaf,
  11412. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  11413. "aria-expanded": _ctx.inExpandingPath,
  11414. tabindex: _ctx.expandable ? -1 : void 0,
  11415. class: normalizeClass([
  11416. _ctx.ns.b(),
  11417. _ctx.ns.is("selectable", _ctx.checkStrictly),
  11418. _ctx.ns.is("active", _ctx.node.checked),
  11419. _ctx.ns.is("disabled", !_ctx.expandable),
  11420. _ctx.inExpandingPath && "in-active-path",
  11421. _ctx.inCheckedPath && "in-checked-path"
  11422. ]),
  11423. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11424. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11425. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  11426. }, [
  11427. createCommentVNode(" prefix "),
  11428. _ctx.multiple ? (openBlock(), createBlock(_component_el_checkbox, {
  11429. key: 0,
  11430. "model-value": _ctx.node.checked,
  11431. indeterminate: _ctx.node.indeterminate,
  11432. disabled: _ctx.isDisabled,
  11433. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  11434. }, ["stop"])),
  11435. "onUpdate:modelValue": _ctx.handleSelectCheck
  11436. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (openBlock(), createBlock(_component_el_radio, {
  11437. key: 1,
  11438. "model-value": _ctx.checkedNodeId,
  11439. label: _ctx.node.uid,
  11440. disabled: _ctx.isDisabled,
  11441. "onUpdate:modelValue": _ctx.handleSelectCheck,
  11442. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  11443. }, ["stop"]))
  11444. }, {
  11445. default: withCtx(() => [
  11446. 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 "),
  11447. _hoisted_2$l
  11448. ]),
  11449. _: 1
  11450. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (openBlock(), createBlock(_component_el_icon, {
  11451. key: 2,
  11452. class: normalizeClass(_ctx.ns.e("prefix"))
  11453. }, {
  11454. default: withCtx(() => [
  11455. createVNode(_component_check)
  11456. ]),
  11457. _: 1
  11458. }, 8, ["class"])) : createCommentVNode("v-if", true),
  11459. createCommentVNode(" content "),
  11460. createVNode(_component_node_content),
  11461. createCommentVNode(" postfix "),
  11462. !_ctx.isLeaf ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  11463. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  11464. key: 0,
  11465. class: normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  11466. }, {
  11467. default: withCtx(() => [
  11468. createVNode(_component_loading)
  11469. ]),
  11470. _: 1
  11471. }, 8, ["class"])) : (openBlock(), createBlock(_component_el_icon, {
  11472. key: 1,
  11473. class: normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  11474. }, {
  11475. default: withCtx(() => [
  11476. createVNode(_component_arrow_right)
  11477. ]),
  11478. _: 1
  11479. }, 8, ["class"]))
  11480. ], 2112)) : createCommentVNode("v-if", true)
  11481. ], 42, _hoisted_1$s);
  11482. }
  11483. 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"]]);
  11484. const _sfc_main$H = defineComponent({
  11485. name: "ElCascaderMenu",
  11486. components: {
  11487. Loading: loading,
  11488. ElIcon,
  11489. ElScrollbar,
  11490. ElCascaderNode
  11491. },
  11492. props: {
  11493. nodes: {
  11494. type: Array,
  11495. required: true
  11496. },
  11497. index: {
  11498. type: Number,
  11499. required: true
  11500. }
  11501. },
  11502. setup(props) {
  11503. const instance = getCurrentInstance();
  11504. const ns = useNamespace("cascader-menu");
  11505. const { t } = useLocale();
  11506. const id = generateId();
  11507. let activeNode = null;
  11508. let hoverTimer = null;
  11509. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11510. const hoverZone = ref(null);
  11511. const isEmpty3 = computed(() => !props.nodes.length);
  11512. const isLoading = computed(() => !panel.initialLoaded);
  11513. const menuId = computed(() => `cascader-menu-${id}-${props.index}`);
  11514. const handleExpand = (e) => {
  11515. activeNode = e.target;
  11516. };
  11517. const handleMouseMove = (e) => {
  11518. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  11519. return;
  11520. if (activeNode.contains(e.target)) {
  11521. clearHoverTimer();
  11522. const el = instance.vnode.el;
  11523. const { left: left2 } = el.getBoundingClientRect();
  11524. const { offsetWidth, offsetHeight } = el;
  11525. const startX = e.clientX - left2;
  11526. const top2 = activeNode.offsetTop;
  11527. const bottom2 = top2 + activeNode.offsetHeight;
  11528. hoverZone.value.innerHTML = `
  11529. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top2} L${offsetWidth} 0 V${top2} Z" />
  11530. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom2} L${offsetWidth} ${offsetHeight} V${bottom2} Z" />
  11531. `;
  11532. } else if (!hoverTimer) {
  11533. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  11534. }
  11535. };
  11536. const clearHoverTimer = () => {
  11537. if (!hoverTimer)
  11538. return;
  11539. clearTimeout(hoverTimer);
  11540. hoverTimer = null;
  11541. };
  11542. const clearHoverZone = () => {
  11543. if (!hoverZone.value)
  11544. return;
  11545. hoverZone.value.innerHTML = "";
  11546. clearHoverTimer();
  11547. };
  11548. return {
  11549. ns,
  11550. panel,
  11551. hoverZone,
  11552. isEmpty: isEmpty3,
  11553. isLoading,
  11554. menuId,
  11555. t,
  11556. handleExpand,
  11557. handleMouseMove,
  11558. clearHoverZone
  11559. };
  11560. }
  11561. });
  11562. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  11563. const _component_el_cascader_node = resolveComponent("el-cascader-node");
  11564. const _component_loading = resolveComponent("loading");
  11565. const _component_el_icon = resolveComponent("el-icon");
  11566. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  11567. return openBlock(), createBlock(_component_el_scrollbar, {
  11568. key: _ctx.menuId,
  11569. tag: "ul",
  11570. role: "menu",
  11571. class: normalizeClass(_ctx.ns.b()),
  11572. "wrap-class": _ctx.ns.e("wrap"),
  11573. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  11574. onMousemove: _ctx.handleMouseMove,
  11575. onMouseleave: _ctx.clearHoverZone
  11576. }, {
  11577. default: withCtx(() => {
  11578. var _a2;
  11579. return [
  11580. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodes, (node) => {
  11581. return openBlock(), createBlock(_component_el_cascader_node, {
  11582. key: node.uid,
  11583. node,
  11584. "menu-id": _ctx.menuId,
  11585. onExpand: _ctx.handleExpand
  11586. }, null, 8, ["node", "menu-id", "onExpand"]);
  11587. }), 128)),
  11588. _ctx.isLoading ? (openBlock(), createElementBlock("div", {
  11589. key: 0,
  11590. class: normalizeClass(_ctx.ns.e("empty-text"))
  11591. }, [
  11592. createVNode(_component_el_icon, {
  11593. size: "14",
  11594. class: normalizeClass(_ctx.ns.is("loading"))
  11595. }, {
  11596. default: withCtx(() => [
  11597. createVNode(_component_loading)
  11598. ]),
  11599. _: 1
  11600. }, 8, ["class"]),
  11601. createTextVNode(" " + toDisplayString(_ctx.t("el.cascader.loading")), 1)
  11602. ], 2)) : _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  11603. key: 1,
  11604. class: normalizeClass(_ctx.ns.e("empty-text"))
  11605. }, toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a2 = _ctx.panel) == null ? void 0 : _a2.isHoverMenu) ? (openBlock(), createElementBlock("svg", {
  11606. key: 2,
  11607. ref: "hoverZone",
  11608. class: normalizeClass(_ctx.ns.e("hover-zone"))
  11609. }, null, 2)) : createCommentVNode("v-if", true)
  11610. ];
  11611. }),
  11612. _: 1
  11613. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  11614. }
  11615. 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"]]);
  11616. var ExpandTrigger = /* @__PURE__ */ ((ExpandTrigger2) => {
  11617. ExpandTrigger2["CLICK"] = "click";
  11618. ExpandTrigger2["HOVER"] = "hover";
  11619. return ExpandTrigger2;
  11620. })(ExpandTrigger || {});
  11621. let uid = 0;
  11622. const calculatePathNodes = (node) => {
  11623. const nodes = [node];
  11624. let { parent } = node;
  11625. while (parent) {
  11626. nodes.unshift(parent);
  11627. parent = parent.parent;
  11628. }
  11629. return nodes;
  11630. };
  11631. class Node {
  11632. constructor(data2, config, parent, root2 = false) {
  11633. this.data = data2;
  11634. this.config = config;
  11635. this.parent = parent;
  11636. this.root = root2;
  11637. this.uid = uid++;
  11638. this.checked = false;
  11639. this.indeterminate = false;
  11640. this.loading = false;
  11641. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  11642. const childrenData = data2[childrenKey];
  11643. const pathNodes = calculatePathNodes(this);
  11644. this.level = root2 ? 0 : parent ? parent.level + 1 : 1;
  11645. this.value = data2[valueKey];
  11646. this.label = data2[labelKey];
  11647. this.pathNodes = pathNodes;
  11648. this.pathValues = pathNodes.map((node) => node.value);
  11649. this.pathLabels = pathNodes.map((node) => node.label);
  11650. this.childrenData = childrenData;
  11651. this.children = (childrenData || []).map((child) => new Node(child, config, this));
  11652. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  11653. }
  11654. get isDisabled() {
  11655. const { data: data2, parent, config } = this;
  11656. const { disabled, checkStrictly } = config;
  11657. const isDisabled = isFunction(disabled) ? disabled(data2, this) : !!data2[disabled];
  11658. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  11659. }
  11660. get isLeaf() {
  11661. const { data: data2, config, childrenData, loaded } = this;
  11662. const { lazy, leaf } = config;
  11663. const isLeaf2 = isFunction(leaf) ? leaf(data2, this) : data2[leaf];
  11664. return isUndefined(isLeaf2) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf2;
  11665. }
  11666. get valueByOption() {
  11667. return this.config.emitPath ? this.pathValues : this.value;
  11668. }
  11669. appendChild(childData) {
  11670. const { childrenData, children } = this;
  11671. const node = new Node(childData, this.config, this);
  11672. if (Array.isArray(childrenData)) {
  11673. childrenData.push(childData);
  11674. } else {
  11675. this.childrenData = [childData];
  11676. }
  11677. children.push(node);
  11678. return node;
  11679. }
  11680. calcText(allLevels, separator) {
  11681. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  11682. this.text = text;
  11683. return text;
  11684. }
  11685. broadcast(event, ...args) {
  11686. const handlerName = `onParent${capitalize(event)}`;
  11687. this.children.forEach((child) => {
  11688. if (child) {
  11689. child.broadcast(event, ...args);
  11690. child[handlerName] && child[handlerName](...args);
  11691. }
  11692. });
  11693. }
  11694. emit(event, ...args) {
  11695. const { parent } = this;
  11696. const handlerName = `onChild${capitalize(event)}`;
  11697. if (parent) {
  11698. parent[handlerName] && parent[handlerName](...args);
  11699. parent.emit(event, ...args);
  11700. }
  11701. }
  11702. onParentCheck(checked) {
  11703. if (!this.isDisabled) {
  11704. this.setCheckState(checked);
  11705. }
  11706. }
  11707. onChildCheck() {
  11708. const { children } = this;
  11709. const validChildren = children.filter((child) => !child.isDisabled);
  11710. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  11711. this.setCheckState(checked);
  11712. }
  11713. setCheckState(checked) {
  11714. const totalNum = this.children.length;
  11715. const checkedNum = this.children.reduce((c, p2) => {
  11716. const num = p2.checked ? 1 : p2.indeterminate ? 0.5 : 0;
  11717. return c + num;
  11718. }, 0);
  11719. this.checked = this.loaded && this.children.every((child) => child.loaded && child.checked) && checked;
  11720. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  11721. }
  11722. doCheck(checked) {
  11723. if (this.checked === checked)
  11724. return;
  11725. const { checkStrictly, multiple } = this.config;
  11726. if (checkStrictly || !multiple) {
  11727. this.checked = checked;
  11728. } else {
  11729. this.broadcast("check", checked);
  11730. this.setCheckState(checked);
  11731. this.emit("check");
  11732. }
  11733. }
  11734. }
  11735. const flatNodes = (nodes, leafOnly) => {
  11736. return nodes.reduce((res, node) => {
  11737. if (node.isLeaf) {
  11738. res.push(node);
  11739. } else {
  11740. !leafOnly && res.push(node);
  11741. res = res.concat(flatNodes(node.children, leafOnly));
  11742. }
  11743. return res;
  11744. }, []);
  11745. };
  11746. class Store {
  11747. constructor(data2, config) {
  11748. this.config = config;
  11749. const nodes = (data2 || []).map((nodeData) => new Node(nodeData, this.config));
  11750. this.nodes = nodes;
  11751. this.allNodes = flatNodes(nodes, false);
  11752. this.leafNodes = flatNodes(nodes, true);
  11753. }
  11754. getNodes() {
  11755. return this.nodes;
  11756. }
  11757. getFlattedNodes(leafOnly) {
  11758. return leafOnly ? this.leafNodes : this.allNodes;
  11759. }
  11760. appendNode(nodeData, parentNode) {
  11761. const node = parentNode ? parentNode.appendChild(nodeData) : new Node(nodeData, this.config);
  11762. if (!parentNode)
  11763. this.nodes.push(node);
  11764. this.allNodes.push(node);
  11765. node.isLeaf && this.leafNodes.push(node);
  11766. }
  11767. appendNodes(nodeDataList, parentNode) {
  11768. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  11769. }
  11770. getNodeByValue(value, leafOnly = false) {
  11771. if (!value && value !== 0)
  11772. return null;
  11773. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual(node2.value, value) || isEqual(node2.pathValues, value));
  11774. return node || null;
  11775. }
  11776. getSameNode(node) {
  11777. if (!node)
  11778. return null;
  11779. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual(node.value, value) && node.level === level);
  11780. return node_ || null;
  11781. }
  11782. }
  11783. const CommonProps = {
  11784. modelValue: [Number, String, Array],
  11785. options: {
  11786. type: Array,
  11787. default: () => []
  11788. },
  11789. props: {
  11790. type: Object,
  11791. default: () => ({})
  11792. }
  11793. };
  11794. const DefaultProps = {
  11795. expandTrigger: ExpandTrigger.CLICK,
  11796. multiple: false,
  11797. checkStrictly: false,
  11798. emitPath: true,
  11799. lazy: false,
  11800. lazyLoad: NOOP,
  11801. value: "value",
  11802. label: "label",
  11803. children: "children",
  11804. leaf: "leaf",
  11805. disabled: "disabled",
  11806. hoverThreshold: 500
  11807. };
  11808. const useCascaderConfig = (props) => {
  11809. return computed(() => __spreadValues(__spreadValues({}, DefaultProps), props.props));
  11810. };
  11811. const getMenuIndex = (el) => {
  11812. if (!el)
  11813. return 0;
  11814. const pieces = el.id.split("-");
  11815. return Number(pieces[pieces.length - 2]);
  11816. };
  11817. const checkNode = (el) => {
  11818. if (!el)
  11819. return;
  11820. const input = el.querySelector("input");
  11821. if (input) {
  11822. input.click();
  11823. } else if (isLeaf(el)) {
  11824. el.click();
  11825. }
  11826. };
  11827. const sortByOriginalOrder = (oldNodes, newNodes) => {
  11828. const newNodesCopy = newNodes.slice(0);
  11829. const newIds = newNodesCopy.map((node) => node.uid);
  11830. const res = oldNodes.reduce((acc, item) => {
  11831. const index = newIds.indexOf(item.uid);
  11832. if (index > -1) {
  11833. acc.push(item);
  11834. newNodesCopy.splice(index, 1);
  11835. newIds.splice(index, 1);
  11836. }
  11837. return acc;
  11838. }, []);
  11839. res.push(...newNodesCopy);
  11840. return res;
  11841. };
  11842. const _sfc_main$G = defineComponent({
  11843. name: "ElCascaderPanel",
  11844. components: {
  11845. ElCascaderMenu
  11846. },
  11847. props: __spreadProps(__spreadValues({}, CommonProps), {
  11848. border: {
  11849. type: Boolean,
  11850. default: true
  11851. },
  11852. renderLabel: Function
  11853. }),
  11854. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  11855. setup(props, { emit, slots }) {
  11856. let manualChecked = false;
  11857. const ns = useNamespace("cascader");
  11858. const config = useCascaderConfig(props);
  11859. let store = null;
  11860. const initialLoaded = ref(true);
  11861. const menuList = ref([]);
  11862. const checkedValue = ref(null);
  11863. const menus = ref([]);
  11864. const expandingNode = ref(null);
  11865. const checkedNodes = ref([]);
  11866. const isHoverMenu = computed(() => config.value.expandTrigger === ExpandTrigger.HOVER);
  11867. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  11868. const initStore = () => {
  11869. const { options } = props;
  11870. const cfg = config.value;
  11871. manualChecked = false;
  11872. store = new Store(options, cfg);
  11873. menus.value = [store.getNodes()];
  11874. if (cfg.lazy && isEmpty(props.options)) {
  11875. initialLoaded.value = false;
  11876. lazyLoad(void 0, (list) => {
  11877. if (list) {
  11878. store = new Store(list, cfg);
  11879. menus.value = [store.getNodes()];
  11880. }
  11881. initialLoaded.value = true;
  11882. syncCheckedValue(false, true);
  11883. });
  11884. } else {
  11885. syncCheckedValue(false, true);
  11886. }
  11887. };
  11888. const lazyLoad = (node, cb) => {
  11889. const cfg = config.value;
  11890. node = node || new Node({}, cfg, void 0, true);
  11891. node.loading = true;
  11892. const resolve = (dataList) => {
  11893. const _node = node;
  11894. const parent = _node.root ? null : _node;
  11895. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  11896. _node.loading = false;
  11897. _node.loaded = true;
  11898. _node.childrenData = _node.childrenData || [];
  11899. cb && cb(dataList);
  11900. };
  11901. cfg.lazyLoad(node, resolve);
  11902. };
  11903. const expandNode = (node, silent) => {
  11904. var _a2;
  11905. const { level } = node;
  11906. const newMenus = menus.value.slice(0, level);
  11907. let newExpandingNode;
  11908. if (node.isLeaf) {
  11909. newExpandingNode = node.pathNodes[level - 2];
  11910. } else {
  11911. newExpandingNode = node;
  11912. newMenus.push(node.children);
  11913. }
  11914. if (((_a2 = expandingNode.value) == null ? void 0 : _a2.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  11915. expandingNode.value = node;
  11916. menus.value = newMenus;
  11917. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  11918. }
  11919. };
  11920. const handleCheckChange = (node, checked, emitClose = true) => {
  11921. const { checkStrictly, multiple } = config.value;
  11922. const oldNode = checkedNodes.value[0];
  11923. manualChecked = true;
  11924. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  11925. node.doCheck(checked);
  11926. calculateCheckedValue();
  11927. emitClose && !multiple && !checkStrictly && emit("close");
  11928. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  11929. };
  11930. const expandParentNode = (node) => {
  11931. if (!node)
  11932. return;
  11933. node = node.parent;
  11934. expandParentNode(node);
  11935. node && expandNode(node);
  11936. };
  11937. const getFlattedNodes = (leafOnly) => {
  11938. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  11939. };
  11940. const getCheckedNodes = (leafOnly) => {
  11941. var _a2;
  11942. return (_a2 = getFlattedNodes(leafOnly)) == null ? void 0 : _a2.filter((node) => node.checked !== false);
  11943. };
  11944. const clearCheckedNodes = () => {
  11945. checkedNodes.value.forEach((node) => node.doCheck(false));
  11946. calculateCheckedValue();
  11947. };
  11948. const calculateCheckedValue = () => {
  11949. var _a2;
  11950. const { checkStrictly, multiple } = config.value;
  11951. const oldNodes = checkedNodes.value;
  11952. const newNodes = getCheckedNodes(!checkStrictly);
  11953. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  11954. const values = nodes.map((node) => node.valueByOption);
  11955. checkedNodes.value = nodes;
  11956. checkedValue.value = multiple ? values : (_a2 = values[0]) != null ? _a2 : null;
  11957. };
  11958. const syncCheckedValue = (loaded = false, forced = false) => {
  11959. const { modelValue } = props;
  11960. const { lazy, multiple, checkStrictly } = config.value;
  11961. const leafOnly = !checkStrictly;
  11962. if (!initialLoaded.value || manualChecked || !forced && isEqual(modelValue, checkedValue.value))
  11963. return;
  11964. if (lazy && !loaded) {
  11965. const values = unique(flattenDeep(castArray(modelValue)));
  11966. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  11967. if (nodes.length) {
  11968. nodes.forEach((node) => {
  11969. lazyLoad(node, () => syncCheckedValue(false, forced));
  11970. });
  11971. } else {
  11972. syncCheckedValue(true, forced);
  11973. }
  11974. } else {
  11975. const values = multiple ? castArray(modelValue) : [modelValue];
  11976. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  11977. syncMenuState(nodes, false);
  11978. checkedValue.value = modelValue;
  11979. }
  11980. };
  11981. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  11982. const { checkStrictly } = config.value;
  11983. const oldNodes = checkedNodes.value;
  11984. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  11985. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  11986. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  11987. if (newExpandingNode) {
  11988. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  11989. } else {
  11990. expandingNode.value = null;
  11991. }
  11992. oldNodes.forEach((node) => node.doCheck(false));
  11993. newNodes.forEach((node) => node.doCheck(true));
  11994. checkedNodes.value = newNodes;
  11995. nextTick(scrollToExpandingNode);
  11996. };
  11997. const scrollToExpandingNode = () => {
  11998. if (!isClient$1)
  11999. return;
  12000. menuList.value.forEach((menu) => {
  12001. const menuElement = menu == null ? void 0 : menu.$el;
  12002. if (menuElement) {
  12003. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  12004. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  12005. scrollIntoView(container, activeNode);
  12006. }
  12007. });
  12008. };
  12009. const handleKeyDown2 = (e) => {
  12010. const target = e.target;
  12011. const { code } = e;
  12012. switch (code) {
  12013. case EVENT_CODE.up:
  12014. case EVENT_CODE.down: {
  12015. e.preventDefault();
  12016. const distance = code === EVENT_CODE.up ? -1 : 1;
  12017. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  12018. break;
  12019. }
  12020. case EVENT_CODE.left: {
  12021. e.preventDefault();
  12022. const preMenu = menuList.value[getMenuIndex(target) - 1];
  12023. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  12024. focusNode(expandedNode);
  12025. break;
  12026. }
  12027. case EVENT_CODE.right: {
  12028. e.preventDefault();
  12029. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  12030. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  12031. focusNode(firstNode);
  12032. break;
  12033. }
  12034. case EVENT_CODE.enter:
  12035. checkNode(target);
  12036. break;
  12037. case EVENT_CODE.esc:
  12038. case EVENT_CODE.tab:
  12039. emit("close");
  12040. break;
  12041. }
  12042. };
  12043. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  12044. config,
  12045. expandingNode,
  12046. checkedNodes,
  12047. isHoverMenu,
  12048. initialLoaded,
  12049. renderLabelFn,
  12050. lazyLoad,
  12051. expandNode,
  12052. handleCheckChange
  12053. }));
  12054. watch([config, () => props.options], initStore, {
  12055. deep: true,
  12056. immediate: true
  12057. });
  12058. watch(() => props.modelValue, () => {
  12059. manualChecked = false;
  12060. syncCheckedValue();
  12061. });
  12062. watch(checkedValue, (val) => {
  12063. if (!isEqual(val, props.modelValue)) {
  12064. emit(UPDATE_MODEL_EVENT, val);
  12065. emit(CHANGE_EVENT, val);
  12066. }
  12067. });
  12068. onBeforeUpdate(() => menuList.value = []);
  12069. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  12070. return {
  12071. ns,
  12072. menuList,
  12073. menus,
  12074. checkedNodes,
  12075. handleKeyDown: handleKeyDown2,
  12076. handleCheckChange,
  12077. getFlattedNodes,
  12078. getCheckedNodes,
  12079. clearCheckedNodes,
  12080. calculateCheckedValue,
  12081. scrollToExpandingNode
  12082. };
  12083. }
  12084. });
  12085. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  12086. const _component_el_cascader_menu = resolveComponent("el-cascader-menu");
  12087. return openBlock(), createElementBlock("div", {
  12088. class: normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  12089. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  12090. }, [
  12091. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menus, (menu, index) => {
  12092. return openBlock(), createBlock(_component_el_cascader_menu, {
  12093. key: index,
  12094. ref_for: true,
  12095. ref: (item) => _ctx.menuList[index] = item,
  12096. index,
  12097. nodes: [...menu]
  12098. }, null, 8, ["index", "nodes"]);
  12099. }), 128))
  12100. ], 34);
  12101. }
  12102. 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"]]);
  12103. CascaderPanel.install = (app) => {
  12104. app.component(CascaderPanel.name, CascaderPanel);
  12105. };
  12106. const _CascaderPanel = CascaderPanel;
  12107. const tagProps = buildProps({
  12108. closable: Boolean,
  12109. type: {
  12110. type: String,
  12111. values: ["success", "info", "warning", "danger", ""],
  12112. default: ""
  12113. },
  12114. hit: Boolean,
  12115. disableTransitions: Boolean,
  12116. color: {
  12117. type: String,
  12118. default: ""
  12119. },
  12120. size: {
  12121. type: String,
  12122. values: componentSizes,
  12123. default: ""
  12124. },
  12125. effect: {
  12126. type: String,
  12127. values: ["dark", "light", "plain"],
  12128. default: "light"
  12129. },
  12130. round: Boolean
  12131. });
  12132. const tagEmits = {
  12133. close: (evt) => evt instanceof MouseEvent,
  12134. click: (evt) => evt instanceof MouseEvent
  12135. };
  12136. const __default__$d = {
  12137. name: "ElTag"
  12138. };
  12139. const _sfc_main$F = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$d), {
  12140. props: tagProps,
  12141. emits: tagEmits,
  12142. setup(__props, { emit }) {
  12143. const props = __props;
  12144. const tagSize = useSize();
  12145. const ns = useNamespace("tag");
  12146. const classes = computed(() => {
  12147. const { type: type4, hit, effect: effect2, closable, round: round2 } = props;
  12148. return [
  12149. ns.b(),
  12150. ns.is("closable", closable),
  12151. ns.m(type4),
  12152. ns.m(tagSize.value),
  12153. ns.m(effect2),
  12154. ns.is("hit", hit),
  12155. ns.is("round", round2)
  12156. ];
  12157. });
  12158. const handleClose = (event) => {
  12159. event.stopPropagation();
  12160. emit("close", event);
  12161. };
  12162. const handleClick = (event) => {
  12163. emit("click", event);
  12164. };
  12165. return (_ctx, _cache) => {
  12166. return !_ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  12167. key: 0,
  12168. class: normalizeClass(unref(classes)),
  12169. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12170. onClick: handleClick
  12171. }, [
  12172. createElementVNode("span", {
  12173. class: normalizeClass(unref(ns).e("content"))
  12174. }, [
  12175. renderSlot(_ctx.$slots, "default")
  12176. ], 2),
  12177. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12178. key: 0,
  12179. class: normalizeClass(unref(ns).e("close")),
  12180. onClick: handleClose
  12181. }, {
  12182. default: withCtx(() => [
  12183. createVNode(unref(close))
  12184. ]),
  12185. _: 1
  12186. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12187. ], 6)) : (openBlock(), createBlock(Transition, {
  12188. key: 1,
  12189. name: `${unref(ns).namespace.value}-zoom-in-center`
  12190. }, {
  12191. default: withCtx(() => [
  12192. createElementVNode("span", {
  12193. class: normalizeClass(unref(classes)),
  12194. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12195. onClick: handleClick
  12196. }, [
  12197. createElementVNode("span", {
  12198. class: normalizeClass(unref(ns).e("content"))
  12199. }, [
  12200. renderSlot(_ctx.$slots, "default")
  12201. ], 2),
  12202. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12203. key: 0,
  12204. class: normalizeClass(unref(ns).e("close")),
  12205. onClick: handleClose
  12206. }, {
  12207. default: withCtx(() => [
  12208. createVNode(unref(close))
  12209. ]),
  12210. _: 1
  12211. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12212. ], 6)
  12213. ]),
  12214. _: 3
  12215. }, 8, ["name"]));
  12216. };
  12217. }
  12218. }));
  12219. var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$F, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
  12220. const ElTag = withInstall(Tag);
  12221. const DEFAULT_INPUT_HEIGHT = 40;
  12222. const INPUT_HEIGHT_MAP = {
  12223. large: 36,
  12224. default: 32,
  12225. small: 28
  12226. };
  12227. const popperOptions = {
  12228. modifiers: [
  12229. {
  12230. name: "arrowPosition",
  12231. enabled: true,
  12232. phase: "main",
  12233. fn: ({ state }) => {
  12234. const { modifiersData, placement } = state;
  12235. if (["right", "left", "bottom", "top"].includes(placement))
  12236. return;
  12237. modifiersData.arrow.x = 35;
  12238. },
  12239. requires: ["arrow"]
  12240. }
  12241. ]
  12242. };
  12243. const COMPONENT_NAME$3 = "ElCascader";
  12244. const _sfc_main$E = defineComponent({
  12245. name: COMPONENT_NAME$3,
  12246. components: {
  12247. ElCascaderPanel: _CascaderPanel,
  12248. ElInput,
  12249. ElTooltip,
  12250. ElScrollbar,
  12251. ElTag,
  12252. ElIcon,
  12253. CircleClose: circleClose,
  12254. Check: check,
  12255. ArrowDown: arrowDown
  12256. },
  12257. directives: {
  12258. Clickoutside: ClickOutside
  12259. },
  12260. props: __spreadProps(__spreadValues({}, CommonProps), {
  12261. size: {
  12262. type: String,
  12263. validator: isValidComponentSize
  12264. },
  12265. placeholder: {
  12266. type: String
  12267. },
  12268. disabled: Boolean,
  12269. clearable: Boolean,
  12270. filterable: Boolean,
  12271. filterMethod: {
  12272. type: Function,
  12273. default: (node, keyword) => node.text.includes(keyword)
  12274. },
  12275. separator: {
  12276. type: String,
  12277. default: " / "
  12278. },
  12279. showAllLevels: {
  12280. type: Boolean,
  12281. default: true
  12282. },
  12283. collapseTags: Boolean,
  12284. collapseTagsTooltip: {
  12285. type: Boolean,
  12286. default: false
  12287. },
  12288. debounce: {
  12289. type: Number,
  12290. default: 300
  12291. },
  12292. beforeFilter: {
  12293. type: Function,
  12294. default: () => true
  12295. },
  12296. popperClass: {
  12297. type: String,
  12298. default: ""
  12299. },
  12300. popperAppendToBody: {
  12301. type: Boolean,
  12302. default: void 0
  12303. },
  12304. teleported: useTooltipContentProps.teleported,
  12305. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  12306. }),
  12307. emits: [
  12308. UPDATE_MODEL_EVENT,
  12309. CHANGE_EVENT,
  12310. "focus",
  12311. "blur",
  12312. "visible-change",
  12313. "expand-change",
  12314. "remove-tag"
  12315. ],
  12316. setup(props, { emit }) {
  12317. let inputInitialHeight = 0;
  12318. let pressDeleteCount = 0;
  12319. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$3, "popperAppendToBody");
  12320. const nsCascader = useNamespace("cascader");
  12321. const nsInput = useNamespace("input");
  12322. const { t } = useLocale();
  12323. const elForm2 = inject(formContextKey, {});
  12324. const elFormItem2 = inject(formItemContextKey, {});
  12325. const tooltipRef = ref(null);
  12326. const input = ref(null);
  12327. const tagWrapper = ref(null);
  12328. const panel = ref(null);
  12329. const suggestionPanel = ref(null);
  12330. const popperVisible = ref(false);
  12331. const inputHover = ref(false);
  12332. const filtering = ref(false);
  12333. const inputValue = ref("");
  12334. const searchInputValue = ref("");
  12335. const presentTags = ref([]);
  12336. const allPresentTags = ref([]);
  12337. const suggestions = ref([]);
  12338. const isOnComposition = ref(false);
  12339. const isDisabled = computed(() => props.disabled || elForm2.disabled);
  12340. const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
  12341. const realSize = useSize();
  12342. const tagSize = computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  12343. const multiple = computed(() => !!props.props.multiple);
  12344. const readonly2 = computed(() => !props.filterable || multiple.value);
  12345. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  12346. const checkedNodes = computed(() => {
  12347. var _a2;
  12348. return ((_a2 = panel.value) == null ? void 0 : _a2.checkedNodes) || [];
  12349. });
  12350. const clearBtnVisible = computed(() => {
  12351. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  12352. return false;
  12353. return !!checkedNodes.value.length;
  12354. });
  12355. const presentText = computed(() => {
  12356. const { showAllLevels, separator } = props;
  12357. const nodes = checkedNodes.value;
  12358. return nodes.length ? multiple.value ? " " : nodes[0].calcText(showAllLevels, separator) : "";
  12359. });
  12360. const checkedValue = computed({
  12361. get() {
  12362. return props.modelValue;
  12363. },
  12364. set(val) {
  12365. var _a2;
  12366. emit(UPDATE_MODEL_EVENT, val);
  12367. emit(CHANGE_EVENT, val);
  12368. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  12369. }
  12370. });
  12371. const popperPaneRef = computed(() => {
  12372. var _a2, _b2;
  12373. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  12374. });
  12375. const togglePopperVisible = (visible) => {
  12376. var _a2, _b2, _c;
  12377. if (isDisabled.value)
  12378. return;
  12379. visible = visible != null ? visible : !popperVisible.value;
  12380. if (visible !== popperVisible.value) {
  12381. popperVisible.value = visible;
  12382. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.input) == null ? void 0 : _b2.setAttribute("aria-expanded", `${visible}`);
  12383. if (visible) {
  12384. updatePopperPosition();
  12385. nextTick((_c = panel.value) == null ? void 0 : _c.scrollToExpandingNode);
  12386. } else if (props.filterable) {
  12387. const { value } = presentText;
  12388. inputValue.value = value;
  12389. searchInputValue.value = value;
  12390. }
  12391. emit("visible-change", visible);
  12392. }
  12393. };
  12394. const updatePopperPosition = () => {
  12395. nextTick(() => {
  12396. var _a2;
  12397. (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper();
  12398. });
  12399. };
  12400. const hideSuggestionPanel = () => {
  12401. filtering.value = false;
  12402. };
  12403. const genTag2 = (node) => {
  12404. const { showAllLevels, separator } = props;
  12405. return {
  12406. node,
  12407. key: node.uid,
  12408. text: node.calcText(showAllLevels, separator),
  12409. hitState: false,
  12410. closable: !isDisabled.value && !node.isDisabled,
  12411. isCollapseTag: false
  12412. };
  12413. };
  12414. const deleteTag = (tag) => {
  12415. var _a2;
  12416. const node = tag.node;
  12417. node.doCheck(false);
  12418. (_a2 = panel.value) == null ? void 0 : _a2.calculateCheckedValue();
  12419. emit("remove-tag", node.valueByOption);
  12420. };
  12421. const calculatePresentTags = () => {
  12422. if (!multiple.value)
  12423. return;
  12424. const nodes = checkedNodes.value;
  12425. const tags = [];
  12426. const allTags = [];
  12427. nodes.forEach((node) => allTags.push(genTag2(node)));
  12428. allPresentTags.value = allTags;
  12429. if (nodes.length) {
  12430. const [first, ...rest] = nodes;
  12431. const restCount = rest.length;
  12432. tags.push(genTag2(first));
  12433. if (restCount) {
  12434. if (props.collapseTags) {
  12435. tags.push({
  12436. key: -1,
  12437. text: `+ ${restCount}`,
  12438. closable: false,
  12439. isCollapseTag: true
  12440. });
  12441. } else {
  12442. rest.forEach((node) => tags.push(genTag2(node)));
  12443. }
  12444. }
  12445. }
  12446. presentTags.value = tags;
  12447. };
  12448. const calculateSuggestions = () => {
  12449. var _a2, _b2;
  12450. const { filterMethod, showAllLevels, separator } = props;
  12451. const res = (_b2 = (_a2 = panel.value) == null ? void 0 : _a2.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b2.filter((node) => {
  12452. if (node.isDisabled)
  12453. return false;
  12454. node.calcText(showAllLevels, separator);
  12455. return filterMethod(node, searchKeyword.value);
  12456. });
  12457. if (multiple.value) {
  12458. presentTags.value.forEach((tag) => {
  12459. tag.hitState = false;
  12460. });
  12461. allPresentTags.value.forEach((tag) => {
  12462. tag.hitState = false;
  12463. });
  12464. }
  12465. filtering.value = true;
  12466. suggestions.value = res;
  12467. updatePopperPosition();
  12468. };
  12469. const focusFirstNode = () => {
  12470. var _a2;
  12471. let firstNode;
  12472. if (filtering.value && suggestionPanel.value) {
  12473. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  12474. } else {
  12475. firstNode = (_a2 = panel.value) == null ? void 0 : _a2.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  12476. }
  12477. if (firstNode) {
  12478. firstNode.focus();
  12479. !filtering.value && firstNode.click();
  12480. }
  12481. };
  12482. const updateStyle = () => {
  12483. var _a2, _b2;
  12484. const inputInner = (_a2 = input.value) == null ? void 0 : _a2.input;
  12485. const tagWrapperEl = tagWrapper.value;
  12486. const suggestionPanelEl = (_b2 = suggestionPanel.value) == null ? void 0 : _b2.$el;
  12487. if (!isClient$1 || !inputInner)
  12488. return;
  12489. if (suggestionPanelEl) {
  12490. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  12491. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  12492. }
  12493. if (tagWrapperEl) {
  12494. const { offsetHeight } = tagWrapperEl;
  12495. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  12496. inputInner.style.height = height;
  12497. updatePopperPosition();
  12498. }
  12499. };
  12500. const getCheckedNodes = (leafOnly) => {
  12501. var _a2;
  12502. return (_a2 = panel.value) == null ? void 0 : _a2.getCheckedNodes(leafOnly);
  12503. };
  12504. const handleExpandChange = (value) => {
  12505. updatePopperPosition();
  12506. emit("expand-change", value);
  12507. };
  12508. const handleComposition = (event) => {
  12509. var _a2;
  12510. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  12511. if (event.type === "compositionend") {
  12512. isOnComposition.value = false;
  12513. nextTick(() => handleInput(text));
  12514. } else {
  12515. const lastCharacter = text[text.length - 1] || "";
  12516. isOnComposition.value = !isKorean(lastCharacter);
  12517. }
  12518. };
  12519. const handleKeyDown2 = (e) => {
  12520. if (isOnComposition.value)
  12521. return;
  12522. switch (e.code) {
  12523. case EVENT_CODE.enter:
  12524. togglePopperVisible();
  12525. break;
  12526. case EVENT_CODE.down:
  12527. togglePopperVisible(true);
  12528. nextTick(focusFirstNode);
  12529. e.preventDefault();
  12530. break;
  12531. case EVENT_CODE.esc:
  12532. case EVENT_CODE.tab:
  12533. togglePopperVisible(false);
  12534. break;
  12535. }
  12536. };
  12537. const handleClear = () => {
  12538. var _a2;
  12539. (_a2 = panel.value) == null ? void 0 : _a2.clearCheckedNodes();
  12540. togglePopperVisible(false);
  12541. };
  12542. const handleSuggestionClick = (node) => {
  12543. var _a2, _b2;
  12544. const { checked } = node;
  12545. if (multiple.value) {
  12546. (_a2 = panel.value) == null ? void 0 : _a2.handleCheckChange(node, !checked, false);
  12547. } else {
  12548. !checked && ((_b2 = panel.value) == null ? void 0 : _b2.handleCheckChange(node, true, false));
  12549. togglePopperVisible(false);
  12550. }
  12551. };
  12552. const handleSuggestionKeyDown = (e) => {
  12553. const target = e.target;
  12554. const { code } = e;
  12555. switch (code) {
  12556. case EVENT_CODE.up:
  12557. case EVENT_CODE.down: {
  12558. const distance = code === EVENT_CODE.up ? -1 : 1;
  12559. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  12560. break;
  12561. }
  12562. case EVENT_CODE.enter:
  12563. target.click();
  12564. break;
  12565. case EVENT_CODE.esc:
  12566. case EVENT_CODE.tab:
  12567. togglePopperVisible(false);
  12568. break;
  12569. }
  12570. };
  12571. const handleDelete = () => {
  12572. const tags = presentTags.value;
  12573. const lastTag = tags[tags.length - 1];
  12574. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  12575. if (!lastTag || !pressDeleteCount)
  12576. return;
  12577. if (lastTag.hitState) {
  12578. deleteTag(lastTag);
  12579. } else {
  12580. lastTag.hitState = true;
  12581. }
  12582. };
  12583. const handleFilter = debounce$1(() => {
  12584. const { value } = searchKeyword;
  12585. if (!value)
  12586. return;
  12587. const passed = props.beforeFilter(value);
  12588. if (isPromise(passed)) {
  12589. passed.then(calculateSuggestions).catch(() => {
  12590. });
  12591. } else if (passed !== false) {
  12592. calculateSuggestions();
  12593. } else {
  12594. hideSuggestionPanel();
  12595. }
  12596. }, props.debounce);
  12597. const handleInput = (val, e) => {
  12598. !popperVisible.value && togglePopperVisible(true);
  12599. if (e == null ? void 0 : e.isComposing)
  12600. return;
  12601. val ? handleFilter() : hideSuggestionPanel();
  12602. };
  12603. watch(filtering, updatePopperPosition);
  12604. watch([checkedNodes, isDisabled], calculatePresentTags);
  12605. watch(presentTags, () => {
  12606. nextTick(() => updateStyle());
  12607. });
  12608. watch(presentText, (val) => inputValue.value = val, { immediate: true });
  12609. onMounted(() => {
  12610. var _a2;
  12611. const inputEl = (_a2 = input.value) == null ? void 0 : _a2.$el;
  12612. inputInitialHeight = (inputEl == null ? void 0 : inputEl.offsetHeight) || INPUT_HEIGHT_MAP[realSize.value] || DEFAULT_INPUT_HEIGHT;
  12613. addResizeListener(inputEl, updateStyle);
  12614. });
  12615. onBeforeUnmount(() => {
  12616. var _a2;
  12617. removeResizeListener((_a2 = input.value) == null ? void 0 : _a2.$el, updateStyle);
  12618. });
  12619. return {
  12620. popperOptions,
  12621. tooltipRef,
  12622. popperPaneRef,
  12623. input,
  12624. tagWrapper,
  12625. panel,
  12626. suggestionPanel,
  12627. popperVisible,
  12628. inputHover,
  12629. inputPlaceholder,
  12630. filtering,
  12631. presentText,
  12632. checkedValue,
  12633. inputValue,
  12634. searchInputValue,
  12635. presentTags,
  12636. allPresentTags,
  12637. suggestions,
  12638. isDisabled,
  12639. isOnComposition,
  12640. realSize,
  12641. tagSize,
  12642. multiple,
  12643. readonly: readonly2,
  12644. clearBtnVisible,
  12645. compatTeleported,
  12646. nsCascader,
  12647. nsInput,
  12648. t,
  12649. togglePopperVisible,
  12650. hideSuggestionPanel,
  12651. deleteTag,
  12652. focusFirstNode,
  12653. getCheckedNodes,
  12654. handleExpandChange,
  12655. handleKeyDown: handleKeyDown2,
  12656. handleComposition,
  12657. handleClear,
  12658. handleSuggestionClick,
  12659. handleSuggestionKeyDown,
  12660. handleDelete,
  12661. handleInput
  12662. };
  12663. }
  12664. });
  12665. const _hoisted_1$r = { key: 0 };
  12666. const _hoisted_2$k = { class: "el-cascader__collapse-tags" };
  12667. const _hoisted_3$e = ["placeholder"];
  12668. const _hoisted_4$c = ["onClick"];
  12669. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  12670. const _component_circle_close = resolveComponent("circle-close");
  12671. const _component_el_icon = resolveComponent("el-icon");
  12672. const _component_arrow_down = resolveComponent("arrow-down");
  12673. const _component_el_input = resolveComponent("el-input");
  12674. const _component_el_tag = resolveComponent("el-tag");
  12675. const _component_el_tooltip = resolveComponent("el-tooltip");
  12676. const _component_el_cascader_panel = resolveComponent("el-cascader-panel");
  12677. const _component_check = resolveComponent("check");
  12678. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  12679. const _directive_clickoutside = resolveDirective("clickoutside");
  12680. return openBlock(), createBlock(_component_el_tooltip, {
  12681. ref: "tooltipRef",
  12682. visible: _ctx.popperVisible,
  12683. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.popperVisible = $event),
  12684. teleported: _ctx.compatTeleported,
  12685. "popper-class": [_ctx.nsCascader.e("dropdown"), _ctx.popperClass],
  12686. "popper-options": _ctx.popperOptions,
  12687. "fallback-placements": [
  12688. "bottom-start",
  12689. "bottom",
  12690. "top-start",
  12691. "top",
  12692. "right",
  12693. "left"
  12694. ],
  12695. "stop-popper-mouse-event": false,
  12696. "gpu-acceleration": false,
  12697. placement: "bottom-start",
  12698. transition: `${_ctx.nsCascader.namespace.value}-zoom-in-top`,
  12699. effect: "light",
  12700. pure: "",
  12701. persistent: "",
  12702. onHide: _ctx.hideSuggestionPanel
  12703. }, {
  12704. default: withCtx(() => [
  12705. withDirectives((openBlock(), createElementBlock("div", {
  12706. class: normalizeClass([
  12707. _ctx.nsCascader.b(),
  12708. _ctx.nsCascader.m(_ctx.realSize),
  12709. _ctx.nsCascader.is("disabled", _ctx.isDisabled),
  12710. _ctx.$attrs.class
  12711. ]),
  12712. style: normalizeStyle(_ctx.$attrs.style),
  12713. onClick: _cache[11] || (_cache[11] = () => _ctx.togglePopperVisible(_ctx.readonly ? void 0 : true)),
  12714. onKeydown: _cache[12] || (_cache[12] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
  12715. onMouseenter: _cache[13] || (_cache[13] = ($event) => _ctx.inputHover = true),
  12716. onMouseleave: _cache[14] || (_cache[14] = ($event) => _ctx.inputHover = false)
  12717. }, [
  12718. createVNode(_component_el_input, {
  12719. ref: "input",
  12720. modelValue: _ctx.inputValue,
  12721. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.inputValue = $event),
  12722. placeholder: _ctx.inputPlaceholder,
  12723. readonly: _ctx.readonly,
  12724. disabled: _ctx.isDisabled,
  12725. "validate-event": false,
  12726. size: _ctx.realSize,
  12727. class: normalizeClass(_ctx.nsCascader.is("focus", _ctx.popperVisible)),
  12728. onCompositionstart: _ctx.handleComposition,
  12729. onCompositionupdate: _ctx.handleComposition,
  12730. onCompositionend: _ctx.handleComposition,
  12731. onFocus: _cache[2] || (_cache[2] = (e) => _ctx.$emit("focus", e)),
  12732. onBlur: _cache[3] || (_cache[3] = (e) => _ctx.$emit("blur", e)),
  12733. onInput: _ctx.handleInput
  12734. }, {
  12735. suffix: withCtx(() => [
  12736. _ctx.clearBtnVisible ? (openBlock(), createBlock(_component_el_icon, {
  12737. key: "clear",
  12738. class: normalizeClass([_ctx.nsInput.e("icon"), "icon-circle-close"]),
  12739. onClick: withModifiers(_ctx.handleClear, ["stop"])
  12740. }, {
  12741. default: withCtx(() => [
  12742. createVNode(_component_circle_close)
  12743. ]),
  12744. _: 1
  12745. }, 8, ["class", "onClick"])) : (openBlock(), createBlock(_component_el_icon, {
  12746. key: "arrow-down",
  12747. class: normalizeClass([
  12748. _ctx.nsInput.e("icon"),
  12749. "icon-arrow-down",
  12750. _ctx.nsCascader.is("reverse", _ctx.popperVisible)
  12751. ]),
  12752. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.togglePopperVisible(), ["stop"]))
  12753. }, {
  12754. default: withCtx(() => [
  12755. createVNode(_component_arrow_down)
  12756. ]),
  12757. _: 1
  12758. }, 8, ["class"]))
  12759. ]),
  12760. _: 1
  12761. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput"]),
  12762. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  12763. key: 0,
  12764. ref: "tagWrapper",
  12765. class: normalizeClass(_ctx.nsCascader.e("tags"))
  12766. }, [
  12767. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.presentTags, (tag) => {
  12768. return openBlock(), createBlock(_component_el_tag, {
  12769. key: tag.key,
  12770. type: _ctx.tagType,
  12771. size: _ctx.tagSize,
  12772. hit: tag.hitState,
  12773. closable: tag.closable,
  12774. "disable-transitions": "",
  12775. onClose: ($event) => _ctx.deleteTag(tag)
  12776. }, {
  12777. default: withCtx(() => [
  12778. tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", _hoisted_1$r, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(_component_el_tooltip, {
  12779. key: 1,
  12780. teleported: false,
  12781. disabled: _ctx.popperVisible || !_ctx.collapseTagsTooltip,
  12782. "fallback-placements": ["bottom", "top", "right", "left"],
  12783. placement: "bottom",
  12784. effect: "light"
  12785. }, {
  12786. default: withCtx(() => [
  12787. createElementVNode("span", null, toDisplayString(tag.text), 1)
  12788. ]),
  12789. content: withCtx(() => [
  12790. createElementVNode("div", _hoisted_2$k, [
  12791. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.allPresentTags, (tag2, idx) => {
  12792. return openBlock(), createElementBlock("div", {
  12793. key: idx,
  12794. class: "el-cascader__collapse-tag"
  12795. }, [
  12796. (openBlock(), createBlock(_component_el_tag, {
  12797. key: tag2.key,
  12798. class: "in-tooltip",
  12799. type: _ctx.tagType,
  12800. size: _ctx.tagSize,
  12801. hit: tag2.hitState,
  12802. closable: tag2.closable,
  12803. "disable-transitions": "",
  12804. onClose: ($event) => _ctx.deleteTag(tag2)
  12805. }, {
  12806. default: withCtx(() => [
  12807. createElementVNode("span", null, toDisplayString(tag2.text), 1)
  12808. ]),
  12809. _: 2
  12810. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  12811. ]);
  12812. }), 128))
  12813. ])
  12814. ]),
  12815. _: 2
  12816. }, 1032, ["disabled"]))
  12817. ]),
  12818. _: 2
  12819. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  12820. }), 128)),
  12821. _ctx.filterable && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("input", {
  12822. key: 0,
  12823. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.searchInputValue = $event),
  12824. type: "text",
  12825. class: normalizeClass(_ctx.nsCascader.e("search-input")),
  12826. placeholder: _ctx.presentText ? "" : _ctx.inputPlaceholder,
  12827. onInput: _cache[5] || (_cache[5] = (e) => _ctx.handleInput(_ctx.searchInputValue, e)),
  12828. onClick: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.togglePopperVisible(true), ["stop"])),
  12829. onKeydown: _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleDelete && _ctx.handleDelete(...args), ["delete"])),
  12830. onCompositionstart: _cache[8] || (_cache[8] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12831. onCompositionupdate: _cache[9] || (_cache[9] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12832. onCompositionend: _cache[10] || (_cache[10] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args))
  12833. }, null, 42, _hoisted_3$e)), [
  12834. [vModelText, _ctx.searchInputValue]
  12835. ]) : createCommentVNode("v-if", true)
  12836. ], 2)) : createCommentVNode("v-if", true)
  12837. ], 38)), [
  12838. [_directive_clickoutside, () => _ctx.togglePopperVisible(false), _ctx.popperPaneRef]
  12839. ])
  12840. ]),
  12841. content: withCtx(() => [
  12842. withDirectives(createVNode(_component_el_cascader_panel, {
  12843. ref: "panel",
  12844. modelValue: _ctx.checkedValue,
  12845. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.checkedValue = $event),
  12846. options: _ctx.options,
  12847. props: _ctx.props,
  12848. border: false,
  12849. "render-label": _ctx.$slots.default,
  12850. onExpandChange: _ctx.handleExpandChange,
  12851. onClose: _cache[16] || (_cache[16] = ($event) => _ctx.$nextTick(() => _ctx.togglePopperVisible(false)))
  12852. }, null, 8, ["modelValue", "options", "props", "render-label", "onExpandChange"]), [
  12853. [vShow, !_ctx.filtering]
  12854. ]),
  12855. _ctx.filterable ? withDirectives((openBlock(), createBlock(_component_el_scrollbar, {
  12856. key: 0,
  12857. ref: "suggestionPanel",
  12858. tag: "ul",
  12859. class: normalizeClass(_ctx.nsCascader.e("suggestion-panel")),
  12860. "view-class": _ctx.nsCascader.e("suggestion-list"),
  12861. onKeydown: _ctx.handleSuggestionKeyDown
  12862. }, {
  12863. default: withCtx(() => [
  12864. _ctx.suggestions.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.suggestions, (item) => {
  12865. return openBlock(), createElementBlock("li", {
  12866. key: item.uid,
  12867. class: normalizeClass([
  12868. _ctx.nsCascader.e("suggestion-item"),
  12869. _ctx.nsCascader.is("checked", item.checked)
  12870. ]),
  12871. tabindex: -1,
  12872. onClick: ($event) => _ctx.handleSuggestionClick(item)
  12873. }, [
  12874. createElementVNode("span", null, toDisplayString(item.text), 1),
  12875. item.checked ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  12876. default: withCtx(() => [
  12877. createVNode(_component_check)
  12878. ]),
  12879. _: 1
  12880. })) : createCommentVNode("v-if", true)
  12881. ], 10, _hoisted_4$c);
  12882. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  12883. createElementVNode("li", {
  12884. class: normalizeClass(_ctx.nsCascader.e("empty-text"))
  12885. }, toDisplayString(_ctx.t("el.cascader.noMatch")), 3)
  12886. ])
  12887. ]),
  12888. _: 3
  12889. }, 8, ["class", "view-class", "onKeydown"])), [
  12890. [vShow, _ctx.filtering]
  12891. ]) : createCommentVNode("v-if", true)
  12892. ]),
  12893. _: 3
  12894. }, 8, ["visible", "teleported", "popper-class", "popper-options", "transition", "onHide"]);
  12895. }
  12896. 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"]]);
  12897. Cascader.install = (app) => {
  12898. app.component(Cascader.name, Cascader);
  12899. };
  12900. const _Cascader = Cascader;
  12901. const ElCascader = _Cascader;
  12902. const messageConfig = {};
  12903. const configProviderProps = buildProps({
  12904. a11y: {
  12905. type: Boolean,
  12906. default: true
  12907. },
  12908. locale: {
  12909. type: definePropType(Object)
  12910. },
  12911. size: {
  12912. type: String,
  12913. values: componentSizes,
  12914. default: ""
  12915. },
  12916. button: {
  12917. type: definePropType(Object)
  12918. },
  12919. experimentalFeatures: {
  12920. type: definePropType(Object)
  12921. },
  12922. keyboardNavigation: {
  12923. type: Boolean,
  12924. default: true
  12925. },
  12926. message: {
  12927. type: definePropType(Object)
  12928. },
  12929. zIndex: {
  12930. type: Number
  12931. },
  12932. namespace: {
  12933. type: String,
  12934. default: "el"
  12935. }
  12936. });
  12937. var ConfigProvider = defineComponent({
  12938. name: "ElConfigProvider",
  12939. props: configProviderProps,
  12940. setup(props, { slots }) {
  12941. watch(() => props.message, (val) => {
  12942. Object.assign(messageConfig, val != null ? val : {});
  12943. }, { immediate: true, deep: true });
  12944. const config = provideGlobalConfig(props);
  12945. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  12946. }
  12947. });
  12948. const ElConfigProvider = withInstall(ConfigProvider);
  12949. var advancedFormat$1 = { exports: {} };
  12950. (function(module2, exports2) {
  12951. !function(e, t) {
  12952. module2.exports = t();
  12953. }(commonjsGlobal, function() {
  12954. return function(e, t, r) {
  12955. var n = t.prototype, s2 = n.format;
  12956. r.en.ordinal = function(e2) {
  12957. var t2 = ["th", "st", "nd", "rd"], r2 = e2 % 100;
  12958. return "[" + e2 + (t2[(r2 - 20) % 10] || t2[r2] || t2[0]) + "]";
  12959. }, n.format = function(e2) {
  12960. var t2 = this, r2 = this.$locale();
  12961. if (!this.isValid())
  12962. return s2.bind(this)(e2);
  12963. 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) {
  12964. switch (e3) {
  12965. case "Q":
  12966. return Math.ceil((t2.$M + 1) / 3);
  12967. case "Do":
  12968. return r2.ordinal(t2.$D);
  12969. case "gggg":
  12970. return t2.weekYear();
  12971. case "GGGG":
  12972. return t2.isoWeekYear();
  12973. case "wo":
  12974. return r2.ordinal(t2.week(), "W");
  12975. case "w":
  12976. case "ww":
  12977. return n2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  12978. case "W":
  12979. case "WW":
  12980. return n2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  12981. case "k":
  12982. case "kk":
  12983. return n2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  12984. case "X":
  12985. return Math.floor(t2.$d.getTime() / 1e3);
  12986. case "x":
  12987. return t2.$d.getTime();
  12988. case "z":
  12989. return "[" + t2.offsetName() + "]";
  12990. case "zzz":
  12991. return "[" + t2.offsetName("long") + "]";
  12992. default:
  12993. return e3;
  12994. }
  12995. });
  12996. return s2.bind(this)(a2);
  12997. };
  12998. };
  12999. });
  13000. })(advancedFormat$1);
  13001. var advancedFormat = advancedFormat$1.exports;
  13002. var weekOfYear$1 = { exports: {} };
  13003. (function(module2, exports2) {
  13004. !function(e, t) {
  13005. module2.exports = t();
  13006. }(commonjsGlobal, function() {
  13007. var e = "week", t = "year";
  13008. return function(i, n, r) {
  13009. var f = n.prototype;
  13010. f.week = function(i2) {
  13011. if (i2 === void 0 && (i2 = null), i2 !== null)
  13012. return this.add(7 * (i2 - this.week()), "day");
  13013. var n2 = this.$locale().yearStart || 1;
  13014. if (this.month() === 11 && this.date() > 25) {
  13015. var f2 = r(this).startOf(t).add(1, t).date(n2), s2 = r(this).endOf(e);
  13016. if (f2.isBefore(s2))
  13017. return 1;
  13018. }
  13019. var a2 = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o2 = this.diff(a2, e, true);
  13020. return o2 < 0 ? r(this).startOf("week").week() : Math.ceil(o2);
  13021. }, f.weeks = function(e2) {
  13022. return e2 === void 0 && (e2 = null), this.week(e2);
  13023. };
  13024. };
  13025. });
  13026. })(weekOfYear$1);
  13027. var weekOfYear = weekOfYear$1.exports;
  13028. var weekYear$1 = { exports: {} };
  13029. (function(module2, exports2) {
  13030. !function(e, t) {
  13031. module2.exports = t();
  13032. }(commonjsGlobal, function() {
  13033. return function(e, t) {
  13034. t.prototype.weekYear = function() {
  13035. var e2 = this.month(), t2 = this.week(), n = this.year();
  13036. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  13037. };
  13038. };
  13039. });
  13040. })(weekYear$1);
  13041. var weekYear = weekYear$1.exports;
  13042. var dayOfYear$1 = { exports: {} };
  13043. (function(module2, exports2) {
  13044. !function(e, t) {
  13045. module2.exports = t();
  13046. }(commonjsGlobal, function() {
  13047. return function(e, t, n) {
  13048. t.prototype.dayOfYear = function(e2) {
  13049. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  13050. return e2 == null ? t2 : this.add(e2 - t2, "day");
  13051. };
  13052. };
  13053. });
  13054. })(dayOfYear$1);
  13055. var dayOfYear = dayOfYear$1.exports;
  13056. var isSameOrAfter$1 = { exports: {} };
  13057. (function(module2, exports2) {
  13058. !function(e, t) {
  13059. module2.exports = t();
  13060. }(commonjsGlobal, function() {
  13061. return function(e, t) {
  13062. t.prototype.isSameOrAfter = function(e2, t2) {
  13063. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  13064. };
  13065. };
  13066. });
  13067. })(isSameOrAfter$1);
  13068. var isSameOrAfter = isSameOrAfter$1.exports;
  13069. var isSameOrBefore$1 = { exports: {} };
  13070. (function(module2, exports2) {
  13071. !function(e, i) {
  13072. module2.exports = i();
  13073. }(commonjsGlobal, function() {
  13074. return function(e, i) {
  13075. i.prototype.isSameOrBefore = function(e2, i2) {
  13076. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  13077. };
  13078. };
  13079. });
  13080. })(isSameOrBefore$1);
  13081. var isSameOrBefore = isSameOrBefore$1.exports;
  13082. const ROOT_PICKER_INJECTION_KEY = Symbol();
  13083. var ElDatePickerCell = defineComponent({
  13084. name: "ElDatePickerCell",
  13085. props: buildProps({
  13086. cell: {
  13087. type: definePropType(Object)
  13088. }
  13089. }),
  13090. setup(props) {
  13091. const picker = inject(ROOT_PICKER_INJECTION_KEY);
  13092. return () => {
  13093. const cell = props.cell;
  13094. if (picker == null ? void 0 : picker.ctx.slots.default) {
  13095. const list = picker.ctx.slots.default(cell).filter((item) => {
  13096. return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)";
  13097. });
  13098. if (list.length) {
  13099. return list;
  13100. }
  13101. }
  13102. return h$1("div", {
  13103. class: "el-date-table-cell"
  13104. }, [
  13105. h$1("span", {
  13106. class: "el-date-table-cell__text"
  13107. }, [cell == null ? void 0 : cell.text])
  13108. ]);
  13109. };
  13110. }
  13111. });
  13112. const _sfc_main$D = defineComponent({
  13113. components: {
  13114. ElDatePickerCell
  13115. },
  13116. props: {
  13117. date: {
  13118. type: Object
  13119. },
  13120. minDate: {
  13121. type: Object
  13122. },
  13123. maxDate: {
  13124. type: Object
  13125. },
  13126. parsedValue: {
  13127. type: [Object, Array]
  13128. },
  13129. selectionMode: {
  13130. type: String,
  13131. default: "day"
  13132. },
  13133. showWeekNumber: {
  13134. type: Boolean,
  13135. default: false
  13136. },
  13137. disabledDate: {
  13138. type: Function
  13139. },
  13140. cellClassName: {
  13141. type: Function
  13142. },
  13143. rangeState: {
  13144. type: Object,
  13145. default: () => ({
  13146. endDate: null,
  13147. selecting: false
  13148. })
  13149. }
  13150. },
  13151. emits: ["changerange", "pick", "select"],
  13152. setup(props, ctx) {
  13153. const { t, lang } = useLocale();
  13154. const lastRow = ref(null);
  13155. const lastColumn = ref(null);
  13156. const tableRows = ref([[], [], [], [], [], []]);
  13157. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  13158. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_2) => _2.toLowerCase());
  13159. const offsetDay = computed(() => {
  13160. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  13161. });
  13162. const startDate = computed(() => {
  13163. const startDayOfMonth = props.date.startOf("month");
  13164. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  13165. });
  13166. const WEEKS = computed(() => {
  13167. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  13168. });
  13169. const rows = computed(() => {
  13170. var _a2;
  13171. const startOfMonth = props.date.startOf("month");
  13172. const startOfMonthDay = startOfMonth.day() || 7;
  13173. const dateCountOfMonth = startOfMonth.daysInMonth();
  13174. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  13175. const offset2 = offsetDay.value;
  13176. const rows_ = tableRows.value;
  13177. let count = 1;
  13178. const selectedDate = props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  13179. const calNow = dayjs().locale(lang.value).startOf("day");
  13180. for (let i = 0; i < 6; i++) {
  13181. const row = rows_[i];
  13182. if (props.showWeekNumber) {
  13183. if (!row[0]) {
  13184. row[0] = {
  13185. type: "week",
  13186. text: startDate.value.add(i * 7 + 1, "day").week()
  13187. };
  13188. }
  13189. }
  13190. for (let j = 0; j < 7; j++) {
  13191. let cell = row[props.showWeekNumber ? j + 1 : j];
  13192. if (!cell) {
  13193. cell = {
  13194. row: i,
  13195. column: j,
  13196. type: "normal",
  13197. inRange: false,
  13198. start: false,
  13199. end: false
  13200. };
  13201. }
  13202. const index = i * 7 + j;
  13203. const calTime = startDate.value.add(index - offset2, "day");
  13204. cell.dayjs = calTime;
  13205. cell.date = calTime.toDate();
  13206. cell.timestamp = calTime.valueOf();
  13207. cell.type = "normal";
  13208. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13209. 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");
  13210. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13211. cell.start = calEndDate && calTime.isSame(calEndDate, "day");
  13212. cell.end = props.minDate && calTime.isSame(props.minDate, "day");
  13213. } else {
  13214. cell.start = props.minDate && calTime.isSame(props.minDate, "day");
  13215. cell.end = calEndDate && calTime.isSame(calEndDate, "day");
  13216. }
  13217. const isToday = calTime.isSame(calNow, "day");
  13218. if (isToday) {
  13219. cell.type = "today";
  13220. }
  13221. if (i >= 0 && i <= 1) {
  13222. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset2 < 0 ? 7 + startOfMonthDay + offset2 : startOfMonthDay + offset2;
  13223. if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
  13224. cell.text = count++;
  13225. } else {
  13226. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
  13227. cell.type = "prev-month";
  13228. }
  13229. } else {
  13230. if (count <= dateCountOfMonth) {
  13231. cell.text = count++;
  13232. } else {
  13233. cell.text = count++ - dateCountOfMonth;
  13234. cell.type = "next-month";
  13235. }
  13236. }
  13237. const cellDate = calTime.toDate();
  13238. cell.selected = selectedDate.find((_2) => _2.valueOf() === calTime.valueOf());
  13239. cell.isSelected = !!cell.selected;
  13240. cell.isCurrent = isCurrent(cell);
  13241. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13242. cell.customClass = props.cellClassName && props.cellClassName(cellDate);
  13243. row[props.showWeekNumber ? j + 1 : j] = cell;
  13244. }
  13245. if (props.selectionMode === "week") {
  13246. const start2 = props.showWeekNumber ? 1 : 0;
  13247. const end2 = props.showWeekNumber ? 7 : 6;
  13248. const isActive = isWeekActive(row[start2 + 1]);
  13249. row[start2].inRange = isActive;
  13250. row[start2].start = isActive;
  13251. row[end2].inRange = isActive;
  13252. row[end2].end = isActive;
  13253. }
  13254. }
  13255. return rows_;
  13256. });
  13257. const isCurrent = (cell) => {
  13258. return props.selectionMode === "day" && (cell.type === "normal" || cell.type === "today") && cellMatchesDate(cell, props.parsedValue);
  13259. };
  13260. const cellMatchesDate = (cell, date4) => {
  13261. if (!date4)
  13262. return false;
  13263. return dayjs(date4).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day");
  13264. };
  13265. const getCellClasses = (cell) => {
  13266. const classes = [];
  13267. if ((cell.type === "normal" || cell.type === "today") && !cell.disabled) {
  13268. classes.push("available");
  13269. if (cell.type === "today") {
  13270. classes.push("today");
  13271. }
  13272. } else {
  13273. classes.push(cell.type);
  13274. }
  13275. if (isCurrent(cell)) {
  13276. classes.push("current");
  13277. }
  13278. if (cell.inRange && (cell.type === "normal" || cell.type === "today" || props.selectionMode === "week")) {
  13279. classes.push("in-range");
  13280. if (cell.start) {
  13281. classes.push("start-date");
  13282. }
  13283. if (cell.end) {
  13284. classes.push("end-date");
  13285. }
  13286. }
  13287. if (cell.disabled) {
  13288. classes.push("disabled");
  13289. }
  13290. if (cell.selected) {
  13291. classes.push("selected");
  13292. }
  13293. if (cell.customClass) {
  13294. classes.push(cell.customClass);
  13295. }
  13296. return classes.join(" ");
  13297. };
  13298. const getDateOfCell = (row, column) => {
  13299. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value;
  13300. return startDate.value.add(offsetFromStart, "day");
  13301. };
  13302. const handleMouseMove = (event) => {
  13303. if (!props.rangeState.selecting)
  13304. return;
  13305. let target = event.target;
  13306. if (target.tagName === "SPAN") {
  13307. target = target.parentNode.parentNode;
  13308. }
  13309. if (target.tagName === "DIV") {
  13310. target = target.parentNode;
  13311. }
  13312. if (target.tagName !== "TD")
  13313. return;
  13314. const row = target.parentNode.rowIndex - 1;
  13315. const column = target.cellIndex;
  13316. if (rows.value[row][column].disabled)
  13317. return;
  13318. if (row !== lastRow.value || column !== lastColumn.value) {
  13319. lastRow.value = row;
  13320. lastColumn.value = column;
  13321. ctx.emit("changerange", {
  13322. selecting: true,
  13323. endDate: getDateOfCell(row, column)
  13324. });
  13325. }
  13326. };
  13327. const handleClick = (event) => {
  13328. let target = event.target;
  13329. while (target) {
  13330. if (target.tagName === "TD") {
  13331. break;
  13332. }
  13333. target = target.parentNode;
  13334. }
  13335. if (!target || target.tagName !== "TD")
  13336. return;
  13337. const row = target.parentNode.rowIndex - 1;
  13338. const column = target.cellIndex;
  13339. const cell = rows.value[row][column];
  13340. if (cell.disabled || cell.type === "week")
  13341. return;
  13342. const newDate = getDateOfCell(row, column);
  13343. if (props.selectionMode === "range") {
  13344. if (!props.rangeState.selecting) {
  13345. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13346. ctx.emit("select", true);
  13347. } else {
  13348. if (newDate >= props.minDate) {
  13349. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13350. } else {
  13351. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13352. }
  13353. ctx.emit("select", false);
  13354. }
  13355. } else if (props.selectionMode === "day") {
  13356. ctx.emit("pick", newDate);
  13357. } else if (props.selectionMode === "week") {
  13358. const weekNumber = newDate.week();
  13359. const value = `${newDate.year()}w${weekNumber}`;
  13360. ctx.emit("pick", {
  13361. year: newDate.year(),
  13362. week: weekNumber,
  13363. value,
  13364. date: newDate.startOf("week")
  13365. });
  13366. } else if (props.selectionMode === "dates") {
  13367. const newValue = cell.selected ? castArray(props.parsedValue).filter((_2) => _2.valueOf() !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  13368. ctx.emit("pick", newValue);
  13369. }
  13370. };
  13371. const isWeekActive = (cell) => {
  13372. if (props.selectionMode !== "week")
  13373. return false;
  13374. let newDate = props.date.startOf("day");
  13375. if (cell.type === "prev-month") {
  13376. newDate = newDate.subtract(1, "month");
  13377. }
  13378. if (cell.type === "next-month") {
  13379. newDate = newDate.add(1, "month");
  13380. }
  13381. newDate = newDate.date(Number.parseInt(cell.text, 10));
  13382. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  13383. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  13384. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  13385. return weekDate.isSame(newDate, "day");
  13386. }
  13387. return false;
  13388. };
  13389. return {
  13390. handleMouseMove,
  13391. t,
  13392. rows,
  13393. isWeekActive,
  13394. getCellClasses,
  13395. WEEKS,
  13396. handleClick
  13397. };
  13398. }
  13399. });
  13400. const _hoisted_1$q = { key: 0 };
  13401. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  13402. const _component_el_date_picker_cell = resolveComponent("el-date-picker-cell");
  13403. return openBlock(), createElementBlock("table", {
  13404. cellspacing: "0",
  13405. cellpadding: "0",
  13406. class: normalizeClass(["el-date-table", { "is-week-mode": _ctx.selectionMode === "week" }]),
  13407. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
  13408. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13409. }, [
  13410. createElementVNode("tbody", null, [
  13411. createElementVNode("tr", null, [
  13412. _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", _hoisted_1$q, toDisplayString(_ctx.t("el.datepicker.week")), 1)) : createCommentVNode("v-if", true),
  13413. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.WEEKS, (week, key) => {
  13414. return openBlock(), createElementBlock("th", { key }, toDisplayString(_ctx.t("el.datepicker.weeks." + week)), 1);
  13415. }), 128))
  13416. ]),
  13417. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13418. return openBlock(), createElementBlock("tr", {
  13419. key,
  13420. class: normalizeClass(["el-date-table__row", { current: _ctx.isWeekActive(row[1]) }])
  13421. }, [
  13422. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13423. return openBlock(), createElementBlock("td", {
  13424. key: key_,
  13425. class: normalizeClass(_ctx.getCellClasses(cell))
  13426. }, [
  13427. createVNode(_component_el_date_picker_cell, { cell }, null, 8, ["cell"])
  13428. ], 2);
  13429. }), 128))
  13430. ], 2);
  13431. }), 128))
  13432. ])
  13433. ], 34);
  13434. }
  13435. 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"]]);
  13436. const datesInMonth = (year, month, lang) => {
  13437. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  13438. const numOfDays = firstDay.daysInMonth();
  13439. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13440. };
  13441. const _sfc_main$C = defineComponent({
  13442. props: {
  13443. disabledDate: {
  13444. type: Function
  13445. },
  13446. selectionMode: {
  13447. type: String,
  13448. default: "month"
  13449. },
  13450. minDate: {
  13451. type: Object
  13452. },
  13453. maxDate: {
  13454. type: Object
  13455. },
  13456. date: {
  13457. type: Object
  13458. },
  13459. parsedValue: {
  13460. type: Object
  13461. },
  13462. rangeState: {
  13463. type: Object,
  13464. default: () => ({
  13465. endDate: null,
  13466. selecting: false
  13467. })
  13468. }
  13469. },
  13470. emits: ["changerange", "pick", "select"],
  13471. setup(props, ctx) {
  13472. const { t, lang } = useLocale();
  13473. const months = ref(props.date.locale("en").localeData().monthsShort().map((_2) => _2.toLowerCase()));
  13474. const tableRows = ref([[], [], []]);
  13475. const lastRow = ref(null);
  13476. const lastColumn = ref(null);
  13477. const rows = computed(() => {
  13478. var _a2;
  13479. const rows2 = tableRows.value;
  13480. const now2 = dayjs().locale(lang.value).startOf("month");
  13481. for (let i = 0; i < 3; i++) {
  13482. const row = rows2[i];
  13483. for (let j = 0; j < 4; j++) {
  13484. let cell = row[j];
  13485. if (!cell) {
  13486. cell = {
  13487. row: i,
  13488. column: j,
  13489. type: "normal",
  13490. inRange: false,
  13491. start: false,
  13492. end: false
  13493. };
  13494. }
  13495. cell.type = "normal";
  13496. const index = i * 4 + j;
  13497. const calTime = props.date.startOf("year").month(index);
  13498. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13499. 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");
  13500. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13501. cell.start = calEndDate && calTime.isSame(calEndDate, "month");
  13502. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  13503. } else {
  13504. cell.start = props.minDate && calTime.isSame(props.minDate, "month");
  13505. cell.end = calEndDate && calTime.isSame(calEndDate, "month");
  13506. }
  13507. const isToday = now2.isSame(calTime);
  13508. if (isToday) {
  13509. cell.type = "today";
  13510. }
  13511. cell.text = index;
  13512. const cellDate = calTime.toDate();
  13513. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13514. row[j] = cell;
  13515. }
  13516. }
  13517. return rows2;
  13518. });
  13519. const getCellStyle = (cell) => {
  13520. const style = {};
  13521. const year = props.date.year();
  13522. const today = new Date();
  13523. const month = cell.text;
  13524. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  13525. style.current = castArray(props.parsedValue).findIndex((date4) => date4.year() === year && date4.month() === month) >= 0;
  13526. style.today = today.getFullYear() === year && today.getMonth() === month;
  13527. if (cell.inRange) {
  13528. style["in-range"] = true;
  13529. if (cell.start) {
  13530. style["start-date"] = true;
  13531. }
  13532. if (cell.end) {
  13533. style["end-date"] = true;
  13534. }
  13535. }
  13536. return style;
  13537. };
  13538. const handleMouseMove = (event) => {
  13539. if (!props.rangeState.selecting)
  13540. return;
  13541. let target = event.target;
  13542. if (target.tagName === "A") {
  13543. target = target.parentNode.parentNode;
  13544. }
  13545. if (target.tagName === "DIV") {
  13546. target = target.parentNode;
  13547. }
  13548. if (target.tagName !== "TD")
  13549. return;
  13550. const row = target.parentNode.rowIndex;
  13551. const column = target.cellIndex;
  13552. if (rows.value[row][column].disabled)
  13553. return;
  13554. if (row !== lastRow.value || column !== lastColumn.value) {
  13555. lastRow.value = row;
  13556. lastColumn.value = column;
  13557. ctx.emit("changerange", {
  13558. selecting: true,
  13559. endDate: props.date.startOf("year").month(row * 4 + column)
  13560. });
  13561. }
  13562. };
  13563. const handleMonthTableClick = (event) => {
  13564. let target = event.target;
  13565. if (target.tagName === "A") {
  13566. target = target.parentNode.parentNode;
  13567. }
  13568. if (target.tagName === "DIV") {
  13569. target = target.parentNode;
  13570. }
  13571. if (target.tagName !== "TD")
  13572. return;
  13573. if (hasClass(target, "disabled"))
  13574. return;
  13575. const column = target.cellIndex;
  13576. const row = target.parentNode.rowIndex;
  13577. const month = row * 4 + column;
  13578. const newDate = props.date.startOf("year").month(month);
  13579. if (props.selectionMode === "range") {
  13580. if (!props.rangeState.selecting) {
  13581. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13582. ctx.emit("select", true);
  13583. } else {
  13584. if (newDate >= props.minDate) {
  13585. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13586. } else {
  13587. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13588. }
  13589. ctx.emit("select", false);
  13590. }
  13591. } else {
  13592. ctx.emit("pick", month);
  13593. }
  13594. };
  13595. return {
  13596. handleMouseMove,
  13597. handleMonthTableClick,
  13598. rows,
  13599. getCellStyle,
  13600. t,
  13601. months
  13602. };
  13603. }
  13604. });
  13605. const _hoisted_1$p = { class: "cell" };
  13606. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  13607. return openBlock(), createElementBlock("table", {
  13608. class: "el-month-table",
  13609. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleMonthTableClick && _ctx.handleMonthTableClick(...args)),
  13610. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13611. }, [
  13612. createElementVNode("tbody", null, [
  13613. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13614. return openBlock(), createElementBlock("tr", { key }, [
  13615. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13616. return openBlock(), createElementBlock("td", {
  13617. key: key_,
  13618. class: normalizeClass(_ctx.getCellStyle(cell))
  13619. }, [
  13620. createElementVNode("div", null, [
  13621. createElementVNode("a", _hoisted_1$p, toDisplayString(_ctx.t("el.datepicker.months." + _ctx.months[cell.text])), 1)
  13622. ])
  13623. ], 2);
  13624. }), 128))
  13625. ]);
  13626. }), 128))
  13627. ])
  13628. ], 32);
  13629. }
  13630. 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"]]);
  13631. const datesInYear = (year, lang) => {
  13632. const firstDay = dayjs(String(year)).locale(lang).startOf("year");
  13633. const lastDay = firstDay.endOf("year");
  13634. const numOfDays = lastDay.dayOfYear();
  13635. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13636. };
  13637. const _sfc_main$B = defineComponent({
  13638. props: {
  13639. disabledDate: {
  13640. type: Function
  13641. },
  13642. parsedValue: {
  13643. type: Object
  13644. },
  13645. date: {
  13646. type: Object
  13647. }
  13648. },
  13649. emits: ["pick"],
  13650. setup(props, ctx) {
  13651. const { lang } = useLocale();
  13652. const startYear = computed(() => {
  13653. return Math.floor(props.date.year() / 10) * 10;
  13654. });
  13655. const getCellStyle = (year) => {
  13656. const style = {};
  13657. const today = dayjs().locale(lang.value);
  13658. style.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  13659. style.current = castArray(props.parsedValue).findIndex((_2) => _2.year() === year) >= 0;
  13660. style.today = today.year() === year;
  13661. return style;
  13662. };
  13663. const handleYearTableClick = (event) => {
  13664. const target = event.target;
  13665. if (target.tagName === "A") {
  13666. if (hasClass(target.parentNode, "disabled"))
  13667. return;
  13668. const year = target.textContent || target.innerText;
  13669. ctx.emit("pick", Number(year));
  13670. }
  13671. };
  13672. return {
  13673. startYear,
  13674. getCellStyle,
  13675. handleYearTableClick
  13676. };
  13677. }
  13678. });
  13679. const _hoisted_1$o = { class: "cell" };
  13680. const _hoisted_2$j = { class: "cell" };
  13681. const _hoisted_3$d = { class: "cell" };
  13682. const _hoisted_4$b = { class: "cell" };
  13683. const _hoisted_5$b = { class: "cell" };
  13684. const _hoisted_6$9 = { class: "cell" };
  13685. const _hoisted_7$6 = { class: "cell" };
  13686. const _hoisted_8$5 = { class: "cell" };
  13687. const _hoisted_9$5 = { class: "cell" };
  13688. const _hoisted_10$5 = { class: "cell" };
  13689. const _hoisted_11$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13690. const _hoisted_12$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13691. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  13692. return openBlock(), createElementBlock("table", {
  13693. class: "el-year-table",
  13694. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleYearTableClick && _ctx.handleYearTableClick(...args))
  13695. }, [
  13696. createElementVNode("tbody", null, [
  13697. createElementVNode("tr", null, [
  13698. createElementVNode("td", {
  13699. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 0)])
  13700. }, [
  13701. createElementVNode("a", _hoisted_1$o, toDisplayString(_ctx.startYear), 1)
  13702. ], 2),
  13703. createElementVNode("td", {
  13704. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 1)])
  13705. }, [
  13706. createElementVNode("a", _hoisted_2$j, toDisplayString(_ctx.startYear + 1), 1)
  13707. ], 2),
  13708. createElementVNode("td", {
  13709. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 2)])
  13710. }, [
  13711. createElementVNode("a", _hoisted_3$d, toDisplayString(_ctx.startYear + 2), 1)
  13712. ], 2),
  13713. createElementVNode("td", {
  13714. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 3)])
  13715. }, [
  13716. createElementVNode("a", _hoisted_4$b, toDisplayString(_ctx.startYear + 3), 1)
  13717. ], 2)
  13718. ]),
  13719. createElementVNode("tr", null, [
  13720. createElementVNode("td", {
  13721. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 4)])
  13722. }, [
  13723. createElementVNode("a", _hoisted_5$b, toDisplayString(_ctx.startYear + 4), 1)
  13724. ], 2),
  13725. createElementVNode("td", {
  13726. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 5)])
  13727. }, [
  13728. createElementVNode("a", _hoisted_6$9, toDisplayString(_ctx.startYear + 5), 1)
  13729. ], 2),
  13730. createElementVNode("td", {
  13731. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 6)])
  13732. }, [
  13733. createElementVNode("a", _hoisted_7$6, toDisplayString(_ctx.startYear + 6), 1)
  13734. ], 2),
  13735. createElementVNode("td", {
  13736. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 7)])
  13737. }, [
  13738. createElementVNode("a", _hoisted_8$5, toDisplayString(_ctx.startYear + 7), 1)
  13739. ], 2)
  13740. ]),
  13741. createElementVNode("tr", null, [
  13742. createElementVNode("td", {
  13743. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 8)])
  13744. }, [
  13745. createElementVNode("a", _hoisted_9$5, toDisplayString(_ctx.startYear + 8), 1)
  13746. ], 2),
  13747. createElementVNode("td", {
  13748. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 9)])
  13749. }, [
  13750. createElementVNode("a", _hoisted_10$5, toDisplayString(_ctx.startYear + 9), 1)
  13751. ], 2),
  13752. _hoisted_11$4,
  13753. _hoisted_12$4
  13754. ])
  13755. ])
  13756. ]);
  13757. }
  13758. 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"]]);
  13759. const timeWithinRange = (_2, __, ___) => true;
  13760. const _sfc_main$A = defineComponent({
  13761. components: {
  13762. DateTable,
  13763. ElInput,
  13764. ElButton,
  13765. ElIcon,
  13766. TimePickPanel,
  13767. MonthTable,
  13768. YearTable,
  13769. DArrowLeft: dArrowLeft,
  13770. ArrowLeft: arrowLeft,
  13771. DArrowRight: dArrowRight,
  13772. ArrowRight: arrowRight
  13773. },
  13774. directives: { clickoutside: ClickOutside },
  13775. props: {
  13776. visible: {
  13777. type: Boolean,
  13778. default: false
  13779. },
  13780. parsedValue: {
  13781. type: [Object, Array]
  13782. },
  13783. format: {
  13784. type: String,
  13785. default: ""
  13786. },
  13787. type: {
  13788. type: String,
  13789. required: true,
  13790. validator: isValidDatePickType
  13791. }
  13792. },
  13793. emits: ["pick", "set-picker-option", "panel-change"],
  13794. setup(props, ctx) {
  13795. const { t, lang } = useLocale();
  13796. const pickerBase = inject("EP_PICKER_BASE");
  13797. const popper2 = inject(TOOLTIP_INJECTION_KEY);
  13798. const {
  13799. shortcuts,
  13800. disabledDate,
  13801. cellClassName,
  13802. defaultTime,
  13803. arrowControl
  13804. } = pickerBase.props;
  13805. const defaultValue = toRef(pickerBase.props, "defaultValue");
  13806. const innerDate = ref(dayjs().locale(lang.value));
  13807. const defaultTimeD = computed(() => {
  13808. return dayjs(defaultTime).locale(lang.value);
  13809. });
  13810. const month = computed(() => {
  13811. return innerDate.value.month();
  13812. });
  13813. const year = computed(() => {
  13814. return innerDate.value.year();
  13815. });
  13816. const selectableRange = ref([]);
  13817. const userInputDate = ref(null);
  13818. const userInputTime = ref(null);
  13819. const checkDateWithinRange = (date4) => {
  13820. return selectableRange.value.length > 0 ? timeWithinRange(date4, selectableRange.value, props.format || "HH:mm:ss") : true;
  13821. };
  13822. const formatEmit = (emitDayjs) => {
  13823. if (defaultTime && !visibleTime.value) {
  13824. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  13825. }
  13826. if (showTime.value)
  13827. return emitDayjs.millisecond(0);
  13828. return emitDayjs.startOf("day");
  13829. };
  13830. const emit = (value, ...args) => {
  13831. if (!value) {
  13832. ctx.emit("pick", value, ...args);
  13833. } else if (Array.isArray(value)) {
  13834. const dates = value.map(formatEmit);
  13835. ctx.emit("pick", dates, ...args);
  13836. } else {
  13837. ctx.emit("pick", formatEmit(value), ...args);
  13838. }
  13839. userInputDate.value = null;
  13840. userInputTime.value = null;
  13841. };
  13842. const handleDatePick = (value) => {
  13843. if (selectionMode.value === "day") {
  13844. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  13845. if (!checkDateWithinRange(newDate)) {
  13846. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  13847. }
  13848. innerDate.value = newDate;
  13849. emit(newDate, showTime.value);
  13850. } else if (selectionMode.value === "week") {
  13851. emit(value.date);
  13852. } else if (selectionMode.value === "dates") {
  13853. emit(value, true);
  13854. }
  13855. };
  13856. const prevMonth_ = () => {
  13857. innerDate.value = innerDate.value.subtract(1, "month");
  13858. handlePanelChange("month");
  13859. };
  13860. const nextMonth_ = () => {
  13861. innerDate.value = innerDate.value.add(1, "month");
  13862. handlePanelChange("month");
  13863. };
  13864. const prevYear_ = () => {
  13865. if (currentView.value === "year") {
  13866. innerDate.value = innerDate.value.subtract(10, "year");
  13867. } else {
  13868. innerDate.value = innerDate.value.subtract(1, "year");
  13869. }
  13870. handlePanelChange("year");
  13871. };
  13872. const nextYear_ = () => {
  13873. if (currentView.value === "year") {
  13874. innerDate.value = innerDate.value.add(10, "year");
  13875. } else {
  13876. innerDate.value = innerDate.value.add(1, "year");
  13877. }
  13878. handlePanelChange("year");
  13879. };
  13880. const currentView = ref("date");
  13881. const yearLabel = computed(() => {
  13882. const yearTranslation = t("el.datepicker.year");
  13883. if (currentView.value === "year") {
  13884. const startYear = Math.floor(year.value / 10) * 10;
  13885. if (yearTranslation) {
  13886. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  13887. }
  13888. return `${startYear} - ${startYear + 9}`;
  13889. }
  13890. return `${year.value} ${yearTranslation}`;
  13891. });
  13892. const handleShortcutClick = (shortcut) => {
  13893. const shortcutValue = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  13894. if (shortcutValue) {
  13895. emit(dayjs(shortcutValue).locale(lang.value));
  13896. return;
  13897. }
  13898. if (shortcut.onClick) {
  13899. shortcut.onClick(ctx);
  13900. }
  13901. };
  13902. const selectionMode = computed(() => {
  13903. if (["week", "month", "year", "dates"].includes(props.type)) {
  13904. return props.type;
  13905. }
  13906. return "day";
  13907. });
  13908. watch(() => selectionMode.value, (val) => {
  13909. if (["month", "year"].includes(val)) {
  13910. currentView.value = val;
  13911. return;
  13912. }
  13913. currentView.value = "date";
  13914. }, { immediate: true });
  13915. watch(() => currentView.value, () => {
  13916. popper2 == null ? void 0 : popper2.updatePopper();
  13917. });
  13918. const hasShortcuts = computed(() => !!shortcuts.length);
  13919. const handleMonthPick = (month2) => {
  13920. innerDate.value = innerDate.value.startOf("month").month(month2);
  13921. if (selectionMode.value === "month") {
  13922. emit(innerDate.value);
  13923. } else {
  13924. currentView.value = "date";
  13925. }
  13926. handlePanelChange("month");
  13927. };
  13928. const handleYearPick = (year2) => {
  13929. if (selectionMode.value === "year") {
  13930. innerDate.value = innerDate.value.startOf("year").year(year2);
  13931. emit(innerDate.value);
  13932. } else {
  13933. innerDate.value = innerDate.value.year(year2);
  13934. currentView.value = "month";
  13935. }
  13936. handlePanelChange("year");
  13937. };
  13938. const showMonthPicker = () => {
  13939. currentView.value = "month";
  13940. };
  13941. const showYearPicker = () => {
  13942. currentView.value = "year";
  13943. };
  13944. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  13945. const footerVisible = computed(() => {
  13946. return showTime.value || selectionMode.value === "dates";
  13947. });
  13948. const onConfirm = () => {
  13949. if (selectionMode.value === "dates") {
  13950. emit(props.parsedValue);
  13951. } else {
  13952. let result = props.parsedValue;
  13953. if (!result) {
  13954. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  13955. const defaultValueD = getDefaultValue();
  13956. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  13957. }
  13958. innerDate.value = result;
  13959. emit(result);
  13960. }
  13961. };
  13962. const changeToNow = () => {
  13963. const now2 = dayjs().locale(lang.value);
  13964. const nowDate = now2.toDate();
  13965. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  13966. innerDate.value = dayjs().locale(lang.value);
  13967. emit(innerDate.value);
  13968. }
  13969. };
  13970. const timeFormat = computed(() => {
  13971. return extractTimeFormat(props.format);
  13972. });
  13973. const dateFormat = computed(() => {
  13974. return extractDateFormat(props.format);
  13975. });
  13976. const visibleTime = computed(() => {
  13977. if (userInputTime.value)
  13978. return userInputTime.value;
  13979. if (!props.parsedValue && !defaultValue.value)
  13980. return;
  13981. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  13982. });
  13983. const visibleDate = computed(() => {
  13984. if (userInputDate.value)
  13985. return userInputDate.value;
  13986. if (!props.parsedValue && !defaultValue.value)
  13987. return;
  13988. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  13989. });
  13990. const timePickerVisible = ref(false);
  13991. const onTimePickerInputFocus = () => {
  13992. timePickerVisible.value = true;
  13993. };
  13994. const handleTimePickClose = () => {
  13995. timePickerVisible.value = false;
  13996. };
  13997. const handleTimePick = (value, visible, first) => {
  13998. const newDate = props.parsedValue ? props.parsedValue.hour(value.hour()).minute(value.minute()).second(value.second()) : value;
  13999. innerDate.value = newDate;
  14000. emit(innerDate.value, true);
  14001. if (!first) {
  14002. timePickerVisible.value = visible;
  14003. }
  14004. };
  14005. const handleVisibleTimeChange = (value) => {
  14006. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  14007. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  14008. innerDate.value = newDate.year(innerDate.value.year()).month(innerDate.value.month()).date(innerDate.value.date());
  14009. userInputTime.value = null;
  14010. timePickerVisible.value = false;
  14011. emit(innerDate.value, true);
  14012. }
  14013. };
  14014. const handleVisibleDateChange = (value) => {
  14015. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  14016. if (newDate.isValid()) {
  14017. if (disabledDate && disabledDate(newDate.toDate())) {
  14018. return;
  14019. }
  14020. innerDate.value = newDate.hour(innerDate.value.hour()).minute(innerDate.value.minute()).second(innerDate.value.second());
  14021. userInputDate.value = null;
  14022. emit(innerDate.value, true);
  14023. }
  14024. };
  14025. const isValidValue = (date4) => {
  14026. return dayjs.isDayjs(date4) && date4.isValid() && (disabledDate ? !disabledDate(date4.toDate()) : true);
  14027. };
  14028. const formatToString = (value) => {
  14029. if (selectionMode.value === "dates") {
  14030. return value.map((_2) => _2.format(props.format));
  14031. }
  14032. return value.format(props.format);
  14033. };
  14034. const parseUserInput = (value) => {
  14035. return dayjs(value, props.format).locale(lang.value);
  14036. };
  14037. const getDefaultValue = () => {
  14038. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  14039. if (!defaultValue.value) {
  14040. const defaultTimeDValue = defaultTimeD.value;
  14041. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  14042. }
  14043. return parseDate;
  14044. };
  14045. const handleKeydown = (event) => {
  14046. const { code, keyCode } = event;
  14047. const list = [
  14048. EVENT_CODE.up,
  14049. EVENT_CODE.down,
  14050. EVENT_CODE.left,
  14051. EVENT_CODE.right
  14052. ];
  14053. if (props.visible && !timePickerVisible.value) {
  14054. if (list.includes(code)) {
  14055. handleKeyControl(keyCode);
  14056. event.stopPropagation();
  14057. event.preventDefault();
  14058. }
  14059. if (code === EVENT_CODE.enter && userInputDate.value === null && userInputTime.value === null) {
  14060. emit(innerDate, false);
  14061. }
  14062. }
  14063. };
  14064. const handleKeyControl = (keyCode) => {
  14065. const mapping = {
  14066. year: {
  14067. 38: -4,
  14068. 40: 4,
  14069. 37: -1,
  14070. 39: 1,
  14071. offset: (date4, step) => date4.setFullYear(date4.getFullYear() + step)
  14072. },
  14073. month: {
  14074. 38: -4,
  14075. 40: 4,
  14076. 37: -1,
  14077. 39: 1,
  14078. offset: (date4, step) => date4.setMonth(date4.getMonth() + step)
  14079. },
  14080. week: {
  14081. 38: -1,
  14082. 40: 1,
  14083. 37: -1,
  14084. 39: 1,
  14085. offset: (date4, step) => date4.setDate(date4.getDate() + step * 7)
  14086. },
  14087. day: {
  14088. 38: -7,
  14089. 40: 7,
  14090. 37: -1,
  14091. 39: 1,
  14092. offset: (date4, step) => date4.setDate(date4.getDate() + step)
  14093. }
  14094. };
  14095. const newDate = innerDate.value.toDate();
  14096. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  14097. const map = mapping[selectionMode.value];
  14098. map.offset(newDate, map[keyCode]);
  14099. if (disabledDate && disabledDate(newDate)) {
  14100. continue;
  14101. }
  14102. const result = dayjs(newDate).locale(lang.value);
  14103. innerDate.value = result;
  14104. ctx.emit("pick", result, true);
  14105. break;
  14106. }
  14107. };
  14108. const handlePanelChange = (mode) => {
  14109. ctx.emit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  14110. };
  14111. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14112. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14113. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14114. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  14115. watch(() => defaultValue.value, (val) => {
  14116. if (val) {
  14117. innerDate.value = getDefaultValue();
  14118. }
  14119. }, { immediate: true });
  14120. watch(() => props.parsedValue, (val) => {
  14121. if (val) {
  14122. if (selectionMode.value === "dates")
  14123. return;
  14124. if (Array.isArray(val))
  14125. return;
  14126. innerDate.value = val;
  14127. } else {
  14128. innerDate.value = getDefaultValue();
  14129. }
  14130. }, { immediate: true });
  14131. return {
  14132. handleTimePick,
  14133. handleTimePickClose,
  14134. onTimePickerInputFocus,
  14135. timePickerVisible,
  14136. visibleTime,
  14137. visibleDate,
  14138. showTime,
  14139. changeToNow,
  14140. onConfirm,
  14141. footerVisible,
  14142. handleYearPick,
  14143. showMonthPicker,
  14144. showYearPicker,
  14145. handleMonthPick,
  14146. hasShortcuts,
  14147. shortcuts,
  14148. arrowControl,
  14149. disabledDate,
  14150. cellClassName,
  14151. selectionMode,
  14152. handleShortcutClick,
  14153. prevYear_,
  14154. nextYear_,
  14155. prevMonth_,
  14156. nextMonth_,
  14157. innerDate,
  14158. t,
  14159. yearLabel,
  14160. currentView,
  14161. month,
  14162. handleDatePick,
  14163. handleVisibleTimeChange,
  14164. handleVisibleDateChange,
  14165. timeFormat,
  14166. userInputTime,
  14167. userInputDate
  14168. };
  14169. }
  14170. });
  14171. const _hoisted_1$n = { class: "el-picker-panel__body-wrapper" };
  14172. const _hoisted_2$i = {
  14173. key: 0,
  14174. class: "el-picker-panel__sidebar"
  14175. };
  14176. const _hoisted_3$c = ["onClick"];
  14177. const _hoisted_4$a = { class: "el-picker-panel__body" };
  14178. const _hoisted_5$a = {
  14179. key: 0,
  14180. class: "el-date-picker__time-header"
  14181. };
  14182. const _hoisted_6$8 = { class: "el-date-picker__editor-wrap" };
  14183. const _hoisted_7$5 = { class: "el-date-picker__editor-wrap" };
  14184. const _hoisted_8$4 = ["aria-label"];
  14185. const _hoisted_9$4 = ["aria-label"];
  14186. const _hoisted_10$4 = ["aria-label"];
  14187. const _hoisted_11$3 = ["aria-label"];
  14188. const _hoisted_12$3 = { class: "el-picker-panel__content" };
  14189. const _hoisted_13$3 = { class: "el-picker-panel__footer" };
  14190. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  14191. const _component_el_input = resolveComponent("el-input");
  14192. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14193. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14194. const _component_el_icon = resolveComponent("el-icon");
  14195. const _component_arrow_left = resolveComponent("arrow-left");
  14196. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14197. const _component_arrow_right = resolveComponent("arrow-right");
  14198. const _component_date_table = resolveComponent("date-table");
  14199. const _component_year_table = resolveComponent("year-table");
  14200. const _component_month_table = resolveComponent("month-table");
  14201. const _component_el_button = resolveComponent("el-button");
  14202. const _directive_clickoutside = resolveDirective("clickoutside");
  14203. return openBlock(), createElementBlock("div", {
  14204. class: normalizeClass(["el-picker-panel el-date-picker", [
  14205. {
  14206. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  14207. "has-time": _ctx.showTime
  14208. }
  14209. ]])
  14210. }, [
  14211. createElementVNode("div", _hoisted_1$n, [
  14212. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  14213. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
  14214. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  14215. return openBlock(), createElementBlock("button", {
  14216. key,
  14217. type: "button",
  14218. class: "el-picker-panel__shortcut",
  14219. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  14220. }, toDisplayString(shortcut.text), 9, _hoisted_3$c);
  14221. }), 128))
  14222. ])) : createCommentVNode("v-if", true),
  14223. createElementVNode("div", _hoisted_4$a, [
  14224. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$a, [
  14225. createElementVNode("span", _hoisted_6$8, [
  14226. createVNode(_component_el_input, {
  14227. placeholder: _ctx.t("el.datepicker.selectDate"),
  14228. "model-value": _ctx.visibleDate,
  14229. size: "small",
  14230. onInput: _cache[0] || (_cache[0] = (val) => _ctx.userInputDate = val),
  14231. onChange: _ctx.handleVisibleDateChange
  14232. }, null, 8, ["placeholder", "model-value", "onChange"])
  14233. ]),
  14234. withDirectives((openBlock(), createElementBlock("span", _hoisted_7$5, [
  14235. createVNode(_component_el_input, {
  14236. placeholder: _ctx.t("el.datepicker.selectTime"),
  14237. "model-value": _ctx.visibleTime,
  14238. size: "small",
  14239. onFocus: _ctx.onTimePickerInputFocus,
  14240. onInput: _cache[1] || (_cache[1] = (val) => _ctx.userInputTime = val),
  14241. onChange: _ctx.handleVisibleTimeChange
  14242. }, null, 8, ["placeholder", "model-value", "onFocus", "onChange"]),
  14243. createVNode(_component_time_pick_panel, {
  14244. visible: _ctx.timePickerVisible,
  14245. format: _ctx.timeFormat,
  14246. "time-arrow-control": _ctx.arrowControl,
  14247. "parsed-value": _ctx.innerDate,
  14248. onPick: _ctx.handleTimePick
  14249. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14250. ])), [
  14251. [_directive_clickoutside, _ctx.handleTimePickClose]
  14252. ])
  14253. ])) : createCommentVNode("v-if", true),
  14254. withDirectives(createElementVNode("div", {
  14255. class: normalizeClass(["el-date-picker__header", {
  14256. "el-date-picker__header--bordered": _ctx.currentView === "year" || _ctx.currentView === "month"
  14257. }])
  14258. }, [
  14259. createElementVNode("button", {
  14260. type: "button",
  14261. "aria-label": _ctx.t(`el.datepicker.prevYear`),
  14262. class: "el-picker-panel__icon-btn el-date-picker__prev-btn d-arrow-left",
  14263. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.prevYear_ && _ctx.prevYear_(...args))
  14264. }, [
  14265. createVNode(_component_el_icon, null, {
  14266. default: withCtx(() => [
  14267. createVNode(_component_d_arrow_left)
  14268. ]),
  14269. _: 1
  14270. })
  14271. ], 8, _hoisted_8$4),
  14272. withDirectives(createElementVNode("button", {
  14273. type: "button",
  14274. "aria-label": _ctx.t(`el.datepicker.prevMonth`),
  14275. class: "el-picker-panel__icon-btn el-date-picker__prev-btn arrow-left",
  14276. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.prevMonth_ && _ctx.prevMonth_(...args))
  14277. }, [
  14278. createVNode(_component_el_icon, null, {
  14279. default: withCtx(() => [
  14280. createVNode(_component_arrow_left)
  14281. ]),
  14282. _: 1
  14283. })
  14284. ], 8, _hoisted_9$4), [
  14285. [vShow, _ctx.currentView === "date"]
  14286. ]),
  14287. createElementVNode("span", {
  14288. role: "button",
  14289. class: "el-date-picker__header-label",
  14290. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showYearPicker && _ctx.showYearPicker(...args))
  14291. }, toDisplayString(_ctx.yearLabel), 1),
  14292. withDirectives(createElementVNode("span", {
  14293. role: "button",
  14294. class: normalizeClass(["el-date-picker__header-label", { active: _ctx.currentView === "month" }]),
  14295. onClick: _cache[5] || (_cache[5] = (...args) => _ctx.showMonthPicker && _ctx.showMonthPicker(...args))
  14296. }, toDisplayString(_ctx.t(`el.datepicker.month${_ctx.month + 1}`)), 3), [
  14297. [vShow, _ctx.currentView === "date"]
  14298. ]),
  14299. createElementVNode("button", {
  14300. type: "button",
  14301. "aria-label": _ctx.t(`el.datepicker.nextYear`),
  14302. class: "el-picker-panel__icon-btn el-date-picker__next-btn d-arrow-right",
  14303. onClick: _cache[6] || (_cache[6] = (...args) => _ctx.nextYear_ && _ctx.nextYear_(...args))
  14304. }, [
  14305. createVNode(_component_el_icon, null, {
  14306. default: withCtx(() => [
  14307. createVNode(_component_d_arrow_right)
  14308. ]),
  14309. _: 1
  14310. })
  14311. ], 8, _hoisted_10$4),
  14312. withDirectives(createElementVNode("button", {
  14313. type: "button",
  14314. "aria-label": _ctx.t(`el.datepicker.nextMonth`),
  14315. class: "el-picker-panel__icon-btn el-date-picker__next-btn arrow-right",
  14316. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.nextMonth_ && _ctx.nextMonth_(...args))
  14317. }, [
  14318. createVNode(_component_el_icon, null, {
  14319. default: withCtx(() => [
  14320. createVNode(_component_arrow_right)
  14321. ]),
  14322. _: 1
  14323. })
  14324. ], 8, _hoisted_11$3), [
  14325. [vShow, _ctx.currentView === "date"]
  14326. ])
  14327. ], 2), [
  14328. [vShow, _ctx.currentView !== "time"]
  14329. ]),
  14330. createElementVNode("div", _hoisted_12$3, [
  14331. _ctx.currentView === "date" ? (openBlock(), createBlock(_component_date_table, {
  14332. key: 0,
  14333. "selection-mode": _ctx.selectionMode,
  14334. date: _ctx.innerDate,
  14335. "parsed-value": _ctx.parsedValue,
  14336. "disabled-date": _ctx.disabledDate,
  14337. "cell-class-name": _ctx.cellClassName,
  14338. onPick: _ctx.handleDatePick
  14339. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name", "onPick"])) : createCommentVNode("v-if", true),
  14340. _ctx.currentView === "year" ? (openBlock(), createBlock(_component_year_table, {
  14341. key: 1,
  14342. date: _ctx.innerDate,
  14343. "disabled-date": _ctx.disabledDate,
  14344. "parsed-value": _ctx.parsedValue,
  14345. onPick: _ctx.handleYearPick
  14346. }, null, 8, ["date", "disabled-date", "parsed-value", "onPick"])) : createCommentVNode("v-if", true),
  14347. _ctx.currentView === "month" ? (openBlock(), createBlock(_component_month_table, {
  14348. key: 2,
  14349. date: _ctx.innerDate,
  14350. "parsed-value": _ctx.parsedValue,
  14351. "disabled-date": _ctx.disabledDate,
  14352. onPick: _ctx.handleMonthPick
  14353. }, null, 8, ["date", "parsed-value", "disabled-date", "onPick"])) : createCommentVNode("v-if", true)
  14354. ])
  14355. ])
  14356. ]),
  14357. withDirectives(createElementVNode("div", _hoisted_13$3, [
  14358. withDirectives(createVNode(_component_el_button, {
  14359. size: "small",
  14360. type: "text",
  14361. class: "el-picker-panel__link-btn",
  14362. onClick: _ctx.changeToNow
  14363. }, {
  14364. default: withCtx(() => [
  14365. createTextVNode(toDisplayString(_ctx.t("el.datepicker.now")), 1)
  14366. ]),
  14367. _: 1
  14368. }, 8, ["onClick"]), [
  14369. [vShow, _ctx.selectionMode !== "dates"]
  14370. ]),
  14371. createVNode(_component_el_button, {
  14372. plain: "",
  14373. size: "small",
  14374. class: "el-picker-panel__link-btn",
  14375. onClick: _ctx.onConfirm
  14376. }, {
  14377. default: withCtx(() => [
  14378. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  14379. ]),
  14380. _: 1
  14381. }, 8, ["onClick"])
  14382. ], 512), [
  14383. [vShow, _ctx.footerVisible && _ctx.currentView === "date"]
  14384. ])
  14385. ], 2);
  14386. }
  14387. 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"]]);
  14388. const _sfc_main$z = defineComponent({
  14389. directives: { clickoutside: ClickOutside },
  14390. components: {
  14391. TimePickPanel,
  14392. DateTable,
  14393. ElInput,
  14394. ElButton,
  14395. ElIcon,
  14396. DArrowLeft: dArrowLeft,
  14397. ArrowLeft: arrowLeft,
  14398. DArrowRight: dArrowRight,
  14399. ArrowRight: arrowRight
  14400. },
  14401. props: {
  14402. unlinkPanels: Boolean,
  14403. parsedValue: {
  14404. type: Array
  14405. },
  14406. type: {
  14407. type: String,
  14408. required: true,
  14409. validator: isValidDatePickType
  14410. }
  14411. },
  14412. emits: ["pick", "set-picker-option", "calendar-change", "panel-change"],
  14413. setup(props, ctx) {
  14414. const { t, lang } = useLocale();
  14415. const leftDate = ref(dayjs().locale(lang.value));
  14416. const rightDate = ref(dayjs().locale(lang.value).add(1, "month"));
  14417. const minDate = ref(null);
  14418. const maxDate = ref(null);
  14419. const dateUserInput = ref({
  14420. min: null,
  14421. max: null
  14422. });
  14423. const timeUserInput = ref({
  14424. min: null,
  14425. max: null
  14426. });
  14427. const leftLabel = computed(() => {
  14428. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  14429. });
  14430. const rightLabel = computed(() => {
  14431. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  14432. });
  14433. const leftYear = computed(() => {
  14434. return leftDate.value.year();
  14435. });
  14436. const leftMonth = computed(() => {
  14437. return leftDate.value.month();
  14438. });
  14439. const rightYear = computed(() => {
  14440. return rightDate.value.year();
  14441. });
  14442. const rightMonth = computed(() => {
  14443. return rightDate.value.month();
  14444. });
  14445. const hasShortcuts = computed(() => !!shortcuts.length);
  14446. const minVisibleDate = computed(() => {
  14447. if (dateUserInput.value.min !== null)
  14448. return dateUserInput.value.min;
  14449. if (minDate.value)
  14450. return minDate.value.format(dateFormat.value);
  14451. return "";
  14452. });
  14453. const maxVisibleDate = computed(() => {
  14454. if (dateUserInput.value.max !== null)
  14455. return dateUserInput.value.max;
  14456. if (maxDate.value || minDate.value)
  14457. return (maxDate.value || minDate.value).format(dateFormat.value);
  14458. return "";
  14459. });
  14460. const minVisibleTime = computed(() => {
  14461. if (timeUserInput.value.min !== null)
  14462. return timeUserInput.value.min;
  14463. if (minDate.value)
  14464. return minDate.value.format(timeFormat.value);
  14465. return "";
  14466. });
  14467. const maxVisibleTime = computed(() => {
  14468. if (timeUserInput.value.max !== null)
  14469. return timeUserInput.value.max;
  14470. if (maxDate.value || minDate.value)
  14471. return (maxDate.value || minDate.value).format(timeFormat.value);
  14472. return "";
  14473. });
  14474. const timeFormat = computed(() => {
  14475. return extractTimeFormat(format2);
  14476. });
  14477. const dateFormat = computed(() => {
  14478. return extractDateFormat(format2);
  14479. });
  14480. const leftPrevYear = () => {
  14481. leftDate.value = leftDate.value.subtract(1, "year");
  14482. if (!props.unlinkPanels) {
  14483. rightDate.value = leftDate.value.add(1, "month");
  14484. }
  14485. handlePanelChange("year");
  14486. };
  14487. const leftPrevMonth = () => {
  14488. leftDate.value = leftDate.value.subtract(1, "month");
  14489. if (!props.unlinkPanels) {
  14490. rightDate.value = leftDate.value.add(1, "month");
  14491. }
  14492. handlePanelChange("month");
  14493. };
  14494. const rightNextYear = () => {
  14495. if (!props.unlinkPanels) {
  14496. leftDate.value = leftDate.value.add(1, "year");
  14497. rightDate.value = leftDate.value.add(1, "month");
  14498. } else {
  14499. rightDate.value = rightDate.value.add(1, "year");
  14500. }
  14501. handlePanelChange("year");
  14502. };
  14503. const rightNextMonth = () => {
  14504. if (!props.unlinkPanels) {
  14505. leftDate.value = leftDate.value.add(1, "month");
  14506. rightDate.value = leftDate.value.add(1, "month");
  14507. } else {
  14508. rightDate.value = rightDate.value.add(1, "month");
  14509. }
  14510. handlePanelChange("month");
  14511. };
  14512. const leftNextYear = () => {
  14513. leftDate.value = leftDate.value.add(1, "year");
  14514. handlePanelChange("year");
  14515. };
  14516. const leftNextMonth = () => {
  14517. leftDate.value = leftDate.value.add(1, "month");
  14518. handlePanelChange("month");
  14519. };
  14520. const rightPrevYear = () => {
  14521. rightDate.value = rightDate.value.subtract(1, "year");
  14522. handlePanelChange("year");
  14523. };
  14524. const rightPrevMonth = () => {
  14525. rightDate.value = rightDate.value.subtract(1, "month");
  14526. handlePanelChange("month");
  14527. };
  14528. const handlePanelChange = (mode) => {
  14529. ctx.emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  14530. };
  14531. const enableMonthArrow = computed(() => {
  14532. const nextMonth = (leftMonth.value + 1) % 12;
  14533. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  14534. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  14535. });
  14536. const enableYearArrow = computed(() => {
  14537. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  14538. });
  14539. const isValidValue = (value) => {
  14540. return Array.isArray(value) && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  14541. };
  14542. const rangeState = ref({
  14543. endDate: null,
  14544. selecting: false
  14545. });
  14546. const btnDisabled = computed(() => {
  14547. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidValue([minDate.value, maxDate.value]));
  14548. });
  14549. const handleChangeRange = (val) => {
  14550. rangeState.value = val;
  14551. };
  14552. const onSelect = (selecting) => {
  14553. rangeState.value.selecting = selecting;
  14554. if (!selecting) {
  14555. rangeState.value.endDate = null;
  14556. }
  14557. };
  14558. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  14559. const handleConfirm = (visible = false) => {
  14560. if (isValidValue([minDate.value, maxDate.value])) {
  14561. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  14562. }
  14563. };
  14564. const formatEmit = (emitDayjs, index) => {
  14565. if (!emitDayjs)
  14566. return;
  14567. if (defaultTime) {
  14568. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  14569. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  14570. }
  14571. return emitDayjs;
  14572. };
  14573. const handleRangePick = (val, close2 = true) => {
  14574. const min_ = val.minDate;
  14575. const max_ = val.maxDate;
  14576. const minDate_ = formatEmit(min_, 0);
  14577. const maxDate_ = formatEmit(max_, 1);
  14578. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  14579. return;
  14580. }
  14581. ctx.emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  14582. maxDate.value = maxDate_;
  14583. minDate.value = minDate_;
  14584. if (!close2 || showTime.value)
  14585. return;
  14586. handleConfirm();
  14587. };
  14588. const handleShortcutClick = (shortcut) => {
  14589. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  14590. if (shortcutValues) {
  14591. ctx.emit("pick", [
  14592. dayjs(shortcutValues[0]).locale(lang.value),
  14593. dayjs(shortcutValues[1]).locale(lang.value)
  14594. ]);
  14595. return;
  14596. }
  14597. if (shortcut.onClick) {
  14598. shortcut.onClick(ctx);
  14599. }
  14600. };
  14601. const minTimePickerVisible = ref(false);
  14602. const maxTimePickerVisible = ref(false);
  14603. const handleMinTimeClose = () => {
  14604. minTimePickerVisible.value = false;
  14605. };
  14606. const handleMaxTimeClose = () => {
  14607. maxTimePickerVisible.value = false;
  14608. };
  14609. const handleDateInput = (value, type4) => {
  14610. dateUserInput.value[type4] = value;
  14611. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  14612. if (parsedValueD.isValid()) {
  14613. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  14614. return;
  14615. }
  14616. if (type4 === "min") {
  14617. leftDate.value = parsedValueD;
  14618. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14619. if (!props.unlinkPanels) {
  14620. rightDate.value = parsedValueD.add(1, "month");
  14621. maxDate.value = minDate.value.add(1, "month");
  14622. }
  14623. } else {
  14624. rightDate.value = parsedValueD;
  14625. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14626. if (!props.unlinkPanels) {
  14627. leftDate.value = parsedValueD.subtract(1, "month");
  14628. minDate.value = maxDate.value.subtract(1, "month");
  14629. }
  14630. }
  14631. }
  14632. };
  14633. const handleDateChange = (_2, type4) => {
  14634. dateUserInput.value[type4] = null;
  14635. };
  14636. const handleTimeInput = (value, type4) => {
  14637. timeUserInput.value[type4] = value;
  14638. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  14639. if (parsedValueD.isValid()) {
  14640. if (type4 === "min") {
  14641. minTimePickerVisible.value = true;
  14642. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14643. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14644. maxDate.value = minDate.value;
  14645. }
  14646. } else {
  14647. maxTimePickerVisible.value = true;
  14648. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14649. rightDate.value = maxDate.value;
  14650. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14651. minDate.value = maxDate.value;
  14652. }
  14653. }
  14654. }
  14655. };
  14656. const handleTimeChange = (value, type4) => {
  14657. timeUserInput.value[type4] = null;
  14658. if (type4 === "min") {
  14659. leftDate.value = minDate.value;
  14660. minTimePickerVisible.value = false;
  14661. } else {
  14662. rightDate.value = maxDate.value;
  14663. maxTimePickerVisible.value = false;
  14664. }
  14665. };
  14666. const handleMinTimePick = (value, visible, first) => {
  14667. if (timeUserInput.value.min)
  14668. return;
  14669. if (value) {
  14670. leftDate.value = value;
  14671. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14672. }
  14673. if (!first) {
  14674. minTimePickerVisible.value = visible;
  14675. }
  14676. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14677. maxDate.value = minDate.value;
  14678. rightDate.value = value;
  14679. }
  14680. };
  14681. const handleMaxTimePick = (value, visible, first) => {
  14682. if (timeUserInput.value.max)
  14683. return;
  14684. if (value) {
  14685. rightDate.value = value;
  14686. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14687. }
  14688. if (!first) {
  14689. maxTimePickerVisible.value = visible;
  14690. }
  14691. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14692. minDate.value = maxDate.value;
  14693. }
  14694. };
  14695. const handleClear = () => {
  14696. leftDate.value = getDefaultValue()[0];
  14697. rightDate.value = leftDate.value.add(1, "month");
  14698. ctx.emit("pick", null);
  14699. };
  14700. const formatToString = (value) => {
  14701. return Array.isArray(value) ? value.map((_2) => _2.format(format2)) : value.format(format2);
  14702. };
  14703. const parseUserInput = (value) => {
  14704. return Array.isArray(value) ? value.map((_2) => dayjs(_2, format2).locale(lang.value)) : dayjs(value, format2).locale(lang.value);
  14705. };
  14706. const getDefaultValue = () => {
  14707. let start2;
  14708. if (Array.isArray(defaultValue.value)) {
  14709. const left2 = dayjs(defaultValue.value[0]);
  14710. let right2 = dayjs(defaultValue.value[1]);
  14711. if (!props.unlinkPanels) {
  14712. right2 = left2.add(1, "month");
  14713. }
  14714. return [left2, right2];
  14715. } else if (defaultValue.value) {
  14716. start2 = dayjs(defaultValue.value);
  14717. } else {
  14718. start2 = dayjs();
  14719. }
  14720. start2 = start2.locale(lang.value);
  14721. return [start2, start2.add(1, "month")];
  14722. };
  14723. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14724. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14725. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14726. ctx.emit("set-picker-option", ["handleClear", handleClear]);
  14727. const pickerBase = inject("EP_PICKER_BASE");
  14728. const {
  14729. shortcuts,
  14730. disabledDate,
  14731. cellClassName,
  14732. format: format2,
  14733. defaultTime,
  14734. arrowControl,
  14735. clearable
  14736. } = pickerBase.props;
  14737. const defaultValue = toRef(pickerBase.props, "defaultValue");
  14738. watch(() => defaultValue.value, (val) => {
  14739. if (val) {
  14740. const defaultArr = getDefaultValue();
  14741. minDate.value = null;
  14742. maxDate.value = null;
  14743. leftDate.value = defaultArr[0];
  14744. rightDate.value = defaultArr[1];
  14745. }
  14746. }, { immediate: true });
  14747. watch(() => props.parsedValue, (newVal) => {
  14748. if (newVal && newVal.length === 2) {
  14749. minDate.value = newVal[0];
  14750. maxDate.value = newVal[1];
  14751. leftDate.value = minDate.value;
  14752. if (props.unlinkPanels && maxDate.value) {
  14753. const minDateYear = minDate.value.year();
  14754. const minDateMonth = minDate.value.month();
  14755. const maxDateYear = maxDate.value.year();
  14756. const maxDateMonth = maxDate.value.month();
  14757. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate.value.add(1, "month") : maxDate.value;
  14758. } else {
  14759. rightDate.value = leftDate.value.add(1, "month");
  14760. if (maxDate.value) {
  14761. rightDate.value = rightDate.value.hour(maxDate.value.hour()).minute(maxDate.value.minute()).second(maxDate.value.second());
  14762. }
  14763. }
  14764. } else {
  14765. const defaultArr = getDefaultValue();
  14766. minDate.value = null;
  14767. maxDate.value = null;
  14768. leftDate.value = defaultArr[0];
  14769. rightDate.value = defaultArr[1];
  14770. }
  14771. }, { immediate: true });
  14772. return {
  14773. shortcuts,
  14774. disabledDate,
  14775. cellClassName,
  14776. minTimePickerVisible,
  14777. maxTimePickerVisible,
  14778. handleMinTimeClose,
  14779. handleMaxTimeClose,
  14780. handleShortcutClick,
  14781. rangeState,
  14782. minDate,
  14783. maxDate,
  14784. handleRangePick,
  14785. onSelect,
  14786. handleChangeRange,
  14787. btnDisabled,
  14788. enableYearArrow,
  14789. enableMonthArrow,
  14790. rightPrevMonth,
  14791. rightPrevYear,
  14792. rightNextMonth,
  14793. rightNextYear,
  14794. leftPrevMonth,
  14795. leftPrevYear,
  14796. leftNextMonth,
  14797. leftNextYear,
  14798. hasShortcuts,
  14799. leftLabel,
  14800. rightLabel,
  14801. leftDate,
  14802. rightDate,
  14803. showTime,
  14804. t,
  14805. minVisibleDate,
  14806. maxVisibleDate,
  14807. minVisibleTime,
  14808. maxVisibleTime,
  14809. arrowControl,
  14810. handleDateInput,
  14811. handleDateChange,
  14812. handleTimeInput,
  14813. handleTimeChange,
  14814. handleMinTimePick,
  14815. handleMaxTimePick,
  14816. handleClear,
  14817. handleConfirm,
  14818. timeFormat,
  14819. clearable
  14820. };
  14821. }
  14822. });
  14823. const _hoisted_1$m = { class: "el-picker-panel__body-wrapper" };
  14824. const _hoisted_2$h = {
  14825. key: 0,
  14826. class: "el-picker-panel__sidebar"
  14827. };
  14828. const _hoisted_3$b = ["onClick"];
  14829. const _hoisted_4$9 = { class: "el-picker-panel__body" };
  14830. const _hoisted_5$9 = {
  14831. key: 0,
  14832. class: "el-date-range-picker__time-header"
  14833. };
  14834. const _hoisted_6$7 = { class: "el-date-range-picker__editors-wrap" };
  14835. const _hoisted_7$4 = { class: "el-date-range-picker__time-picker-wrap" };
  14836. const _hoisted_8$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14837. const _hoisted_9$3 = { class: "el-date-range-picker__editors-wrap is-right" };
  14838. const _hoisted_10$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14839. const _hoisted_11$2 = { class: "el-date-range-picker__time-picker-wrap" };
  14840. const _hoisted_12$2 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  14841. const _hoisted_13$2 = { class: "el-date-range-picker__header" };
  14842. const _hoisted_14$2 = ["disabled"];
  14843. const _hoisted_15$1 = ["disabled"];
  14844. const _hoisted_16$1 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  14845. const _hoisted_17$1 = { class: "el-date-range-picker__header" };
  14846. const _hoisted_18$1 = ["disabled"];
  14847. const _hoisted_19$1 = ["disabled"];
  14848. const _hoisted_20$1 = {
  14849. key: 0,
  14850. class: "el-picker-panel__footer"
  14851. };
  14852. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  14853. const _component_el_input = resolveComponent("el-input");
  14854. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14855. const _component_arrow_right = resolveComponent("arrow-right");
  14856. const _component_el_icon = resolveComponent("el-icon");
  14857. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14858. const _component_arrow_left = resolveComponent("arrow-left");
  14859. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14860. const _component_date_table = resolveComponent("date-table");
  14861. const _component_el_button = resolveComponent("el-button");
  14862. const _directive_clickoutside = resolveDirective("clickoutside");
  14863. return openBlock(), createElementBlock("div", {
  14864. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  14865. {
  14866. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  14867. "has-time": _ctx.showTime
  14868. }
  14869. ]])
  14870. }, [
  14871. createElementVNode("div", _hoisted_1$m, [
  14872. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  14873. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$h, [
  14874. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  14875. return openBlock(), createElementBlock("button", {
  14876. key,
  14877. type: "button",
  14878. class: "el-picker-panel__shortcut",
  14879. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  14880. }, toDisplayString(shortcut.text), 9, _hoisted_3$b);
  14881. }), 128))
  14882. ])) : createCommentVNode("v-if", true),
  14883. createElementVNode("div", _hoisted_4$9, [
  14884. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$9, [
  14885. createElementVNode("span", _hoisted_6$7, [
  14886. createElementVNode("span", _hoisted_7$4, [
  14887. createVNode(_component_el_input, {
  14888. size: "small",
  14889. disabled: _ctx.rangeState.selecting,
  14890. placeholder: _ctx.t("el.datepicker.startDate"),
  14891. class: "el-date-range-picker__editor",
  14892. "model-value": _ctx.minVisibleDate,
  14893. onInput: _cache[0] || (_cache[0] = (val) => _ctx.handleDateInput(val, "min")),
  14894. onChange: _cache[1] || (_cache[1] = (val) => _ctx.handleDateChange(val, "min"))
  14895. }, null, 8, ["disabled", "placeholder", "model-value"])
  14896. ]),
  14897. withDirectives((openBlock(), createElementBlock("span", _hoisted_8$3, [
  14898. createVNode(_component_el_input, {
  14899. size: "small",
  14900. class: "el-date-range-picker__editor",
  14901. disabled: _ctx.rangeState.selecting,
  14902. placeholder: _ctx.t("el.datepicker.startTime"),
  14903. "model-value": _ctx.minVisibleTime,
  14904. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.minTimePickerVisible = true),
  14905. onInput: _cache[3] || (_cache[3] = (val) => _ctx.handleTimeInput(val, "min")),
  14906. onChange: _cache[4] || (_cache[4] = (val) => _ctx.handleTimeChange(val, "min"))
  14907. }, null, 8, ["disabled", "placeholder", "model-value"]),
  14908. createVNode(_component_time_pick_panel, {
  14909. visible: _ctx.minTimePickerVisible,
  14910. format: _ctx.timeFormat,
  14911. "datetime-role": "start",
  14912. "time-arrow-control": _ctx.arrowControl,
  14913. "parsed-value": _ctx.leftDate,
  14914. onPick: _ctx.handleMinTimePick
  14915. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14916. ])), [
  14917. [_directive_clickoutside, _ctx.handleMinTimeClose]
  14918. ])
  14919. ]),
  14920. createElementVNode("span", null, [
  14921. createVNode(_component_el_icon, null, {
  14922. default: withCtx(() => [
  14923. createVNode(_component_arrow_right)
  14924. ]),
  14925. _: 1
  14926. })
  14927. ]),
  14928. createElementVNode("span", _hoisted_9$3, [
  14929. createElementVNode("span", _hoisted_10$3, [
  14930. createVNode(_component_el_input, {
  14931. size: "small",
  14932. class: "el-date-range-picker__editor",
  14933. disabled: _ctx.rangeState.selecting,
  14934. placeholder: _ctx.t("el.datepicker.endDate"),
  14935. "model-value": _ctx.maxVisibleDate,
  14936. readonly: !_ctx.minDate,
  14937. onInput: _cache[5] || (_cache[5] = (val) => _ctx.handleDateInput(val, "max")),
  14938. onChange: _cache[6] || (_cache[6] = (val) => _ctx.handleDateChange(val, "max"))
  14939. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"])
  14940. ]),
  14941. withDirectives((openBlock(), createElementBlock("span", _hoisted_11$2, [
  14942. createVNode(_component_el_input, {
  14943. size: "small",
  14944. class: "el-date-range-picker__editor",
  14945. disabled: _ctx.rangeState.selecting,
  14946. placeholder: _ctx.t("el.datepicker.endTime"),
  14947. "model-value": _ctx.maxVisibleTime,
  14948. readonly: !_ctx.minDate,
  14949. onFocus: _cache[7] || (_cache[7] = ($event) => _ctx.minDate && (_ctx.maxTimePickerVisible = true)),
  14950. onInput: _cache[8] || (_cache[8] = (val) => _ctx.handleTimeInput(val, "max")),
  14951. onChange: _cache[9] || (_cache[9] = (val) => _ctx.handleTimeChange(val, "max"))
  14952. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"]),
  14953. createVNode(_component_time_pick_panel, {
  14954. "datetime-role": "end",
  14955. visible: _ctx.maxTimePickerVisible,
  14956. format: _ctx.timeFormat,
  14957. "time-arrow-control": _ctx.arrowControl,
  14958. "parsed-value": _ctx.rightDate,
  14959. onPick: _ctx.handleMaxTimePick
  14960. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14961. ])), [
  14962. [_directive_clickoutside, _ctx.handleMaxTimeClose]
  14963. ])
  14964. ])
  14965. ])) : createCommentVNode("v-if", true),
  14966. createElementVNode("div", _hoisted_12$2, [
  14967. createElementVNode("div", _hoisted_13$2, [
  14968. createElementVNode("button", {
  14969. type: "button",
  14970. class: "el-picker-panel__icon-btn d-arrow-left",
  14971. onClick: _cache[10] || (_cache[10] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  14972. }, [
  14973. createVNode(_component_el_icon, null, {
  14974. default: withCtx(() => [
  14975. createVNode(_component_d_arrow_left)
  14976. ]),
  14977. _: 1
  14978. })
  14979. ]),
  14980. createElementVNode("button", {
  14981. type: "button",
  14982. class: "el-picker-panel__icon-btn arrow-left",
  14983. onClick: _cache[11] || (_cache[11] = (...args) => _ctx.leftPrevMonth && _ctx.leftPrevMonth(...args))
  14984. }, [
  14985. createVNode(_component_el_icon, null, {
  14986. default: withCtx(() => [
  14987. createVNode(_component_arrow_left)
  14988. ]),
  14989. _: 1
  14990. })
  14991. ]),
  14992. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  14993. key: 0,
  14994. type: "button",
  14995. disabled: !_ctx.enableYearArrow,
  14996. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  14997. onClick: _cache[12] || (_cache[12] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  14998. }, [
  14999. createVNode(_component_el_icon, null, {
  15000. default: withCtx(() => [
  15001. createVNode(_component_d_arrow_right)
  15002. ]),
  15003. _: 1
  15004. })
  15005. ], 10, _hoisted_14$2)) : createCommentVNode("v-if", true),
  15006. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15007. key: 1,
  15008. type: "button",
  15009. disabled: !_ctx.enableMonthArrow,
  15010. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-right"]),
  15011. onClick: _cache[13] || (_cache[13] = (...args) => _ctx.leftNextMonth && _ctx.leftNextMonth(...args))
  15012. }, [
  15013. createVNode(_component_el_icon, null, {
  15014. default: withCtx(() => [
  15015. createVNode(_component_arrow_right)
  15016. ]),
  15017. _: 1
  15018. })
  15019. ], 10, _hoisted_15$1)) : createCommentVNode("v-if", true),
  15020. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15021. ]),
  15022. createVNode(_component_date_table, {
  15023. "selection-mode": "range",
  15024. date: _ctx.leftDate,
  15025. "min-date": _ctx.minDate,
  15026. "max-date": _ctx.maxDate,
  15027. "range-state": _ctx.rangeState,
  15028. "disabled-date": _ctx.disabledDate,
  15029. "cell-class-name": _ctx.cellClassName,
  15030. onChangerange: _ctx.handleChangeRange,
  15031. onPick: _ctx.handleRangePick,
  15032. onSelect: _ctx.onSelect
  15033. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15034. ]),
  15035. createElementVNode("div", _hoisted_16$1, [
  15036. createElementVNode("div", _hoisted_17$1, [
  15037. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15038. key: 0,
  15039. type: "button",
  15040. disabled: !_ctx.enableYearArrow,
  15041. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15042. onClick: _cache[14] || (_cache[14] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15043. }, [
  15044. createVNode(_component_el_icon, null, {
  15045. default: withCtx(() => [
  15046. createVNode(_component_d_arrow_left)
  15047. ]),
  15048. _: 1
  15049. })
  15050. ], 10, _hoisted_18$1)) : createCommentVNode("v-if", true),
  15051. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15052. key: 1,
  15053. type: "button",
  15054. disabled: !_ctx.enableMonthArrow,
  15055. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-left"]),
  15056. onClick: _cache[15] || (_cache[15] = (...args) => _ctx.rightPrevMonth && _ctx.rightPrevMonth(...args))
  15057. }, [
  15058. createVNode(_component_el_icon, null, {
  15059. default: withCtx(() => [
  15060. createVNode(_component_arrow_left)
  15061. ]),
  15062. _: 1
  15063. })
  15064. ], 10, _hoisted_19$1)) : createCommentVNode("v-if", true),
  15065. createElementVNode("button", {
  15066. type: "button",
  15067. class: "el-picker-panel__icon-btn d-arrow-right",
  15068. onClick: _cache[16] || (_cache[16] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15069. }, [
  15070. createVNode(_component_el_icon, null, {
  15071. default: withCtx(() => [
  15072. createVNode(_component_d_arrow_right)
  15073. ]),
  15074. _: 1
  15075. })
  15076. ]),
  15077. createElementVNode("button", {
  15078. type: "button",
  15079. class: "el-picker-panel__icon-btn arrow-right",
  15080. onClick: _cache[17] || (_cache[17] = (...args) => _ctx.rightNextMonth && _ctx.rightNextMonth(...args))
  15081. }, [
  15082. createVNode(_component_el_icon, null, {
  15083. default: withCtx(() => [
  15084. createVNode(_component_arrow_right)
  15085. ]),
  15086. _: 1
  15087. })
  15088. ]),
  15089. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15090. ]),
  15091. createVNode(_component_date_table, {
  15092. "selection-mode": "range",
  15093. date: _ctx.rightDate,
  15094. "min-date": _ctx.minDate,
  15095. "max-date": _ctx.maxDate,
  15096. "range-state": _ctx.rangeState,
  15097. "disabled-date": _ctx.disabledDate,
  15098. "cell-class-name": _ctx.cellClassName,
  15099. onChangerange: _ctx.handleChangeRange,
  15100. onPick: _ctx.handleRangePick,
  15101. onSelect: _ctx.onSelect
  15102. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15103. ])
  15104. ])
  15105. ]),
  15106. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_20$1, [
  15107. _ctx.clearable ? (openBlock(), createBlock(_component_el_button, {
  15108. key: 0,
  15109. size: "small",
  15110. type: "text",
  15111. class: "el-picker-panel__link-btn",
  15112. onClick: _ctx.handleClear
  15113. }, {
  15114. default: withCtx(() => [
  15115. createTextVNode(toDisplayString(_ctx.t("el.datepicker.clear")), 1)
  15116. ]),
  15117. _: 1
  15118. }, 8, ["onClick"])) : createCommentVNode("v-if", true),
  15119. createVNode(_component_el_button, {
  15120. plain: "",
  15121. size: "small",
  15122. class: "el-picker-panel__link-btn",
  15123. disabled: _ctx.btnDisabled,
  15124. onClick: _cache[18] || (_cache[18] = ($event) => _ctx.handleConfirm(false))
  15125. }, {
  15126. default: withCtx(() => [
  15127. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  15128. ]),
  15129. _: 1
  15130. }, 8, ["disabled"])
  15131. ])) : createCommentVNode("v-if", true)
  15132. ], 2);
  15133. }
  15134. 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"]]);
  15135. const _sfc_main$y = defineComponent({
  15136. components: { MonthTable, ElIcon, DArrowLeft: dArrowLeft, DArrowRight: dArrowRight },
  15137. props: {
  15138. unlinkPanels: Boolean,
  15139. parsedValue: {
  15140. type: Array
  15141. }
  15142. },
  15143. emits: ["pick", "set-picker-option"],
  15144. setup(props, ctx) {
  15145. const { t, lang } = useLocale();
  15146. const leftDate = ref(dayjs().locale(lang.value));
  15147. const rightDate = ref(dayjs().locale(lang.value).add(1, "year"));
  15148. const hasShortcuts = computed(() => !!shortcuts.length);
  15149. const handleShortcutClick = (shortcut) => {
  15150. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  15151. if (shortcutValues) {
  15152. ctx.emit("pick", [
  15153. dayjs(shortcutValues[0]).locale(lang.value),
  15154. dayjs(shortcutValues[1]).locale(lang.value)
  15155. ]);
  15156. return;
  15157. }
  15158. if (shortcut.onClick) {
  15159. shortcut.onClick(ctx);
  15160. }
  15161. };
  15162. const leftPrevYear = () => {
  15163. leftDate.value = leftDate.value.subtract(1, "year");
  15164. if (!props.unlinkPanels) {
  15165. rightDate.value = rightDate.value.subtract(1, "year");
  15166. }
  15167. };
  15168. const rightNextYear = () => {
  15169. if (!props.unlinkPanels) {
  15170. leftDate.value = leftDate.value.add(1, "year");
  15171. }
  15172. rightDate.value = rightDate.value.add(1, "year");
  15173. };
  15174. const leftNextYear = () => {
  15175. leftDate.value = leftDate.value.add(1, "year");
  15176. };
  15177. const rightPrevYear = () => {
  15178. rightDate.value = rightDate.value.subtract(1, "year");
  15179. };
  15180. const leftLabel = computed(() => {
  15181. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  15182. });
  15183. const rightLabel = computed(() => {
  15184. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  15185. });
  15186. const leftYear = computed(() => {
  15187. return leftDate.value.year();
  15188. });
  15189. const rightYear = computed(() => {
  15190. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  15191. });
  15192. const enableYearArrow = computed(() => {
  15193. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  15194. });
  15195. const minDate = ref(null);
  15196. const maxDate = ref(null);
  15197. const rangeState = ref({
  15198. endDate: null,
  15199. selecting: false
  15200. });
  15201. const handleChangeRange = (val) => {
  15202. rangeState.value = val;
  15203. };
  15204. const handleRangePick = (val, close2 = true) => {
  15205. const minDate_ = val.minDate;
  15206. const maxDate_ = val.maxDate;
  15207. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  15208. return;
  15209. }
  15210. maxDate.value = maxDate_;
  15211. minDate.value = minDate_;
  15212. if (!close2)
  15213. return;
  15214. handleConfirm();
  15215. };
  15216. const isValidValue = (value) => {
  15217. return Array.isArray(value) && value && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  15218. };
  15219. const handleConfirm = (visible = false) => {
  15220. if (isValidValue([minDate.value, maxDate.value])) {
  15221. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  15222. }
  15223. };
  15224. const onSelect = (selecting) => {
  15225. rangeState.value.selecting = selecting;
  15226. if (!selecting) {
  15227. rangeState.value.endDate = null;
  15228. }
  15229. };
  15230. const formatToString = (value) => {
  15231. return value.map((_2) => _2.format(format2));
  15232. };
  15233. const getDefaultValue = () => {
  15234. let start2;
  15235. if (Array.isArray(defaultValue.value)) {
  15236. const left2 = dayjs(defaultValue.value[0]);
  15237. let right2 = dayjs(defaultValue.value[1]);
  15238. if (!props.unlinkPanels) {
  15239. right2 = left2.add(1, "year");
  15240. }
  15241. return [left2, right2];
  15242. } else if (defaultValue.value) {
  15243. start2 = dayjs(defaultValue.value);
  15244. } else {
  15245. start2 = dayjs();
  15246. }
  15247. start2 = start2.locale(lang.value);
  15248. return [start2, start2.add(1, "year")];
  15249. };
  15250. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  15251. const pickerBase = inject("EP_PICKER_BASE");
  15252. const { shortcuts, disabledDate, format: format2 } = pickerBase.props;
  15253. const defaultValue = toRef(pickerBase.props, "defaultValue");
  15254. watch(() => defaultValue.value, (val) => {
  15255. if (val) {
  15256. const defaultArr = getDefaultValue();
  15257. leftDate.value = defaultArr[0];
  15258. rightDate.value = defaultArr[1];
  15259. }
  15260. }, { immediate: true });
  15261. watch(() => props.parsedValue, (newVal) => {
  15262. if (newVal && newVal.length === 2) {
  15263. minDate.value = newVal[0];
  15264. maxDate.value = newVal[1];
  15265. leftDate.value = minDate.value;
  15266. if (props.unlinkPanels && maxDate.value) {
  15267. const minDateYear = minDate.value.year();
  15268. const maxDateYear = maxDate.value.year();
  15269. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(1, "year") : maxDate.value;
  15270. } else {
  15271. rightDate.value = leftDate.value.add(1, "year");
  15272. }
  15273. } else {
  15274. const defaultArr = getDefaultValue();
  15275. minDate.value = null;
  15276. maxDate.value = null;
  15277. leftDate.value = defaultArr[0];
  15278. rightDate.value = defaultArr[1];
  15279. }
  15280. }, { immediate: true });
  15281. return {
  15282. shortcuts,
  15283. disabledDate,
  15284. onSelect,
  15285. handleRangePick,
  15286. rangeState,
  15287. handleChangeRange,
  15288. minDate,
  15289. maxDate,
  15290. enableYearArrow,
  15291. leftLabel,
  15292. rightLabel,
  15293. leftNextYear,
  15294. leftPrevYear,
  15295. rightNextYear,
  15296. rightPrevYear,
  15297. t,
  15298. leftDate,
  15299. rightDate,
  15300. hasShortcuts,
  15301. handleShortcutClick
  15302. };
  15303. }
  15304. });
  15305. const _hoisted_1$l = { class: "el-picker-panel__body-wrapper" };
  15306. const _hoisted_2$g = {
  15307. key: 0,
  15308. class: "el-picker-panel__sidebar"
  15309. };
  15310. const _hoisted_3$a = ["onClick"];
  15311. const _hoisted_4$8 = { class: "el-picker-panel__body" };
  15312. const _hoisted_5$8 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  15313. const _hoisted_6$6 = { class: "el-date-range-picker__header" };
  15314. const _hoisted_7$3 = ["disabled"];
  15315. const _hoisted_8$2 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  15316. const _hoisted_9$2 = { class: "el-date-range-picker__header" };
  15317. const _hoisted_10$2 = ["disabled"];
  15318. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  15319. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  15320. const _component_el_icon = resolveComponent("el-icon");
  15321. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  15322. const _component_month_table = resolveComponent("month-table");
  15323. return openBlock(), createElementBlock("div", {
  15324. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  15325. {
  15326. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts
  15327. }
  15328. ]])
  15329. }, [
  15330. createElementVNode("div", _hoisted_1$l, [
  15331. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  15332. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$g, [
  15333. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  15334. return openBlock(), createElementBlock("button", {
  15335. key,
  15336. type: "button",
  15337. class: "el-picker-panel__shortcut",
  15338. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  15339. }, toDisplayString(shortcut.text), 9, _hoisted_3$a);
  15340. }), 128))
  15341. ])) : createCommentVNode("v-if", true),
  15342. createElementVNode("div", _hoisted_4$8, [
  15343. createElementVNode("div", _hoisted_5$8, [
  15344. createElementVNode("div", _hoisted_6$6, [
  15345. createElementVNode("button", {
  15346. type: "button",
  15347. class: "el-picker-panel__icon-btn d-arrow-left",
  15348. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  15349. }, [
  15350. createVNode(_component_el_icon, null, {
  15351. default: withCtx(() => [
  15352. createVNode(_component_d_arrow_left)
  15353. ]),
  15354. _: 1
  15355. })
  15356. ]),
  15357. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15358. key: 0,
  15359. type: "button",
  15360. disabled: !_ctx.enableYearArrow,
  15361. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  15362. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  15363. }, [
  15364. createVNode(_component_el_icon, null, {
  15365. default: withCtx(() => [
  15366. createVNode(_component_d_arrow_right)
  15367. ]),
  15368. _: 1
  15369. })
  15370. ], 10, _hoisted_7$3)) : createCommentVNode("v-if", true),
  15371. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15372. ]),
  15373. createVNode(_component_month_table, {
  15374. "selection-mode": "range",
  15375. date: _ctx.leftDate,
  15376. "min-date": _ctx.minDate,
  15377. "max-date": _ctx.maxDate,
  15378. "range-state": _ctx.rangeState,
  15379. "disabled-date": _ctx.disabledDate,
  15380. onChangerange: _ctx.handleChangeRange,
  15381. onPick: _ctx.handleRangePick,
  15382. onSelect: _ctx.onSelect
  15383. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15384. ]),
  15385. createElementVNode("div", _hoisted_8$2, [
  15386. createElementVNode("div", _hoisted_9$2, [
  15387. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15388. key: 0,
  15389. type: "button",
  15390. disabled: !_ctx.enableYearArrow,
  15391. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15392. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15393. }, [
  15394. createVNode(_component_el_icon, null, {
  15395. default: withCtx(() => [
  15396. createVNode(_component_d_arrow_left)
  15397. ]),
  15398. _: 1
  15399. })
  15400. ], 10, _hoisted_10$2)) : createCommentVNode("v-if", true),
  15401. createElementVNode("button", {
  15402. type: "button",
  15403. class: "el-picker-panel__icon-btn d-arrow-right",
  15404. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15405. }, [
  15406. createVNode(_component_el_icon, null, {
  15407. default: withCtx(() => [
  15408. createVNode(_component_d_arrow_right)
  15409. ]),
  15410. _: 1
  15411. })
  15412. ]),
  15413. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15414. ]),
  15415. createVNode(_component_month_table, {
  15416. "selection-mode": "range",
  15417. date: _ctx.rightDate,
  15418. "min-date": _ctx.minDate,
  15419. "max-date": _ctx.maxDate,
  15420. "range-state": _ctx.rangeState,
  15421. "disabled-date": _ctx.disabledDate,
  15422. onChangerange: _ctx.handleChangeRange,
  15423. onPick: _ctx.handleRangePick,
  15424. onSelect: _ctx.onSelect
  15425. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15426. ])
  15427. ])
  15428. ])
  15429. ], 2);
  15430. }
  15431. 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"]]);
  15432. dayjs.extend(localeData);
  15433. dayjs.extend(advancedFormat);
  15434. dayjs.extend(customParseFormat);
  15435. dayjs.extend(weekOfYear);
  15436. dayjs.extend(weekYear);
  15437. dayjs.extend(dayOfYear);
  15438. dayjs.extend(isSameOrAfter);
  15439. dayjs.extend(isSameOrBefore);
  15440. const getPanel = function(type4) {
  15441. if (type4 === "daterange" || type4 === "datetimerange") {
  15442. return DateRangePickPanel;
  15443. } else if (type4 === "monthrange") {
  15444. return MonthRangePickPanel;
  15445. }
  15446. return DatePickPanel;
  15447. };
  15448. var DatePicker = defineComponent({
  15449. name: "ElDatePicker",
  15450. install: null,
  15451. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  15452. type: {
  15453. type: String,
  15454. default: "date"
  15455. }
  15456. }),
  15457. emits: ["update:modelValue"],
  15458. setup(props, ctx) {
  15459. provide("ElPopperOptions", props.popperOptions);
  15460. provide(ROOT_PICKER_INJECTION_KEY, {
  15461. ctx
  15462. });
  15463. const commonPicker = ref(null);
  15464. const refProps = __spreadProps(__spreadValues({}, props), {
  15465. focus: (focusStartInput = true) => {
  15466. var _a2;
  15467. (_a2 = commonPicker.value) == null ? void 0 : _a2.focus(focusStartInput);
  15468. }
  15469. });
  15470. ctx.expose(refProps);
  15471. return () => {
  15472. var _a2;
  15473. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  15474. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  15475. format: format2,
  15476. type: props.type,
  15477. ref: commonPicker,
  15478. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  15479. }), {
  15480. default: (scopedProps) => h$1(getPanel(props.type), scopedProps),
  15481. "range-separator": () => renderSlot(ctx.slots, "range-separator")
  15482. });
  15483. };
  15484. }
  15485. });
  15486. const _DatePicker = DatePicker;
  15487. _DatePicker.install = (app) => {
  15488. app.component(_DatePicker.name, _DatePicker);
  15489. };
  15490. const ElDatePicker = _DatePicker;
  15491. const overlayProps = buildProps({
  15492. mask: {
  15493. type: Boolean,
  15494. default: true
  15495. },
  15496. customMaskEvent: {
  15497. type: Boolean,
  15498. default: false
  15499. },
  15500. overlayClass: {
  15501. type: definePropType([
  15502. String,
  15503. Array,
  15504. Object
  15505. ])
  15506. },
  15507. zIndex: {
  15508. type: definePropType([String, Number])
  15509. }
  15510. });
  15511. const overlayEmits = {
  15512. click: (evt) => evt instanceof MouseEvent
  15513. };
  15514. var Overlay = defineComponent({
  15515. name: "ElOverlay",
  15516. props: overlayProps,
  15517. emits: overlayEmits,
  15518. setup(props, { slots, emit }) {
  15519. const ns = useNamespace("overlay");
  15520. const onMaskClick = (e) => {
  15521. emit("click", e);
  15522. };
  15523. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  15524. return () => {
  15525. return props.mask ? createVNode("div", {
  15526. class: [ns.b(), props.overlayClass],
  15527. style: {
  15528. zIndex: props.zIndex
  15529. },
  15530. onClick,
  15531. onMousedown,
  15532. onMouseup
  15533. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
  15534. class: props.overlayClass,
  15535. style: {
  15536. zIndex: props.zIndex,
  15537. position: "fixed",
  15538. top: "0px",
  15539. right: "0px",
  15540. bottom: "0px",
  15541. left: "0px"
  15542. }
  15543. }, [renderSlot(slots, "default")]);
  15544. };
  15545. }
  15546. });
  15547. const ElOverlay = Overlay;
  15548. const dialogContentProps = buildProps({
  15549. center: {
  15550. type: Boolean,
  15551. default: false
  15552. },
  15553. closeIcon: {
  15554. type: iconPropType,
  15555. default: ""
  15556. },
  15557. customClass: {
  15558. type: String,
  15559. default: ""
  15560. },
  15561. draggable: {
  15562. type: Boolean,
  15563. default: false
  15564. },
  15565. fullscreen: {
  15566. type: Boolean,
  15567. default: false
  15568. },
  15569. showClose: {
  15570. type: Boolean,
  15571. default: true
  15572. },
  15573. title: {
  15574. type: String,
  15575. default: ""
  15576. }
  15577. });
  15578. const dialogContentEmits = {
  15579. close: () => true
  15580. };
  15581. const _hoisted_1$k = ["aria-label"];
  15582. const __default__$c = { name: "ElDialogContent" };
  15583. const _sfc_main$x = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$c), {
  15584. props: dialogContentProps,
  15585. emits: dialogContentEmits,
  15586. setup(__props) {
  15587. const { Close } = CloseComponents;
  15588. const { dialogRef, headerRef, ns, style } = inject(dialogInjectionKey);
  15589. return (_ctx, _cache) => {
  15590. return openBlock(), createElementBlock("div", {
  15591. ref_key: "dialogRef",
  15592. ref: dialogRef,
  15593. class: normalizeClass([
  15594. unref(ns).b(),
  15595. unref(ns).is("fullscreen", _ctx.fullscreen),
  15596. unref(ns).is("draggable", _ctx.draggable),
  15597. { [unref(ns).m("center")]: _ctx.center },
  15598. _ctx.customClass
  15599. ]),
  15600. "aria-modal": "true",
  15601. role: "dialog",
  15602. "aria-label": _ctx.title || "dialog",
  15603. style: normalizeStyle(unref(style)),
  15604. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  15605. }, ["stop"]))
  15606. }, [
  15607. createElementVNode("div", {
  15608. ref_key: "headerRef",
  15609. ref: headerRef,
  15610. class: normalizeClass(unref(ns).e("header"))
  15611. }, [
  15612. renderSlot(_ctx.$slots, "title", {}, () => [
  15613. createElementVNode("span", {
  15614. class: normalizeClass(unref(ns).e("title"))
  15615. }, toDisplayString(_ctx.title), 3)
  15616. ])
  15617. ], 2),
  15618. createElementVNode("div", {
  15619. class: normalizeClass(unref(ns).e("body"))
  15620. }, [
  15621. renderSlot(_ctx.$slots, "default")
  15622. ], 2),
  15623. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  15624. key: 0,
  15625. class: normalizeClass(unref(ns).e("footer"))
  15626. }, [
  15627. renderSlot(_ctx.$slots, "footer")
  15628. ], 2)) : createCommentVNode("v-if", true),
  15629. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  15630. key: 1,
  15631. "aria-label": "close",
  15632. class: normalizeClass(unref(ns).e("headerbtn")),
  15633. type: "button",
  15634. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  15635. }, [
  15636. createVNode(unref(ElIcon), {
  15637. class: normalizeClass(unref(ns).e("close"))
  15638. }, {
  15639. default: withCtx(() => [
  15640. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  15641. ]),
  15642. _: 1
  15643. }, 8, ["class"])
  15644. ], 2)) : createCommentVNode("v-if", true)
  15645. ], 14, _hoisted_1$k);
  15646. };
  15647. }
  15648. }));
  15649. var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
  15650. const dialogProps = buildProps(__spreadProps(__spreadValues({}, dialogContentProps), {
  15651. appendToBody: {
  15652. type: Boolean,
  15653. default: false
  15654. },
  15655. beforeClose: {
  15656. type: definePropType(Function)
  15657. },
  15658. destroyOnClose: {
  15659. type: Boolean,
  15660. default: false
  15661. },
  15662. closeOnClickModal: {
  15663. type: Boolean,
  15664. default: true
  15665. },
  15666. closeOnPressEscape: {
  15667. type: Boolean,
  15668. default: true
  15669. },
  15670. lockScroll: {
  15671. type: Boolean,
  15672. default: true
  15673. },
  15674. modal: {
  15675. type: Boolean,
  15676. default: true
  15677. },
  15678. openDelay: {
  15679. type: Number,
  15680. default: 0
  15681. },
  15682. closeDelay: {
  15683. type: Number,
  15684. default: 0
  15685. },
  15686. top: {
  15687. type: String
  15688. },
  15689. modelValue: {
  15690. type: Boolean,
  15691. required: true
  15692. },
  15693. modalClass: String,
  15694. width: {
  15695. type: [String, Number]
  15696. },
  15697. zIndex: {
  15698. type: Number
  15699. },
  15700. trapFocus: {
  15701. type: Boolean,
  15702. default: false
  15703. }
  15704. }));
  15705. const dialogEmits = {
  15706. open: () => true,
  15707. opened: () => true,
  15708. close: () => true,
  15709. closed: () => true,
  15710. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  15711. openAutoFocus: () => true,
  15712. closeAutoFocus: () => true
  15713. };
  15714. const useDialog = (props, targetRef) => {
  15715. const instance = getCurrentInstance();
  15716. const emit = instance.emit;
  15717. const { nextZIndex } = useZIndex();
  15718. let lastPosition = "";
  15719. const visible = ref(false);
  15720. const closed = ref(false);
  15721. const rendered = ref(false);
  15722. const zIndex2 = ref(props.zIndex || nextZIndex());
  15723. let openTimer = void 0;
  15724. let closeTimer = void 0;
  15725. const normalizeWidth = computed(() => isNumber(props.width) ? `${props.width}px` : props.width);
  15726. const style = computed(() => {
  15727. const style2 = {};
  15728. const varPrefix = `--el-dialog`;
  15729. if (!props.fullscreen) {
  15730. if (props.top) {
  15731. style2[`${varPrefix}-margin-top`] = props.top;
  15732. }
  15733. if (props.width) {
  15734. style2[`${varPrefix}-width`] = normalizeWidth.value;
  15735. }
  15736. }
  15737. return style2;
  15738. });
  15739. function afterEnter() {
  15740. emit("opened");
  15741. }
  15742. function afterLeave() {
  15743. emit("closed");
  15744. emit(UPDATE_MODEL_EVENT, false);
  15745. if (props.destroyOnClose) {
  15746. rendered.value = false;
  15747. }
  15748. }
  15749. function beforeLeave() {
  15750. emit("close");
  15751. }
  15752. function open() {
  15753. closeTimer == null ? void 0 : closeTimer();
  15754. openTimer == null ? void 0 : openTimer();
  15755. if (props.openDelay && props.openDelay > 0) {
  15756. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  15757. } else {
  15758. doOpen();
  15759. }
  15760. }
  15761. function close2() {
  15762. openTimer == null ? void 0 : openTimer();
  15763. closeTimer == null ? void 0 : closeTimer();
  15764. if (props.closeDelay && props.closeDelay > 0) {
  15765. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  15766. } else {
  15767. doClose();
  15768. }
  15769. }
  15770. function handleClose() {
  15771. function hide2(shouldCancel) {
  15772. if (shouldCancel)
  15773. return;
  15774. closed.value = true;
  15775. visible.value = false;
  15776. }
  15777. if (props.beforeClose) {
  15778. props.beforeClose(hide2);
  15779. } else {
  15780. close2();
  15781. }
  15782. }
  15783. function onModalClick() {
  15784. if (props.closeOnClickModal) {
  15785. handleClose();
  15786. }
  15787. }
  15788. function doOpen() {
  15789. if (!isClient$1)
  15790. return;
  15791. visible.value = true;
  15792. }
  15793. function doClose() {
  15794. visible.value = false;
  15795. }
  15796. if (props.lockScroll) {
  15797. useLockscreen(visible);
  15798. }
  15799. if (props.closeOnPressEscape) {
  15800. useModal({
  15801. handleClose
  15802. }, visible);
  15803. }
  15804. useRestoreActive(visible);
  15805. watch(() => props.modelValue, (val) => {
  15806. if (val) {
  15807. closed.value = false;
  15808. open();
  15809. rendered.value = true;
  15810. emit("open");
  15811. zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
  15812. nextTick(() => {
  15813. if (targetRef.value) {
  15814. targetRef.value.scrollTop = 0;
  15815. }
  15816. });
  15817. } else {
  15818. if (visible.value) {
  15819. close2();
  15820. }
  15821. }
  15822. });
  15823. watch(() => props.fullscreen, (val) => {
  15824. if (!targetRef.value)
  15825. return;
  15826. if (val) {
  15827. lastPosition = targetRef.value.style.transform;
  15828. targetRef.value.style.transform = "";
  15829. } else {
  15830. targetRef.value.style.transform = lastPosition;
  15831. }
  15832. });
  15833. onMounted(() => {
  15834. if (props.modelValue) {
  15835. visible.value = true;
  15836. rendered.value = true;
  15837. open();
  15838. }
  15839. });
  15840. return {
  15841. afterEnter,
  15842. afterLeave,
  15843. beforeLeave,
  15844. handleClose,
  15845. onModalClick,
  15846. close: close2,
  15847. doClose,
  15848. closed,
  15849. style,
  15850. rendered,
  15851. visible,
  15852. zIndex: zIndex2
  15853. };
  15854. };
  15855. const __default__$b = {
  15856. name: "ElDialog"
  15857. };
  15858. const _sfc_main$w = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$b), {
  15859. props: dialogProps,
  15860. emits: dialogEmits,
  15861. setup(__props, { expose }) {
  15862. const props = __props;
  15863. const ns = useNamespace("dialog");
  15864. const dialogRef = ref();
  15865. const headerRef = ref();
  15866. const {
  15867. visible,
  15868. style,
  15869. rendered,
  15870. zIndex: zIndex2,
  15871. afterEnter,
  15872. afterLeave,
  15873. beforeLeave,
  15874. handleClose,
  15875. onModalClick
  15876. } = useDialog(props, dialogRef);
  15877. provide(dialogInjectionKey, {
  15878. dialogRef,
  15879. headerRef,
  15880. ns,
  15881. rendered,
  15882. style
  15883. });
  15884. const overlayEvent = useSameTarget(onModalClick);
  15885. const draggable = computed(() => props.draggable && !props.fullscreen);
  15886. useDraggable(dialogRef, headerRef, draggable);
  15887. expose({
  15888. visible
  15889. });
  15890. return (_ctx, _cache) => {
  15891. return openBlock(), createBlock(Teleport, {
  15892. to: "body",
  15893. disabled: !_ctx.appendToBody
  15894. }, [
  15895. createVNode(Transition, {
  15896. name: "dialog-fade",
  15897. onAfterEnter: unref(afterEnter),
  15898. onAfterLeave: unref(afterLeave),
  15899. onBeforeLeave: unref(beforeLeave)
  15900. }, {
  15901. default: withCtx(() => [
  15902. withDirectives(createVNode(unref(ElOverlay), {
  15903. "custom-mask-event": "",
  15904. mask: _ctx.modal,
  15905. "overlay-class": _ctx.modalClass,
  15906. "z-index": unref(zIndex2)
  15907. }, {
  15908. default: withCtx(() => [
  15909. createElementVNode("div", {
  15910. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  15911. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  15912. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  15913. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  15914. }, [
  15915. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, {
  15916. key: 0,
  15917. "custom-class": _ctx.customClass,
  15918. center: _ctx.center,
  15919. "close-icon": _ctx.closeIcon,
  15920. draggable: unref(draggable),
  15921. fullscreen: _ctx.fullscreen,
  15922. "show-close": _ctx.showClose,
  15923. style: normalizeStyle(unref(style)),
  15924. title: _ctx.title,
  15925. onClose: unref(handleClose)
  15926. }, createSlots({
  15927. title: withCtx(() => [
  15928. renderSlot(_ctx.$slots, "title")
  15929. ]),
  15930. default: withCtx(() => [
  15931. renderSlot(_ctx.$slots, "default")
  15932. ]),
  15933. _: 2
  15934. }, [
  15935. _ctx.$slots.footer ? {
  15936. name: "footer",
  15937. fn: withCtx(() => [
  15938. renderSlot(_ctx.$slots, "footer")
  15939. ])
  15940. } : void 0
  15941. ]), 1032, ["custom-class", "center", "close-icon", "draggable", "fullscreen", "show-close", "style", "title", "onClose"])) : createCommentVNode("v-if", true)
  15942. ], 34)
  15943. ]),
  15944. _: 3
  15945. }, 8, ["mask", "overlay-class", "z-index"]), [
  15946. [vShow, unref(visible)]
  15947. ])
  15948. ]),
  15949. _: 3
  15950. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  15951. ], 8, ["disabled"]);
  15952. };
  15953. }
  15954. }));
  15955. var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
  15956. const ElDialog = withInstall(Dialog);
  15957. const dividerProps = buildProps({
  15958. direction: {
  15959. type: String,
  15960. values: ["horizontal", "vertical"],
  15961. default: "horizontal"
  15962. },
  15963. contentPosition: {
  15964. type: String,
  15965. values: ["left", "center", "right"],
  15966. default: "center"
  15967. },
  15968. borderStyle: {
  15969. type: definePropType(String),
  15970. default: "solid"
  15971. }
  15972. });
  15973. const __default__$a = {
  15974. name: "ElDivider"
  15975. };
  15976. const _sfc_main$v = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
  15977. props: dividerProps,
  15978. setup(__props) {
  15979. const props = __props;
  15980. const ns = useNamespace("divider");
  15981. const dividerStyle = computed(() => {
  15982. return {
  15983. "--el-border-style": props.borderStyle
  15984. };
  15985. });
  15986. return (_ctx, _cache) => {
  15987. return openBlock(), createElementBlock("div", {
  15988. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
  15989. style: normalizeStyle(unref(dividerStyle))
  15990. }, [
  15991. _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  15992. key: 0,
  15993. class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
  15994. }, [
  15995. renderSlot(_ctx.$slots, "default")
  15996. ], 2)) : createCommentVNode("v-if", true)
  15997. ], 6);
  15998. };
  15999. }
  16000. }));
  16001. var Divider = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/divider/src/divider.vue"]]);
  16002. const ElDivider = withInstall(Divider);
  16003. const formProps = buildProps({
  16004. model: Object,
  16005. rules: {
  16006. type: definePropType(Object)
  16007. },
  16008. labelPosition: String,
  16009. labelWidth: {
  16010. type: [String, Number],
  16011. default: ""
  16012. },
  16013. labelSuffix: {
  16014. type: String,
  16015. default: ""
  16016. },
  16017. inline: Boolean,
  16018. inlineMessage: Boolean,
  16019. statusIcon: Boolean,
  16020. showMessage: {
  16021. type: Boolean,
  16022. default: true
  16023. },
  16024. size: {
  16025. type: String,
  16026. values: componentSizes
  16027. },
  16028. disabled: Boolean,
  16029. validateOnRuleChange: {
  16030. type: Boolean,
  16031. default: true
  16032. },
  16033. hideRequiredAsterisk: {
  16034. type: Boolean,
  16035. default: false
  16036. },
  16037. scrollToError: Boolean
  16038. });
  16039. const formEmits = {
  16040. validate: (prop, isValid, message) => (isArray(prop) || isString(prop)) && isBoolean(isValid) && isString(message)
  16041. };
  16042. function useFormLabelWidth() {
  16043. const potentialLabelWidthArr = ref([]);
  16044. const autoLabelWidth = computed(() => {
  16045. if (!potentialLabelWidthArr.value.length)
  16046. return "0";
  16047. const max2 = Math.max(...potentialLabelWidthArr.value);
  16048. return max2 ? `${max2}px` : "";
  16049. });
  16050. function getLabelWidthIndex(width) {
  16051. const index = potentialLabelWidthArr.value.indexOf(width);
  16052. return index;
  16053. }
  16054. function registerLabelWidth(val, oldVal) {
  16055. if (val && oldVal) {
  16056. const index = getLabelWidthIndex(oldVal);
  16057. potentialLabelWidthArr.value.splice(index, 1, val);
  16058. } else if (val) {
  16059. potentialLabelWidthArr.value.push(val);
  16060. }
  16061. }
  16062. function deregisterLabelWidth(val) {
  16063. const index = getLabelWidthIndex(val);
  16064. if (index > -1) {
  16065. potentialLabelWidthArr.value.splice(index, 1);
  16066. }
  16067. }
  16068. return {
  16069. autoLabelWidth,
  16070. registerLabelWidth,
  16071. deregisterLabelWidth
  16072. };
  16073. }
  16074. const filterFields = (fields, props) => {
  16075. const normalized = castArray$1(props);
  16076. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  16077. };
  16078. const __default__$9 = {
  16079. name: "ElForm"
  16080. };
  16081. const _sfc_main$u = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
  16082. props: formProps,
  16083. emits: formEmits,
  16084. setup(__props, { expose, emit }) {
  16085. const props = __props;
  16086. const fields = [];
  16087. const formSize = useSize();
  16088. const ns = useNamespace("form");
  16089. const formClasses = computed(() => {
  16090. const { labelPosition, inline } = props;
  16091. return [
  16092. ns.b(),
  16093. ns.m(formSize.value || "default"),
  16094. {
  16095. [ns.m(`label-${labelPosition}`)]: labelPosition,
  16096. [ns.m("inline")]: inline
  16097. }
  16098. ];
  16099. });
  16100. const addField = (field) => {
  16101. fields.push(field);
  16102. };
  16103. const removeField = (field) => {
  16104. if (field.prop) {
  16105. fields.splice(fields.indexOf(field), 1);
  16106. }
  16107. };
  16108. const resetFields = (properties = []) => {
  16109. if (!props.model) {
  16110. return;
  16111. }
  16112. filterFields(fields, properties).forEach((field) => field.resetField());
  16113. };
  16114. const clearValidate = (props2 = []) => {
  16115. filterFields(fields, props2).forEach((field) => field.clearValidate());
  16116. };
  16117. const isValidatable = computed(() => {
  16118. const hasModel = !!props.model;
  16119. return hasModel;
  16120. });
  16121. const obtainValidateFields = (props2) => {
  16122. if (fields.length === 0)
  16123. return [];
  16124. const filteredFields = filterFields(fields, props2);
  16125. if (!filteredFields.length) {
  16126. return [];
  16127. }
  16128. return filteredFields;
  16129. };
  16130. const validate = async (callback) => validateField(void 0, callback);
  16131. const doValidateField = async (props2 = []) => {
  16132. if (!isValidatable.value)
  16133. return false;
  16134. const fields2 = obtainValidateFields(props2);
  16135. if (fields2.length === 0)
  16136. return true;
  16137. let validationErrors = {};
  16138. for (const field of fields2) {
  16139. try {
  16140. await field.validate("");
  16141. } catch (fields3) {
  16142. validationErrors = __spreadValues(__spreadValues({}, validationErrors), fields3);
  16143. }
  16144. }
  16145. if (Object.keys(validationErrors).length === 0)
  16146. return true;
  16147. return Promise.reject(validationErrors);
  16148. };
  16149. const validateField = async (modelProps = [], callback) => {
  16150. const shouldThrow = !isFunction(callback);
  16151. try {
  16152. const result = await doValidateField(modelProps);
  16153. if (result === true) {
  16154. callback == null ? void 0 : callback(result);
  16155. }
  16156. return result;
  16157. } catch (e) {
  16158. const invalidFields = e;
  16159. if (props.scrollToError) {
  16160. scrollToField(Object.keys(invalidFields)[0]);
  16161. }
  16162. callback == null ? void 0 : callback(false, invalidFields);
  16163. return shouldThrow && Promise.reject(invalidFields);
  16164. }
  16165. };
  16166. const scrollToField = (prop) => {
  16167. var _a2;
  16168. const field = filterFields(fields, prop)[0];
  16169. if (field) {
  16170. (_a2 = field.$el) == null ? void 0 : _a2.scrollIntoView();
  16171. }
  16172. };
  16173. watch(() => props.rules, () => {
  16174. if (props.validateOnRuleChange)
  16175. validate();
  16176. }, { deep: true });
  16177. provide(formContextKey, reactive(__spreadValues(__spreadProps(__spreadValues({}, toRefs(props)), {
  16178. emit,
  16179. resetFields,
  16180. clearValidate,
  16181. validateField,
  16182. addField,
  16183. removeField
  16184. }), useFormLabelWidth())));
  16185. expose({
  16186. validate,
  16187. validateField,
  16188. resetFields,
  16189. clearValidate,
  16190. scrollToField
  16191. });
  16192. return (_ctx, _cache) => {
  16193. return openBlock(), createElementBlock("form", {
  16194. class: normalizeClass(unref(formClasses))
  16195. }, [
  16196. renderSlot(_ctx.$slots, "default")
  16197. ], 2);
  16198. };
  16199. }
  16200. }));
  16201. var Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);
  16202. function _extends$1() {
  16203. _extends$1 = Object.assign || function(target) {
  16204. for (var i = 1; i < arguments.length; i++) {
  16205. var source = arguments[i];
  16206. for (var key in source) {
  16207. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16208. target[key] = source[key];
  16209. }
  16210. }
  16211. }
  16212. return target;
  16213. };
  16214. return _extends$1.apply(this, arguments);
  16215. }
  16216. function _inheritsLoose(subClass, superClass) {
  16217. subClass.prototype = Object.create(superClass.prototype);
  16218. subClass.prototype.constructor = subClass;
  16219. _setPrototypeOf(subClass, superClass);
  16220. }
  16221. function _getPrototypeOf(o2) {
  16222. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o3) {
  16223. return o3.__proto__ || Object.getPrototypeOf(o3);
  16224. };
  16225. return _getPrototypeOf(o2);
  16226. }
  16227. function _setPrototypeOf(o2, p2) {
  16228. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o3, p3) {
  16229. o3.__proto__ = p3;
  16230. return o3;
  16231. };
  16232. return _setPrototypeOf(o2, p2);
  16233. }
  16234. function _isNativeReflectConstruct() {
  16235. if (typeof Reflect === "undefined" || !Reflect.construct)
  16236. return false;
  16237. if (Reflect.construct.sham)
  16238. return false;
  16239. if (typeof Proxy === "function")
  16240. return true;
  16241. try {
  16242. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  16243. }));
  16244. return true;
  16245. } catch (e) {
  16246. return false;
  16247. }
  16248. }
  16249. function _construct(Parent, args, Class) {
  16250. if (_isNativeReflectConstruct()) {
  16251. _construct = Reflect.construct;
  16252. } else {
  16253. _construct = function _construct2(Parent2, args2, Class2) {
  16254. var a2 = [null];
  16255. a2.push.apply(a2, args2);
  16256. var Constructor = Function.bind.apply(Parent2, a2);
  16257. var instance = new Constructor();
  16258. if (Class2)
  16259. _setPrototypeOf(instance, Class2.prototype);
  16260. return instance;
  16261. };
  16262. }
  16263. return _construct.apply(null, arguments);
  16264. }
  16265. function _isNativeFunction(fn2) {
  16266. return Function.toString.call(fn2).indexOf("[native code]") !== -1;
  16267. }
  16268. function _wrapNativeSuper(Class) {
  16269. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  16270. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  16271. if (Class2 === null || !_isNativeFunction(Class2))
  16272. return Class2;
  16273. if (typeof Class2 !== "function") {
  16274. throw new TypeError("Super expression must either be null or a function");
  16275. }
  16276. if (typeof _cache !== "undefined") {
  16277. if (_cache.has(Class2))
  16278. return _cache.get(Class2);
  16279. _cache.set(Class2, Wrapper);
  16280. }
  16281. function Wrapper() {
  16282. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  16283. }
  16284. Wrapper.prototype = Object.create(Class2.prototype, {
  16285. constructor: {
  16286. value: Wrapper,
  16287. enumerable: false,
  16288. writable: true,
  16289. configurable: true
  16290. }
  16291. });
  16292. return _setPrototypeOf(Wrapper, Class2);
  16293. };
  16294. return _wrapNativeSuper(Class);
  16295. }
  16296. var formatRegExp = /%[sdj%]/g;
  16297. var warning = function warning2() {
  16298. };
  16299. if (typeof process !== "undefined" && process.env && false) {
  16300. warning = function warning3(type4, errors) {
  16301. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  16302. if (errors.every(function(e) {
  16303. return typeof e === "string";
  16304. })) {
  16305. console.warn(type4, errors);
  16306. }
  16307. }
  16308. };
  16309. }
  16310. function convertFieldsError(errors) {
  16311. if (!errors || !errors.length)
  16312. return null;
  16313. var fields = {};
  16314. errors.forEach(function(error) {
  16315. var field = error.field;
  16316. fields[field] = fields[field] || [];
  16317. fields[field].push(error);
  16318. });
  16319. return fields;
  16320. }
  16321. function format(template) {
  16322. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  16323. args[_key - 1] = arguments[_key];
  16324. }
  16325. var i = 0;
  16326. var len = args.length;
  16327. if (typeof template === "function") {
  16328. return template.apply(null, args);
  16329. }
  16330. if (typeof template === "string") {
  16331. var str = template.replace(formatRegExp, function(x2) {
  16332. if (x2 === "%%") {
  16333. return "%";
  16334. }
  16335. if (i >= len) {
  16336. return x2;
  16337. }
  16338. switch (x2) {
  16339. case "%s":
  16340. return String(args[i++]);
  16341. case "%d":
  16342. return Number(args[i++]);
  16343. case "%j":
  16344. try {
  16345. return JSON.stringify(args[i++]);
  16346. } catch (_2) {
  16347. return "[Circular]";
  16348. }
  16349. break;
  16350. default:
  16351. return x2;
  16352. }
  16353. });
  16354. return str;
  16355. }
  16356. return template;
  16357. }
  16358. function isNativeStringType(type4) {
  16359. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  16360. }
  16361. function isEmptyValue(value, type4) {
  16362. if (value === void 0 || value === null) {
  16363. return true;
  16364. }
  16365. if (type4 === "array" && Array.isArray(value) && !value.length) {
  16366. return true;
  16367. }
  16368. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  16369. return true;
  16370. }
  16371. return false;
  16372. }
  16373. function asyncParallelArray(arr, func, callback) {
  16374. var results = [];
  16375. var total = 0;
  16376. var arrLength = arr.length;
  16377. function count(errors) {
  16378. results.push.apply(results, errors || []);
  16379. total++;
  16380. if (total === arrLength) {
  16381. callback(results);
  16382. }
  16383. }
  16384. arr.forEach(function(a2) {
  16385. func(a2, count);
  16386. });
  16387. }
  16388. function asyncSerialArray(arr, func, callback) {
  16389. var index = 0;
  16390. var arrLength = arr.length;
  16391. function next(errors) {
  16392. if (errors && errors.length) {
  16393. callback(errors);
  16394. return;
  16395. }
  16396. var original = index;
  16397. index = index + 1;
  16398. if (original < arrLength) {
  16399. func(arr[original], next);
  16400. } else {
  16401. callback([]);
  16402. }
  16403. }
  16404. next([]);
  16405. }
  16406. function flattenObjArr(objArr) {
  16407. var ret = [];
  16408. Object.keys(objArr).forEach(function(k) {
  16409. ret.push.apply(ret, objArr[k] || []);
  16410. });
  16411. return ret;
  16412. }
  16413. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  16414. _inheritsLoose(AsyncValidationError2, _Error);
  16415. function AsyncValidationError2(errors, fields) {
  16416. var _this;
  16417. _this = _Error.call(this, "Async Validation Error") || this;
  16418. _this.errors = errors;
  16419. _this.fields = fields;
  16420. return _this;
  16421. }
  16422. return AsyncValidationError2;
  16423. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  16424. function asyncMap(objArr, option, func, callback, source) {
  16425. if (option.first) {
  16426. var _pending = new Promise(function(resolve, reject) {
  16427. var next = function next2(errors) {
  16428. callback(errors);
  16429. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  16430. };
  16431. var flattenArr = flattenObjArr(objArr);
  16432. asyncSerialArray(flattenArr, func, next);
  16433. });
  16434. _pending["catch"](function(e) {
  16435. return e;
  16436. });
  16437. return _pending;
  16438. }
  16439. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  16440. var objArrKeys = Object.keys(objArr);
  16441. var objArrLength = objArrKeys.length;
  16442. var total = 0;
  16443. var results = [];
  16444. var pending = new Promise(function(resolve, reject) {
  16445. var next = function next2(errors) {
  16446. results.push.apply(results, errors);
  16447. total++;
  16448. if (total === objArrLength) {
  16449. callback(results);
  16450. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  16451. }
  16452. };
  16453. if (!objArrKeys.length) {
  16454. callback(results);
  16455. resolve(source);
  16456. }
  16457. objArrKeys.forEach(function(key) {
  16458. var arr = objArr[key];
  16459. if (firstFields.indexOf(key) !== -1) {
  16460. asyncSerialArray(arr, func, next);
  16461. } else {
  16462. asyncParallelArray(arr, func, next);
  16463. }
  16464. });
  16465. });
  16466. pending["catch"](function(e) {
  16467. return e;
  16468. });
  16469. return pending;
  16470. }
  16471. function isErrorObj(obj) {
  16472. return !!(obj && obj.message !== void 0);
  16473. }
  16474. function getValue(value, path) {
  16475. var v2 = value;
  16476. for (var i = 0; i < path.length; i++) {
  16477. if (v2 == void 0) {
  16478. return v2;
  16479. }
  16480. v2 = v2[path[i]];
  16481. }
  16482. return v2;
  16483. }
  16484. function complementError(rule, source) {
  16485. return function(oe) {
  16486. var fieldValue;
  16487. if (rule.fullFields) {
  16488. fieldValue = getValue(source, rule.fullFields);
  16489. } else {
  16490. fieldValue = source[oe.field || rule.fullField];
  16491. }
  16492. if (isErrorObj(oe)) {
  16493. oe.field = oe.field || rule.fullField;
  16494. oe.fieldValue = fieldValue;
  16495. return oe;
  16496. }
  16497. return {
  16498. message: typeof oe === "function" ? oe() : oe,
  16499. fieldValue,
  16500. field: oe.field || rule.fullField
  16501. };
  16502. };
  16503. }
  16504. function deepMerge(target, source) {
  16505. if (source) {
  16506. for (var s2 in source) {
  16507. if (source.hasOwnProperty(s2)) {
  16508. var value = source[s2];
  16509. if (typeof value === "object" && typeof target[s2] === "object") {
  16510. target[s2] = _extends$1({}, target[s2], value);
  16511. } else {
  16512. target[s2] = value;
  16513. }
  16514. }
  16515. }
  16516. }
  16517. return target;
  16518. }
  16519. var required$1 = function required(rule, value, source, errors, options, type4) {
  16520. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  16521. errors.push(format(options.messages.required, rule.fullField));
  16522. }
  16523. };
  16524. var whitespace = function whitespace2(rule, value, source, errors, options) {
  16525. if (/^\s+$/.test(value) || value === "") {
  16526. errors.push(format(options.messages.whitespace, rule.fullField));
  16527. }
  16528. };
  16529. var pattern$2 = {
  16530. 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,}))$/,
  16531. 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"),
  16532. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  16533. };
  16534. var types = {
  16535. integer: function integer(value) {
  16536. return types.number(value) && parseInt(value, 10) === value;
  16537. },
  16538. "float": function float(value) {
  16539. return types.number(value) && !types.integer(value);
  16540. },
  16541. array: function array(value) {
  16542. return Array.isArray(value);
  16543. },
  16544. regexp: function regexp(value) {
  16545. if (value instanceof RegExp) {
  16546. return true;
  16547. }
  16548. try {
  16549. return !!new RegExp(value);
  16550. } catch (e) {
  16551. return false;
  16552. }
  16553. },
  16554. date: function date(value) {
  16555. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  16556. },
  16557. number: function number(value) {
  16558. if (isNaN(value)) {
  16559. return false;
  16560. }
  16561. return typeof value === "number";
  16562. },
  16563. object: function object(value) {
  16564. return typeof value === "object" && !types.array(value);
  16565. },
  16566. method: function method(value) {
  16567. return typeof value === "function";
  16568. },
  16569. email: function email(value) {
  16570. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  16571. },
  16572. url: function url(value) {
  16573. return typeof value === "string" && value.length <= 2048 && !!value.match(pattern$2.url);
  16574. },
  16575. hex: function hex(value) {
  16576. return typeof value === "string" && !!value.match(pattern$2.hex);
  16577. }
  16578. };
  16579. var type$1 = function type(rule, value, source, errors, options) {
  16580. if (rule.required && value === void 0) {
  16581. required$1(rule, value, source, errors, options);
  16582. return;
  16583. }
  16584. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  16585. var ruleType = rule.type;
  16586. if (custom.indexOf(ruleType) > -1) {
  16587. if (!types[ruleType](value)) {
  16588. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16589. }
  16590. } else if (ruleType && typeof value !== rule.type) {
  16591. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16592. }
  16593. };
  16594. var range = function range2(rule, value, source, errors, options) {
  16595. var len = typeof rule.len === "number";
  16596. var min2 = typeof rule.min === "number";
  16597. var max2 = typeof rule.max === "number";
  16598. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  16599. var val = value;
  16600. var key = null;
  16601. var num = typeof value === "number";
  16602. var str = typeof value === "string";
  16603. var arr = Array.isArray(value);
  16604. if (num) {
  16605. key = "number";
  16606. } else if (str) {
  16607. key = "string";
  16608. } else if (arr) {
  16609. key = "array";
  16610. }
  16611. if (!key) {
  16612. return false;
  16613. }
  16614. if (arr) {
  16615. val = value.length;
  16616. }
  16617. if (str) {
  16618. val = value.replace(spRegexp, "_").length;
  16619. }
  16620. if (len) {
  16621. if (val !== rule.len) {
  16622. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  16623. }
  16624. } else if (min2 && !max2 && val < rule.min) {
  16625. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  16626. } else if (max2 && !min2 && val > rule.max) {
  16627. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  16628. } else if (min2 && max2 && (val < rule.min || val > rule.max)) {
  16629. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  16630. }
  16631. };
  16632. var ENUM$1 = "enum";
  16633. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  16634. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  16635. if (rule[ENUM$1].indexOf(value) === -1) {
  16636. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  16637. }
  16638. };
  16639. var pattern$1 = function pattern(rule, value, source, errors, options) {
  16640. if (rule.pattern) {
  16641. if (rule.pattern instanceof RegExp) {
  16642. rule.pattern.lastIndex = 0;
  16643. if (!rule.pattern.test(value)) {
  16644. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16645. }
  16646. } else if (typeof rule.pattern === "string") {
  16647. var _pattern = new RegExp(rule.pattern);
  16648. if (!_pattern.test(value)) {
  16649. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16650. }
  16651. }
  16652. }
  16653. };
  16654. var rules = {
  16655. required: required$1,
  16656. whitespace,
  16657. type: type$1,
  16658. range,
  16659. "enum": enumerable$1,
  16660. pattern: pattern$1
  16661. };
  16662. var string = function string2(rule, value, callback, source, options) {
  16663. var errors = [];
  16664. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16665. if (validate) {
  16666. if (isEmptyValue(value, "string") && !rule.required) {
  16667. return callback();
  16668. }
  16669. rules.required(rule, value, source, errors, options, "string");
  16670. if (!isEmptyValue(value, "string")) {
  16671. rules.type(rule, value, source, errors, options);
  16672. rules.range(rule, value, source, errors, options);
  16673. rules.pattern(rule, value, source, errors, options);
  16674. if (rule.whitespace === true) {
  16675. rules.whitespace(rule, value, source, errors, options);
  16676. }
  16677. }
  16678. }
  16679. callback(errors);
  16680. };
  16681. var method2 = function method3(rule, value, callback, source, options) {
  16682. var errors = [];
  16683. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16684. if (validate) {
  16685. if (isEmptyValue(value) && !rule.required) {
  16686. return callback();
  16687. }
  16688. rules.required(rule, value, source, errors, options);
  16689. if (value !== void 0) {
  16690. rules.type(rule, value, source, errors, options);
  16691. }
  16692. }
  16693. callback(errors);
  16694. };
  16695. var number2 = function number3(rule, value, callback, source, options) {
  16696. var errors = [];
  16697. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16698. if (validate) {
  16699. if (value === "") {
  16700. value = void 0;
  16701. }
  16702. if (isEmptyValue(value) && !rule.required) {
  16703. return callback();
  16704. }
  16705. rules.required(rule, value, source, errors, options);
  16706. if (value !== void 0) {
  16707. rules.type(rule, value, source, errors, options);
  16708. rules.range(rule, value, source, errors, options);
  16709. }
  16710. }
  16711. callback(errors);
  16712. };
  16713. var _boolean = function _boolean2(rule, value, callback, source, options) {
  16714. var errors = [];
  16715. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16716. if (validate) {
  16717. if (isEmptyValue(value) && !rule.required) {
  16718. return callback();
  16719. }
  16720. rules.required(rule, value, source, errors, options);
  16721. if (value !== void 0) {
  16722. rules.type(rule, value, source, errors, options);
  16723. }
  16724. }
  16725. callback(errors);
  16726. };
  16727. var regexp2 = function regexp3(rule, value, callback, source, options) {
  16728. var errors = [];
  16729. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16730. if (validate) {
  16731. if (isEmptyValue(value) && !rule.required) {
  16732. return callback();
  16733. }
  16734. rules.required(rule, value, source, errors, options);
  16735. if (!isEmptyValue(value)) {
  16736. rules.type(rule, value, source, errors, options);
  16737. }
  16738. }
  16739. callback(errors);
  16740. };
  16741. var integer2 = function integer3(rule, value, callback, source, options) {
  16742. var errors = [];
  16743. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16744. if (validate) {
  16745. if (isEmptyValue(value) && !rule.required) {
  16746. return callback();
  16747. }
  16748. rules.required(rule, value, source, errors, options);
  16749. if (value !== void 0) {
  16750. rules.type(rule, value, source, errors, options);
  16751. rules.range(rule, value, source, errors, options);
  16752. }
  16753. }
  16754. callback(errors);
  16755. };
  16756. var floatFn = function floatFn2(rule, value, callback, source, options) {
  16757. var errors = [];
  16758. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16759. if (validate) {
  16760. if (isEmptyValue(value) && !rule.required) {
  16761. return callback();
  16762. }
  16763. rules.required(rule, value, source, errors, options);
  16764. if (value !== void 0) {
  16765. rules.type(rule, value, source, errors, options);
  16766. rules.range(rule, value, source, errors, options);
  16767. }
  16768. }
  16769. callback(errors);
  16770. };
  16771. var array2 = function array3(rule, value, callback, source, options) {
  16772. var errors = [];
  16773. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16774. if (validate) {
  16775. if ((value === void 0 || value === null) && !rule.required) {
  16776. return callback();
  16777. }
  16778. rules.required(rule, value, source, errors, options, "array");
  16779. if (value !== void 0 && value !== null) {
  16780. rules.type(rule, value, source, errors, options);
  16781. rules.range(rule, value, source, errors, options);
  16782. }
  16783. }
  16784. callback(errors);
  16785. };
  16786. var object2 = function object3(rule, value, callback, source, options) {
  16787. var errors = [];
  16788. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16789. if (validate) {
  16790. if (isEmptyValue(value) && !rule.required) {
  16791. return callback();
  16792. }
  16793. rules.required(rule, value, source, errors, options);
  16794. if (value !== void 0) {
  16795. rules.type(rule, value, source, errors, options);
  16796. }
  16797. }
  16798. callback(errors);
  16799. };
  16800. var ENUM = "enum";
  16801. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  16802. var errors = [];
  16803. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16804. if (validate) {
  16805. if (isEmptyValue(value) && !rule.required) {
  16806. return callback();
  16807. }
  16808. rules.required(rule, value, source, errors, options);
  16809. if (value !== void 0) {
  16810. rules[ENUM](rule, value, source, errors, options);
  16811. }
  16812. }
  16813. callback(errors);
  16814. };
  16815. var pattern2 = function pattern3(rule, value, callback, source, options) {
  16816. var errors = [];
  16817. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16818. if (validate) {
  16819. if (isEmptyValue(value, "string") && !rule.required) {
  16820. return callback();
  16821. }
  16822. rules.required(rule, value, source, errors, options);
  16823. if (!isEmptyValue(value, "string")) {
  16824. rules.pattern(rule, value, source, errors, options);
  16825. }
  16826. }
  16827. callback(errors);
  16828. };
  16829. var date2 = function date3(rule, value, callback, source, options) {
  16830. var errors = [];
  16831. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16832. if (validate) {
  16833. if (isEmptyValue(value, "date") && !rule.required) {
  16834. return callback();
  16835. }
  16836. rules.required(rule, value, source, errors, options);
  16837. if (!isEmptyValue(value, "date")) {
  16838. var dateObject;
  16839. if (value instanceof Date) {
  16840. dateObject = value;
  16841. } else {
  16842. dateObject = new Date(value);
  16843. }
  16844. rules.type(rule, dateObject, source, errors, options);
  16845. if (dateObject) {
  16846. rules.range(rule, dateObject.getTime(), source, errors, options);
  16847. }
  16848. }
  16849. }
  16850. callback(errors);
  16851. };
  16852. var required2 = function required3(rule, value, callback, source, options) {
  16853. var errors = [];
  16854. var type4 = Array.isArray(value) ? "array" : typeof value;
  16855. rules.required(rule, value, source, errors, options, type4);
  16856. callback(errors);
  16857. };
  16858. var type2 = function type3(rule, value, callback, source, options) {
  16859. var ruleType = rule.type;
  16860. var errors = [];
  16861. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16862. if (validate) {
  16863. if (isEmptyValue(value, ruleType) && !rule.required) {
  16864. return callback();
  16865. }
  16866. rules.required(rule, value, source, errors, options, ruleType);
  16867. if (!isEmptyValue(value, ruleType)) {
  16868. rules.type(rule, value, source, errors, options);
  16869. }
  16870. }
  16871. callback(errors);
  16872. };
  16873. var any = function any2(rule, value, callback, source, options) {
  16874. var errors = [];
  16875. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16876. if (validate) {
  16877. if (isEmptyValue(value) && !rule.required) {
  16878. return callback();
  16879. }
  16880. rules.required(rule, value, source, errors, options);
  16881. }
  16882. callback(errors);
  16883. };
  16884. var validators = {
  16885. string,
  16886. method: method2,
  16887. number: number2,
  16888. "boolean": _boolean,
  16889. regexp: regexp2,
  16890. integer: integer2,
  16891. "float": floatFn,
  16892. array: array2,
  16893. object: object2,
  16894. "enum": enumerable2,
  16895. pattern: pattern2,
  16896. date: date2,
  16897. url: type2,
  16898. hex: type2,
  16899. email: type2,
  16900. required: required2,
  16901. any
  16902. };
  16903. function newMessages() {
  16904. return {
  16905. "default": "Validation error on field %s",
  16906. required: "%s is required",
  16907. "enum": "%s must be one of %s",
  16908. whitespace: "%s cannot be empty",
  16909. date: {
  16910. format: "%s date %s is invalid for format %s",
  16911. parse: "%s date could not be parsed, %s is invalid ",
  16912. invalid: "%s date %s is invalid"
  16913. },
  16914. types: {
  16915. string: "%s is not a %s",
  16916. method: "%s is not a %s (function)",
  16917. array: "%s is not an %s",
  16918. object: "%s is not an %s",
  16919. number: "%s is not a %s",
  16920. date: "%s is not a %s",
  16921. "boolean": "%s is not a %s",
  16922. integer: "%s is not an %s",
  16923. "float": "%s is not a %s",
  16924. regexp: "%s is not a valid %s",
  16925. email: "%s is not a valid %s",
  16926. url: "%s is not a valid %s",
  16927. hex: "%s is not a valid %s"
  16928. },
  16929. string: {
  16930. len: "%s must be exactly %s characters",
  16931. min: "%s must be at least %s characters",
  16932. max: "%s cannot be longer than %s characters",
  16933. range: "%s must be between %s and %s characters"
  16934. },
  16935. number: {
  16936. len: "%s must equal %s",
  16937. min: "%s cannot be less than %s",
  16938. max: "%s cannot be greater than %s",
  16939. range: "%s must be between %s and %s"
  16940. },
  16941. array: {
  16942. len: "%s must be exactly %s in length",
  16943. min: "%s cannot be less than %s in length",
  16944. max: "%s cannot be greater than %s in length",
  16945. range: "%s must be between %s and %s in length"
  16946. },
  16947. pattern: {
  16948. mismatch: "%s value %s does not match pattern %s"
  16949. },
  16950. clone: function clone2() {
  16951. var cloned = JSON.parse(JSON.stringify(this));
  16952. cloned.clone = this.clone;
  16953. return cloned;
  16954. }
  16955. };
  16956. }
  16957. var messages = newMessages();
  16958. var Schema = /* @__PURE__ */ function() {
  16959. function Schema2(descriptor) {
  16960. this.rules = null;
  16961. this._messages = messages;
  16962. this.define(descriptor);
  16963. }
  16964. var _proto = Schema2.prototype;
  16965. _proto.define = function define(rules2) {
  16966. var _this = this;
  16967. if (!rules2) {
  16968. throw new Error("Cannot configure a schema with no rules");
  16969. }
  16970. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  16971. throw new Error("Rules must be an object");
  16972. }
  16973. this.rules = {};
  16974. Object.keys(rules2).forEach(function(name) {
  16975. var item = rules2[name];
  16976. _this.rules[name] = Array.isArray(item) ? item : [item];
  16977. });
  16978. };
  16979. _proto.messages = function messages2(_messages) {
  16980. if (_messages) {
  16981. this._messages = deepMerge(newMessages(), _messages);
  16982. }
  16983. return this._messages;
  16984. };
  16985. _proto.validate = function validate(source_, o2, oc) {
  16986. var _this2 = this;
  16987. if (o2 === void 0) {
  16988. o2 = {};
  16989. }
  16990. if (oc === void 0) {
  16991. oc = function oc2() {
  16992. };
  16993. }
  16994. var source = source_;
  16995. var options = o2;
  16996. var callback = oc;
  16997. if (typeof options === "function") {
  16998. callback = options;
  16999. options = {};
  17000. }
  17001. if (!this.rules || Object.keys(this.rules).length === 0) {
  17002. if (callback) {
  17003. callback(null, source);
  17004. }
  17005. return Promise.resolve(source);
  17006. }
  17007. function complete(results) {
  17008. var errors = [];
  17009. var fields = {};
  17010. function add(e) {
  17011. if (Array.isArray(e)) {
  17012. var _errors;
  17013. errors = (_errors = errors).concat.apply(_errors, e);
  17014. } else {
  17015. errors.push(e);
  17016. }
  17017. }
  17018. for (var i = 0; i < results.length; i++) {
  17019. add(results[i]);
  17020. }
  17021. if (!errors.length) {
  17022. callback(null, source);
  17023. } else {
  17024. fields = convertFieldsError(errors);
  17025. callback(errors, fields);
  17026. }
  17027. }
  17028. if (options.messages) {
  17029. var messages$1 = this.messages();
  17030. if (messages$1 === messages) {
  17031. messages$1 = newMessages();
  17032. }
  17033. deepMerge(messages$1, options.messages);
  17034. options.messages = messages$1;
  17035. } else {
  17036. options.messages = this.messages();
  17037. }
  17038. var series = {};
  17039. var keys2 = options.keys || Object.keys(this.rules);
  17040. keys2.forEach(function(z) {
  17041. var arr = _this2.rules[z];
  17042. var value = source[z];
  17043. arr.forEach(function(r) {
  17044. var rule = r;
  17045. if (typeof rule.transform === "function") {
  17046. if (source === source_) {
  17047. source = _extends$1({}, source);
  17048. }
  17049. value = source[z] = rule.transform(value);
  17050. }
  17051. if (typeof rule === "function") {
  17052. rule = {
  17053. validator: rule
  17054. };
  17055. } else {
  17056. rule = _extends$1({}, rule);
  17057. }
  17058. rule.validator = _this2.getValidationMethod(rule);
  17059. if (!rule.validator) {
  17060. return;
  17061. }
  17062. rule.field = z;
  17063. rule.fullField = rule.fullField || z;
  17064. rule.type = _this2.getType(rule);
  17065. series[z] = series[z] || [];
  17066. series[z].push({
  17067. rule,
  17068. value,
  17069. source,
  17070. field: z
  17071. });
  17072. });
  17073. });
  17074. var errorFields = {};
  17075. return asyncMap(series, options, function(data2, doIt) {
  17076. var rule = data2.rule;
  17077. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  17078. deep = deep && (rule.required || !rule.required && data2.value);
  17079. rule.field = data2.field;
  17080. function addFullField(key, schema) {
  17081. return _extends$1({}, schema, {
  17082. fullField: rule.fullField + "." + key,
  17083. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  17084. });
  17085. }
  17086. function cb(e) {
  17087. if (e === void 0) {
  17088. e = [];
  17089. }
  17090. var errorList = Array.isArray(e) ? e : [e];
  17091. if (!options.suppressWarning && errorList.length) {
  17092. Schema2.warning("async-validator:", errorList);
  17093. }
  17094. if (errorList.length && rule.message !== void 0) {
  17095. errorList = [].concat(rule.message);
  17096. }
  17097. var filledErrors = errorList.map(complementError(rule, source));
  17098. if (options.first && filledErrors.length) {
  17099. errorFields[rule.field] = 1;
  17100. return doIt(filledErrors);
  17101. }
  17102. if (!deep) {
  17103. doIt(filledErrors);
  17104. } else {
  17105. if (rule.required && !data2.value) {
  17106. if (rule.message !== void 0) {
  17107. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  17108. } else if (options.error) {
  17109. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  17110. }
  17111. return doIt(filledErrors);
  17112. }
  17113. var fieldsSchema = {};
  17114. if (rule.defaultField) {
  17115. Object.keys(data2.value).map(function(key) {
  17116. fieldsSchema[key] = rule.defaultField;
  17117. });
  17118. }
  17119. fieldsSchema = _extends$1({}, fieldsSchema, data2.rule.fields);
  17120. var paredFieldsSchema = {};
  17121. Object.keys(fieldsSchema).forEach(function(field) {
  17122. var fieldSchema = fieldsSchema[field];
  17123. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  17124. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  17125. });
  17126. var schema = new Schema2(paredFieldsSchema);
  17127. schema.messages(options.messages);
  17128. if (data2.rule.options) {
  17129. data2.rule.options.messages = options.messages;
  17130. data2.rule.options.error = options.error;
  17131. }
  17132. schema.validate(data2.value, data2.rule.options || options, function(errs) {
  17133. var finalErrors = [];
  17134. if (filledErrors && filledErrors.length) {
  17135. finalErrors.push.apply(finalErrors, filledErrors);
  17136. }
  17137. if (errs && errs.length) {
  17138. finalErrors.push.apply(finalErrors, errs);
  17139. }
  17140. doIt(finalErrors.length ? finalErrors : null);
  17141. });
  17142. }
  17143. }
  17144. var res;
  17145. if (rule.asyncValidator) {
  17146. res = rule.asyncValidator(rule, data2.value, cb, data2.source, options);
  17147. } else if (rule.validator) {
  17148. res = rule.validator(rule, data2.value, cb, data2.source, options);
  17149. if (res === true) {
  17150. cb();
  17151. } else if (res === false) {
  17152. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  17153. } else if (res instanceof Array) {
  17154. cb(res);
  17155. } else if (res instanceof Error) {
  17156. cb(res.message);
  17157. }
  17158. }
  17159. if (res && res.then) {
  17160. res.then(function() {
  17161. return cb();
  17162. }, function(e) {
  17163. return cb(e);
  17164. });
  17165. }
  17166. }, function(results) {
  17167. complete(results);
  17168. }, source);
  17169. };
  17170. _proto.getType = function getType(rule) {
  17171. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  17172. rule.type = "pattern";
  17173. }
  17174. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  17175. throw new Error(format("Unknown rule type %s", rule.type));
  17176. }
  17177. return rule.type || "string";
  17178. };
  17179. _proto.getValidationMethod = function getValidationMethod(rule) {
  17180. if (typeof rule.validator === "function") {
  17181. return rule.validator;
  17182. }
  17183. var keys2 = Object.keys(rule);
  17184. var messageIndex = keys2.indexOf("message");
  17185. if (messageIndex !== -1) {
  17186. keys2.splice(messageIndex, 1);
  17187. }
  17188. if (keys2.length === 1 && keys2[0] === "required") {
  17189. return validators.required;
  17190. }
  17191. return validators[this.getType(rule)] || void 0;
  17192. };
  17193. return Schema2;
  17194. }();
  17195. Schema.register = function register(type4, validator) {
  17196. if (typeof validator !== "function") {
  17197. throw new Error("Cannot register a validator by type, validator is not a function");
  17198. }
  17199. validators[type4] = validator;
  17200. };
  17201. Schema.warning = warning;
  17202. Schema.messages = messages;
  17203. Schema.validators = validators;
  17204. const formItemValidateStates = [
  17205. "",
  17206. "error",
  17207. "validating",
  17208. "success"
  17209. ];
  17210. const formItemProps = buildProps({
  17211. label: String,
  17212. labelWidth: {
  17213. type: [String, Number],
  17214. default: ""
  17215. },
  17216. prop: {
  17217. type: definePropType([String, Array])
  17218. },
  17219. required: {
  17220. type: Boolean,
  17221. default: void 0
  17222. },
  17223. rules: {
  17224. type: definePropType([Object, Array])
  17225. },
  17226. error: String,
  17227. validateStatus: {
  17228. type: String,
  17229. values: formItemValidateStates
  17230. },
  17231. for: String,
  17232. inlineMessage: {
  17233. type: [String, Boolean],
  17234. default: ""
  17235. },
  17236. showMessage: {
  17237. type: Boolean,
  17238. default: true
  17239. },
  17240. size: {
  17241. type: String,
  17242. values: componentSizes
  17243. }
  17244. });
  17245. const COMPONENT_NAME$2 = "ElLabelWrap";
  17246. var FormLabelWrap = defineComponent({
  17247. name: COMPONENT_NAME$2,
  17248. props: {
  17249. isAutoWidth: Boolean,
  17250. updateAll: Boolean
  17251. },
  17252. setup(props, {
  17253. slots
  17254. }) {
  17255. const formContext = inject(formContextKey, void 0);
  17256. const formItemContext = inject(formItemContextKey);
  17257. if (!formItemContext)
  17258. throwError(COMPONENT_NAME$2, "usage: <el-form-item><label-wrap /></el-form-item>");
  17259. const ns = useNamespace("form");
  17260. const el = ref();
  17261. const computedWidth = ref(0);
  17262. const getLabelWidth = () => {
  17263. var _a2;
  17264. if ((_a2 = el.value) == null ? void 0 : _a2.firstElementChild) {
  17265. const width = window.getComputedStyle(el.value.firstElementChild).width;
  17266. return Math.ceil(Number.parseFloat(width));
  17267. } else {
  17268. return 0;
  17269. }
  17270. };
  17271. const updateLabelWidth = (action = "update") => {
  17272. nextTick(() => {
  17273. if (slots.default && props.isAutoWidth) {
  17274. if (action === "update") {
  17275. computedWidth.value = getLabelWidth();
  17276. } else if (action === "remove") {
  17277. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  17278. }
  17279. }
  17280. });
  17281. };
  17282. const updateLabelWidthFn = () => updateLabelWidth("update");
  17283. onMounted(() => {
  17284. updateLabelWidthFn();
  17285. });
  17286. onBeforeUnmount(() => {
  17287. updateLabelWidth("remove");
  17288. });
  17289. onUpdated(() => updateLabelWidthFn());
  17290. watch(computedWidth, (val, oldVal) => {
  17291. if (props.updateAll) {
  17292. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  17293. }
  17294. });
  17295. useResizeObserver(computed(() => {
  17296. var _a2, _b2;
  17297. return (_b2 = (_a2 = el.value) == null ? void 0 : _a2.firstElementChild) != null ? _b2 : null;
  17298. }), updateLabelWidthFn);
  17299. return () => {
  17300. var _a2, _b2;
  17301. if (!slots)
  17302. return null;
  17303. const {
  17304. isAutoWidth
  17305. } = props;
  17306. if (isAutoWidth) {
  17307. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  17308. const style = {};
  17309. if (autoLabelWidth && autoLabelWidth !== "auto") {
  17310. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  17311. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  17312. if (marginWidth) {
  17313. style[marginPosition] = `${marginWidth}px`;
  17314. }
  17315. }
  17316. return createVNode("div", {
  17317. "ref": el,
  17318. "class": [ns.be("item", "label-wrap")],
  17319. "style": style
  17320. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
  17321. } else {
  17322. return createVNode(Fragment, {
  17323. "ref": el
  17324. }, [(_b2 = slots.default) == null ? void 0 : _b2.call(slots)]);
  17325. }
  17326. };
  17327. }
  17328. });
  17329. const _hoisted_1$j = ["for"];
  17330. const __default__$8 = {
  17331. name: "ElFormItem"
  17332. };
  17333. const _sfc_main$t = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
  17334. props: formItemProps,
  17335. setup(__props, { expose }) {
  17336. const props = __props;
  17337. const slots = useSlots();
  17338. const formContext = inject(formContextKey, void 0);
  17339. const parentFormItemContext = inject(formItemContextKey, void 0);
  17340. const _size = useSize(void 0, { formItem: false });
  17341. const ns = useNamespace("form-item");
  17342. const validateState = ref("");
  17343. const validateStateDebounced = refDebounced(validateState, 100);
  17344. const validateMessage = ref("");
  17345. const formItemRef = ref();
  17346. let initialValue = void 0;
  17347. let isResettingField = false;
  17348. const labelStyle = computed(() => {
  17349. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  17350. return {};
  17351. }
  17352. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17353. if (labelWidth)
  17354. return { width: labelWidth };
  17355. return {};
  17356. });
  17357. const contentStyle = computed(() => {
  17358. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  17359. return {};
  17360. }
  17361. if (!props.label && !props.labelWidth && isNested) {
  17362. return {};
  17363. }
  17364. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17365. if (!props.label && !slots.label) {
  17366. return { marginLeft: labelWidth };
  17367. }
  17368. return {};
  17369. });
  17370. const formItemClasses = computed(() => [
  17371. ns.b(),
  17372. ns.m(_size.value),
  17373. ns.is("error", validateState.value === "error"),
  17374. ns.is("validating", validateState.value === "validating"),
  17375. ns.is("success", validateState.value === "success"),
  17376. ns.is("required", isRequired.value || props.required),
  17377. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  17378. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  17379. ]);
  17380. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  17381. const validateClasses = computed(() => [
  17382. ns.e("error"),
  17383. { [ns.em("error", "inline")]: _inlineMessage.value }
  17384. ]);
  17385. const propString = computed(() => {
  17386. if (!props.prop)
  17387. return "";
  17388. return isString(props.prop) ? props.prop : props.prop.join(".");
  17389. });
  17390. const labelFor = computed(() => props.for || propString.value);
  17391. const isNested = !!parentFormItemContext;
  17392. const fieldValue = computed(() => {
  17393. const model = formContext == null ? void 0 : formContext.model;
  17394. if (!model || !props.prop) {
  17395. return;
  17396. }
  17397. return getProp(model, props.prop).value;
  17398. });
  17399. const _rules = computed(() => {
  17400. const rules2 = props.rules ? castArray$1(props.rules) : [];
  17401. const formRules = formContext == null ? void 0 : formContext.rules;
  17402. if (formRules && props.prop) {
  17403. const _rules2 = getProp(formRules, props.prop).value;
  17404. if (_rules2) {
  17405. rules2.push(...castArray$1(_rules2));
  17406. }
  17407. }
  17408. if (props.required !== void 0) {
  17409. rules2.push({ required: !!props.required });
  17410. }
  17411. return rules2;
  17412. });
  17413. const validateEnabled = computed(() => _rules.value.length > 0);
  17414. const getFilteredRule = (trigger) => {
  17415. const rules2 = _rules.value;
  17416. return rules2.filter((rule) => {
  17417. if (!rule.trigger || !trigger)
  17418. return true;
  17419. if (Array.isArray(rule.trigger)) {
  17420. return rule.trigger.includes(trigger);
  17421. } else {
  17422. return rule.trigger === trigger;
  17423. }
  17424. }).map((_a2) => {
  17425. var _b2 = _a2, { trigger: trigger2 } = _b2, rule = __objRest(_b2, ["trigger"]);
  17426. return rule;
  17427. });
  17428. };
  17429. const isRequired = computed(() => _rules.value.some((rule) => rule.required === true));
  17430. const shouldShowError = computed(() => {
  17431. var _a2;
  17432. return validateStateDebounced.value === "error" && props.showMessage && ((_a2 = formContext == null ? void 0 : formContext.showMessage) != null ? _a2 : true);
  17433. });
  17434. const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  17435. const setValidationState = (state) => {
  17436. validateState.value = state;
  17437. };
  17438. const onValidationFailed = (error) => {
  17439. var _a2, _b2;
  17440. const { errors, fields } = error;
  17441. if (!errors || !fields) {
  17442. console.error(error);
  17443. }
  17444. setValidationState("error");
  17445. validateMessage.value = errors ? (_b2 = (_a2 = errors == null ? void 0 : errors[0]) == null ? void 0 : _a2.message) != null ? _b2 : `${props.prop} is required` : "";
  17446. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  17447. };
  17448. const onValidationSucceeded = () => {
  17449. setValidationState("success");
  17450. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  17451. };
  17452. const doValidate = async (rules2) => {
  17453. const modelName = propString.value;
  17454. const validator = new Schema({
  17455. [modelName]: rules2
  17456. });
  17457. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  17458. onValidationSucceeded();
  17459. return true;
  17460. }).catch((err) => {
  17461. onValidationFailed(err);
  17462. return Promise.reject(err);
  17463. });
  17464. };
  17465. const validate = async (trigger, callback) => {
  17466. if (isResettingField) {
  17467. isResettingField = false;
  17468. return false;
  17469. }
  17470. const hasCallback = isFunction(callback);
  17471. if (!validateEnabled.value) {
  17472. callback == null ? void 0 : callback(false);
  17473. return false;
  17474. }
  17475. const rules2 = getFilteredRule(trigger);
  17476. if (rules2.length === 0) {
  17477. callback == null ? void 0 : callback(true);
  17478. return true;
  17479. }
  17480. setValidationState("validating");
  17481. return doValidate(rules2).then(() => {
  17482. callback == null ? void 0 : callback(true);
  17483. return true;
  17484. }).catch((err) => {
  17485. const { fields } = err;
  17486. callback == null ? void 0 : callback(false, fields);
  17487. return hasCallback ? false : Promise.reject(fields);
  17488. });
  17489. };
  17490. const clearValidate = () => {
  17491. setValidationState("");
  17492. validateMessage.value = "";
  17493. };
  17494. const resetField = async () => {
  17495. const model = formContext == null ? void 0 : formContext.model;
  17496. if (!model || !props.prop)
  17497. return;
  17498. const computedValue = getProp(model, props.prop);
  17499. if (!isEqual(computedValue.value, initialValue)) {
  17500. isResettingField = true;
  17501. }
  17502. computedValue.value = initialValue;
  17503. await nextTick();
  17504. clearValidate();
  17505. };
  17506. watch(() => props.error, (val) => {
  17507. validateMessage.value = val || "";
  17508. setValidationState(val ? "error" : "");
  17509. }, { immediate: true });
  17510. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  17511. const context = reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  17512. $el: formItemRef,
  17513. size: _size,
  17514. validateState,
  17515. resetField,
  17516. clearValidate,
  17517. validate
  17518. }));
  17519. provide(formItemContextKey, context);
  17520. onMounted(() => {
  17521. if (props.prop) {
  17522. formContext == null ? void 0 : formContext.addField(context);
  17523. initialValue = clone(fieldValue.value);
  17524. }
  17525. });
  17526. onBeforeUnmount(() => {
  17527. formContext == null ? void 0 : formContext.removeField(context);
  17528. });
  17529. expose({
  17530. size: _size,
  17531. validateMessage,
  17532. validateState,
  17533. validate,
  17534. clearValidate,
  17535. resetField
  17536. });
  17537. return (_ctx, _cache) => {
  17538. var _a2;
  17539. return openBlock(), createElementBlock("div", {
  17540. ref_key: "formItemRef",
  17541. ref: formItemRef,
  17542. class: normalizeClass(unref(formItemClasses))
  17543. }, [
  17544. createVNode(unref(FormLabelWrap), {
  17545. "is-auto-width": unref(labelStyle).width === "auto",
  17546. "update-all": ((_a2 = unref(formContext)) == null ? void 0 : _a2.labelWidth) === "auto"
  17547. }, {
  17548. default: withCtx(() => [
  17549. _ctx.label || _ctx.$slots.label ? (openBlock(), createElementBlock("label", {
  17550. key: 0,
  17551. for: unref(labelFor),
  17552. class: normalizeClass(unref(ns).e("label")),
  17553. style: normalizeStyle(unref(labelStyle))
  17554. }, [
  17555. renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
  17556. createTextVNode(toDisplayString(unref(currentLabel)), 1)
  17557. ])
  17558. ], 14, _hoisted_1$j)) : createCommentVNode("v-if", true)
  17559. ]),
  17560. _: 3
  17561. }, 8, ["is-auto-width", "update-all"]),
  17562. createElementVNode("div", {
  17563. class: normalizeClass(unref(ns).e("content")),
  17564. style: normalizeStyle(unref(contentStyle))
  17565. }, [
  17566. renderSlot(_ctx.$slots, "default"),
  17567. createVNode(Transition, {
  17568. name: `${unref(ns).namespace.value}-zoom-in-top`
  17569. }, {
  17570. default: withCtx(() => [
  17571. unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
  17572. key: 0,
  17573. error: validateMessage.value
  17574. }, () => [
  17575. createElementVNode("div", {
  17576. class: normalizeClass(unref(validateClasses))
  17577. }, toDisplayString(validateMessage.value), 3)
  17578. ]) : createCommentVNode("v-if", true)
  17579. ]),
  17580. _: 3
  17581. }, 8, ["name"])
  17582. ], 6)
  17583. ], 2);
  17584. };
  17585. }
  17586. }));
  17587. var FormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form-item.vue"]]);
  17588. const ElForm = withInstall(Form, {
  17589. FormItem
  17590. });
  17591. const ElFormItem = withNoopInstall(FormItem);
  17592. const imageViewerProps = buildProps({
  17593. urlList: {
  17594. type: definePropType(Array),
  17595. default: () => mutable([])
  17596. },
  17597. zIndex: {
  17598. type: Number
  17599. },
  17600. initialIndex: {
  17601. type: Number,
  17602. default: 0
  17603. },
  17604. infinite: {
  17605. type: Boolean,
  17606. default: true
  17607. },
  17608. hideOnClickModal: {
  17609. type: Boolean,
  17610. default: false
  17611. },
  17612. teleported: {
  17613. type: Boolean,
  17614. default: false
  17615. }
  17616. });
  17617. const imageViewerEmits = {
  17618. close: () => true,
  17619. switch: (index) => typeof index === "number"
  17620. };
  17621. const _hoisted_1$i = ["src"];
  17622. const __default__$7 = {
  17623. name: "ElImageViewer"
  17624. };
  17625. const _sfc_main$s = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
  17626. props: imageViewerProps,
  17627. emits: imageViewerEmits,
  17628. setup(__props, { emit }) {
  17629. const props = __props;
  17630. const Mode = {
  17631. CONTAIN: {
  17632. name: "contain",
  17633. icon: markRaw(fullScreen)
  17634. },
  17635. ORIGINAL: {
  17636. name: "original",
  17637. icon: markRaw(scaleToOriginal)
  17638. }
  17639. };
  17640. const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
  17641. const { t } = useLocale();
  17642. const ns = useNamespace("image-viewer");
  17643. const { nextZIndex } = useZIndex();
  17644. const wrapper = ref();
  17645. const imgRefs = ref([]);
  17646. const scopeEventListener = effectScope();
  17647. const loading2 = ref(true);
  17648. const index = ref(props.initialIndex);
  17649. const mode = ref(Mode.CONTAIN);
  17650. const transform = ref({
  17651. scale: 1,
  17652. deg: 0,
  17653. offsetX: 0,
  17654. offsetY: 0,
  17655. enableTransition: false
  17656. });
  17657. const isSingle = computed(() => {
  17658. const { urlList } = props;
  17659. return urlList.length <= 1;
  17660. });
  17661. const isFirst = computed(() => {
  17662. return index.value === 0;
  17663. });
  17664. const isLast = computed(() => {
  17665. return index.value === props.urlList.length - 1;
  17666. });
  17667. const currentImg = computed(() => {
  17668. return props.urlList[index.value];
  17669. });
  17670. const imgStyle = computed(() => {
  17671. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  17672. let translateX = offsetX / scale;
  17673. let translateY = offsetY / scale;
  17674. switch (deg % 360) {
  17675. case 90:
  17676. case -270:
  17677. [translateX, translateY] = [translateY, -translateX];
  17678. break;
  17679. case 180:
  17680. case -180:
  17681. [translateX, translateY] = [-translateX, -translateY];
  17682. break;
  17683. case 270:
  17684. case -90:
  17685. [translateX, translateY] = [-translateY, translateX];
  17686. break;
  17687. }
  17688. const style = {
  17689. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  17690. transition: enableTransition ? "transform .3s" : ""
  17691. };
  17692. if (mode.value.name === Mode.CONTAIN.name) {
  17693. style.maxWidth = style.maxHeight = "100%";
  17694. }
  17695. return style;
  17696. });
  17697. const computedZIndex = computed(() => {
  17698. return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  17699. });
  17700. function hide2() {
  17701. unregisterEventListener();
  17702. emit("close");
  17703. }
  17704. function registerEventListener() {
  17705. const keydownHandler = throttle((e) => {
  17706. switch (e.code) {
  17707. case EVENT_CODE.esc:
  17708. hide2();
  17709. break;
  17710. case EVENT_CODE.space:
  17711. toggleMode();
  17712. break;
  17713. case EVENT_CODE.left:
  17714. prev();
  17715. break;
  17716. case EVENT_CODE.up:
  17717. handleActions("zoomIn");
  17718. break;
  17719. case EVENT_CODE.right:
  17720. next();
  17721. break;
  17722. case EVENT_CODE.down:
  17723. handleActions("zoomOut");
  17724. break;
  17725. }
  17726. });
  17727. const mousewheelHandler = throttle((e) => {
  17728. const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
  17729. if (delta > 0) {
  17730. handleActions("zoomIn", {
  17731. zoomRate: 1.2,
  17732. enableTransition: false
  17733. });
  17734. } else {
  17735. handleActions("zoomOut", {
  17736. zoomRate: 1.2,
  17737. enableTransition: false
  17738. });
  17739. }
  17740. });
  17741. scopeEventListener.run(() => {
  17742. useEventListener(document, "keydown", keydownHandler);
  17743. useEventListener(document, mousewheelEventName, mousewheelHandler);
  17744. });
  17745. }
  17746. function unregisterEventListener() {
  17747. scopeEventListener.stop();
  17748. }
  17749. function handleImgLoad() {
  17750. loading2.value = false;
  17751. }
  17752. function handleImgError(e) {
  17753. loading2.value = false;
  17754. e.target.alt = t("el.image.error");
  17755. }
  17756. function handleMouseDown(e) {
  17757. if (loading2.value || e.button !== 0 || !wrapper.value)
  17758. return;
  17759. transform.value.enableTransition = false;
  17760. const { offsetX, offsetY } = transform.value;
  17761. const startX = e.pageX;
  17762. const startY = e.pageY;
  17763. const dragHandler = throttle((ev) => {
  17764. transform.value = __spreadProps(__spreadValues({}, transform.value), {
  17765. offsetX: offsetX + ev.pageX - startX,
  17766. offsetY: offsetY + ev.pageY - startY
  17767. });
  17768. });
  17769. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  17770. useEventListener(document, "mouseup", () => {
  17771. removeMousemove();
  17772. });
  17773. e.preventDefault();
  17774. }
  17775. function reset() {
  17776. transform.value = {
  17777. scale: 1,
  17778. deg: 0,
  17779. offsetX: 0,
  17780. offsetY: 0,
  17781. enableTransition: false
  17782. };
  17783. }
  17784. function toggleMode() {
  17785. if (loading2.value)
  17786. return;
  17787. const modeNames = Object.keys(Mode);
  17788. const modeValues = Object.values(Mode);
  17789. const currentMode = mode.value.name;
  17790. const index2 = modeValues.findIndex((i) => i.name === currentMode);
  17791. const nextIndex = (index2 + 1) % modeNames.length;
  17792. mode.value = Mode[modeNames[nextIndex]];
  17793. reset();
  17794. }
  17795. function prev() {
  17796. if (isFirst.value && !props.infinite)
  17797. return;
  17798. const len = props.urlList.length;
  17799. index.value = (index.value - 1 + len) % len;
  17800. }
  17801. function next() {
  17802. if (isLast.value && !props.infinite)
  17803. return;
  17804. const len = props.urlList.length;
  17805. index.value = (index.value + 1) % len;
  17806. }
  17807. function handleActions(action, options = {}) {
  17808. if (loading2.value)
  17809. return;
  17810. const { zoomRate, rotateDeg, enableTransition } = __spreadValues({
  17811. zoomRate: 1.4,
  17812. rotateDeg: 90,
  17813. enableTransition: true
  17814. }, options);
  17815. switch (action) {
  17816. case "zoomOut":
  17817. if (transform.value.scale > 0.2) {
  17818. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  17819. }
  17820. break;
  17821. case "zoomIn":
  17822. if (transform.value.scale < 7) {
  17823. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  17824. }
  17825. break;
  17826. case "clockwise":
  17827. transform.value.deg += rotateDeg;
  17828. break;
  17829. case "anticlockwise":
  17830. transform.value.deg -= rotateDeg;
  17831. break;
  17832. }
  17833. transform.value.enableTransition = enableTransition;
  17834. }
  17835. watch(currentImg, () => {
  17836. nextTick(() => {
  17837. const $img = imgRefs.value[0];
  17838. if (!($img == null ? void 0 : $img.complete)) {
  17839. loading2.value = true;
  17840. }
  17841. });
  17842. });
  17843. watch(index, (val) => {
  17844. reset();
  17845. emit("switch", val);
  17846. });
  17847. onMounted(() => {
  17848. var _a2, _b2;
  17849. registerEventListener();
  17850. (_b2 = (_a2 = wrapper.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  17851. });
  17852. return (_ctx, _cache) => {
  17853. return openBlock(), createBlock(Teleport, {
  17854. to: "body",
  17855. disabled: !_ctx.teleported
  17856. }, [
  17857. createVNode(Transition, {
  17858. name: "viewer-fade",
  17859. appear: ""
  17860. }, {
  17861. default: withCtx(() => [
  17862. createElementVNode("div", {
  17863. ref_key: "wrapper",
  17864. ref: wrapper,
  17865. tabindex: -1,
  17866. class: normalizeClass(unref(ns).e("wrapper")),
  17867. style: normalizeStyle({ zIndex: unref(computedZIndex) })
  17868. }, [
  17869. createElementVNode("div", {
  17870. class: normalizeClass(unref(ns).e("mask")),
  17871. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.hideOnClickModal && hide2(), ["self"]))
  17872. }, null, 2),
  17873. createCommentVNode(" CLOSE "),
  17874. createElementVNode("span", {
  17875. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  17876. onClick: hide2
  17877. }, [
  17878. createVNode(unref(ElIcon), null, {
  17879. default: withCtx(() => [
  17880. createVNode(unref(close))
  17881. ]),
  17882. _: 1
  17883. })
  17884. ], 2),
  17885. createCommentVNode(" ARROW "),
  17886. !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  17887. createElementVNode("span", {
  17888. class: normalizeClass([
  17889. unref(ns).e("btn"),
  17890. unref(ns).e("prev"),
  17891. unref(ns).is("disabled", !_ctx.infinite && unref(isFirst))
  17892. ]),
  17893. onClick: prev
  17894. }, [
  17895. createVNode(unref(ElIcon), null, {
  17896. default: withCtx(() => [
  17897. createVNode(unref(arrowLeft))
  17898. ]),
  17899. _: 1
  17900. })
  17901. ], 2),
  17902. createElementVNode("span", {
  17903. class: normalizeClass([
  17904. unref(ns).e("btn"),
  17905. unref(ns).e("next"),
  17906. unref(ns).is("disabled", !_ctx.infinite && unref(isLast))
  17907. ]),
  17908. onClick: next
  17909. }, [
  17910. createVNode(unref(ElIcon), null, {
  17911. default: withCtx(() => [
  17912. createVNode(unref(arrowRight))
  17913. ]),
  17914. _: 1
  17915. })
  17916. ], 2)
  17917. ], 64)) : createCommentVNode("v-if", true),
  17918. createCommentVNode(" ACTIONS "),
  17919. createElementVNode("div", {
  17920. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
  17921. }, [
  17922. createElementVNode("div", {
  17923. class: normalizeClass(unref(ns).e("actions__inner"))
  17924. }, [
  17925. createVNode(unref(ElIcon), {
  17926. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  17927. }, {
  17928. default: withCtx(() => [
  17929. createVNode(unref(zoomOut))
  17930. ]),
  17931. _: 1
  17932. }),
  17933. createVNode(unref(ElIcon), {
  17934. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  17935. }, {
  17936. default: withCtx(() => [
  17937. createVNode(unref(zoomIn))
  17938. ]),
  17939. _: 1
  17940. }),
  17941. createElementVNode("i", {
  17942. class: normalizeClass(unref(ns).e("actions__divider"))
  17943. }, null, 2),
  17944. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  17945. default: withCtx(() => [
  17946. (openBlock(), createBlock(resolveDynamicComponent(mode.value.icon)))
  17947. ]),
  17948. _: 1
  17949. }),
  17950. createElementVNode("i", {
  17951. class: normalizeClass(unref(ns).e("actions__divider"))
  17952. }, null, 2),
  17953. createVNode(unref(ElIcon), {
  17954. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  17955. }, {
  17956. default: withCtx(() => [
  17957. createVNode(unref(refreshLeft))
  17958. ]),
  17959. _: 1
  17960. }),
  17961. createVNode(unref(ElIcon), {
  17962. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  17963. }, {
  17964. default: withCtx(() => [
  17965. createVNode(unref(refreshRight))
  17966. ]),
  17967. _: 1
  17968. })
  17969. ], 2)
  17970. ], 2),
  17971. createCommentVNode(" CANVAS "),
  17972. createElementVNode("div", {
  17973. class: normalizeClass(unref(ns).e("canvas"))
  17974. }, [
  17975. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url2, i) => {
  17976. return withDirectives((openBlock(), createElementBlock("img", {
  17977. ref_for: true,
  17978. ref: (el) => imgRefs.value[i] = el,
  17979. key: url2,
  17980. src: url2,
  17981. style: normalizeStyle(unref(imgStyle)),
  17982. class: normalizeClass(unref(ns).e("img")),
  17983. onLoad: handleImgLoad,
  17984. onError: handleImgError,
  17985. onMousedown: handleMouseDown
  17986. }, null, 46, _hoisted_1$i)), [
  17987. [vShow, i === index.value]
  17988. ]);
  17989. }), 128))
  17990. ], 2),
  17991. renderSlot(_ctx.$slots, "default")
  17992. ], 6)
  17993. ]),
  17994. _: 3
  17995. })
  17996. ], 8, ["disabled"]);
  17997. };
  17998. }
  17999. }));
  18000. 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"]]);
  18001. const ElImageViewer = withInstall(ImageViewer);
  18002. const imageProps = buildProps({
  18003. appendToBody: {
  18004. type: Boolean,
  18005. default: void 0
  18006. },
  18007. hideOnClickModal: {
  18008. type: Boolean,
  18009. default: false
  18010. },
  18011. src: {
  18012. type: String,
  18013. default: ""
  18014. },
  18015. fit: {
  18016. type: String,
  18017. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  18018. default: ""
  18019. },
  18020. lazy: {
  18021. type: Boolean,
  18022. default: false
  18023. },
  18024. scrollContainer: {
  18025. type: definePropType([String, Object])
  18026. },
  18027. previewSrcList: {
  18028. type: definePropType(Array),
  18029. default: () => mutable([])
  18030. },
  18031. previewTeleported: {
  18032. type: Boolean,
  18033. default: false
  18034. },
  18035. zIndex: {
  18036. type: Number
  18037. },
  18038. initialIndex: {
  18039. type: Number,
  18040. default: 0
  18041. },
  18042. infinite: {
  18043. type: Boolean,
  18044. default: true
  18045. }
  18046. });
  18047. const imageEmits = {
  18048. error: (evt) => evt instanceof Event,
  18049. switch: (val) => isNumber(val),
  18050. close: () => true
  18051. };
  18052. const _hoisted_1$h = ["src"];
  18053. const _hoisted_2$f = { key: 0 };
  18054. const __default__$6 = {
  18055. name: "ElImage"
  18056. };
  18057. const _sfc_main$r = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
  18058. props: imageProps,
  18059. emits: imageEmits,
  18060. setup(__props, { emit }) {
  18061. const props = __props;
  18062. let prevOverflow = "";
  18063. useDeprecated({
  18064. scope: "el-image",
  18065. from: "append-to-body",
  18066. replacement: "preview-teleported",
  18067. version: "2.2.0",
  18068. ref: "https://element-plus.org/en-US/component/image.html#image-attributess"
  18069. }, computed(() => isBoolean(props.appendToBody)));
  18070. const { t } = useLocale();
  18071. const ns = useNamespace("image");
  18072. const attrs = useAttrs();
  18073. const hasLoadError = ref(false);
  18074. const loading2 = ref(true);
  18075. const imgWidth = ref(0);
  18076. const imgHeight = ref(0);
  18077. const showViewer = ref(false);
  18078. const container = ref();
  18079. const _scrollContainer = ref();
  18080. let stopScrollListener;
  18081. let stopWheelListener;
  18082. const containerStyle = computed(() => attrs.value.style);
  18083. const imageStyle = computed(() => {
  18084. const { fit } = props;
  18085. if (isClient$1 && fit) {
  18086. return { objectFit: fit };
  18087. }
  18088. return {};
  18089. });
  18090. const preview = computed(() => {
  18091. const { previewSrcList } = props;
  18092. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  18093. });
  18094. const teleported = computed(() => {
  18095. return props.appendToBody || props.previewTeleported;
  18096. });
  18097. const imageIndex = computed(() => {
  18098. const { previewSrcList, initialIndex } = props;
  18099. let previewIndex = initialIndex;
  18100. if (initialIndex > previewSrcList.length - 1) {
  18101. previewIndex = 0;
  18102. }
  18103. return previewIndex;
  18104. });
  18105. const loadImage = () => {
  18106. if (!isClient$1)
  18107. return;
  18108. loading2.value = true;
  18109. hasLoadError.value = false;
  18110. const img = new Image();
  18111. const currentImageSrc = props.src;
  18112. img.addEventListener("load", (e) => {
  18113. if (currentImageSrc !== props.src) {
  18114. return;
  18115. }
  18116. handleLoad(e, img);
  18117. });
  18118. img.addEventListener("error", (e) => {
  18119. if (currentImageSrc !== props.src) {
  18120. return;
  18121. }
  18122. handleError(e);
  18123. });
  18124. Object.entries(attrs.value).forEach(([key, value]) => {
  18125. if (key.toLowerCase() === "onload")
  18126. return;
  18127. img.setAttribute(key, value);
  18128. });
  18129. img.src = currentImageSrc;
  18130. };
  18131. function handleLoad(e, img) {
  18132. imgWidth.value = img.width;
  18133. imgHeight.value = img.height;
  18134. loading2.value = false;
  18135. hasLoadError.value = false;
  18136. }
  18137. function handleError(event) {
  18138. loading2.value = false;
  18139. hasLoadError.value = true;
  18140. emit("error", event);
  18141. }
  18142. function handleLazyLoad() {
  18143. if (isInContainer(container.value, _scrollContainer.value)) {
  18144. loadImage();
  18145. removeLazyLoadListener();
  18146. }
  18147. }
  18148. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200);
  18149. async function addLazyLoadListener() {
  18150. var _a2;
  18151. if (!isClient$1)
  18152. return;
  18153. await nextTick();
  18154. const { scrollContainer } = props;
  18155. if (isElement$1(scrollContainer)) {
  18156. _scrollContainer.value = scrollContainer;
  18157. } else if (isString(scrollContainer) && scrollContainer !== "") {
  18158. _scrollContainer.value = (_a2 = document.querySelector(scrollContainer)) != null ? _a2 : void 0;
  18159. } else if (container.value) {
  18160. _scrollContainer.value = getScrollContainer(container.value);
  18161. }
  18162. if (_scrollContainer.value) {
  18163. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  18164. setTimeout(() => handleLazyLoad(), 100);
  18165. }
  18166. }
  18167. function removeLazyLoadListener() {
  18168. if (!isClient$1 || !_scrollContainer.value || !lazyLoadHandler)
  18169. return;
  18170. stopScrollListener();
  18171. _scrollContainer.value = void 0;
  18172. }
  18173. function wheelHandler(e) {
  18174. if (!e.ctrlKey)
  18175. return;
  18176. if (e.deltaY < 0) {
  18177. e.preventDefault();
  18178. return false;
  18179. } else if (e.deltaY > 0) {
  18180. e.preventDefault();
  18181. return false;
  18182. }
  18183. }
  18184. function clickHandler() {
  18185. if (!preview.value)
  18186. return;
  18187. stopWheelListener = useEventListener("wheel", wheelHandler, {
  18188. passive: false
  18189. });
  18190. prevOverflow = document.body.style.overflow;
  18191. document.body.style.overflow = "hidden";
  18192. showViewer.value = true;
  18193. }
  18194. function closeViewer() {
  18195. stopWheelListener == null ? void 0 : stopWheelListener();
  18196. document.body.style.overflow = prevOverflow;
  18197. showViewer.value = false;
  18198. emit("close");
  18199. }
  18200. function switchViewer(val) {
  18201. emit("switch", val);
  18202. }
  18203. watch(() => props.src, () => {
  18204. if (props.lazy) {
  18205. loading2.value = true;
  18206. hasLoadError.value = false;
  18207. removeLazyLoadListener();
  18208. addLazyLoadListener();
  18209. } else {
  18210. loadImage();
  18211. }
  18212. });
  18213. onMounted(() => {
  18214. if (props.lazy) {
  18215. addLazyLoadListener();
  18216. } else {
  18217. loadImage();
  18218. }
  18219. });
  18220. return (_ctx, _cache) => {
  18221. return openBlock(), createElementBlock("div", {
  18222. ref_key: "container",
  18223. ref: container,
  18224. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  18225. style: normalizeStyle(unref(containerStyle))
  18226. }, [
  18227. loading2.value ? renderSlot(_ctx.$slots, "placeholder", { key: 0 }, () => [
  18228. createElementVNode("div", {
  18229. class: normalizeClass(unref(ns).e("placeholder"))
  18230. }, null, 2)
  18231. ]) : hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 1 }, () => [
  18232. createElementVNode("div", {
  18233. class: normalizeClass(unref(ns).e("error"))
  18234. }, toDisplayString(unref(t)("el.image.error")), 3)
  18235. ]) : (openBlock(), createElementBlock("img", mergeProps({ key: 2 }, unref(attrs), {
  18236. src: _ctx.src,
  18237. style: unref(imageStyle),
  18238. class: [unref(ns).e("inner"), unref(preview) ? unref(ns).e("preview") : ""],
  18239. onClick: clickHandler
  18240. }), null, 16, _hoisted_1$h)),
  18241. unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  18242. showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  18243. key: 0,
  18244. "z-index": _ctx.zIndex,
  18245. "initial-index": unref(imageIndex),
  18246. infinite: _ctx.infinite,
  18247. "url-list": _ctx.previewSrcList,
  18248. "hide-on-click-modal": _ctx.hideOnClickModal,
  18249. teleported: unref(teleported),
  18250. onClose: closeViewer,
  18251. onSwitch: switchViewer
  18252. }, {
  18253. default: withCtx(() => [
  18254. _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
  18255. renderSlot(_ctx.$slots, "viewer")
  18256. ])) : createCommentVNode("v-if", true)
  18257. ]),
  18258. _: 3
  18259. }, 8, ["z-index", "initial-index", "infinite", "url-list", "hide-on-click-modal", "teleported"])) : createCommentVNode("v-if", true)
  18260. ], 2112)) : createCommentVNode("v-if", true)
  18261. ], 6);
  18262. };
  18263. }
  18264. }));
  18265. var Image$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image/src/image.vue"]]);
  18266. const ElImage = withInstall(Image$1);
  18267. const inputNumberProps = buildProps({
  18268. step: {
  18269. type: Number,
  18270. default: 1
  18271. },
  18272. stepStrictly: {
  18273. type: Boolean,
  18274. default: false
  18275. },
  18276. max: {
  18277. type: Number,
  18278. default: Number.POSITIVE_INFINITY
  18279. },
  18280. min: {
  18281. type: Number,
  18282. default: Number.NEGATIVE_INFINITY
  18283. },
  18284. modelValue: {
  18285. type: Number
  18286. },
  18287. disabled: {
  18288. type: Boolean,
  18289. default: false
  18290. },
  18291. size: {
  18292. type: String,
  18293. values: componentSizes
  18294. },
  18295. controls: {
  18296. type: Boolean,
  18297. default: true
  18298. },
  18299. controlsPosition: {
  18300. type: String,
  18301. default: "",
  18302. values: ["", "right"]
  18303. },
  18304. name: String,
  18305. label: String,
  18306. placeholder: String,
  18307. precision: {
  18308. type: Number,
  18309. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  18310. }
  18311. });
  18312. const inputNumberEmits = {
  18313. change: (prev, cur) => prev !== cur,
  18314. blur: (e) => e instanceof FocusEvent,
  18315. focus: (e) => e instanceof FocusEvent,
  18316. input: (val) => isNumber(val),
  18317. "update:modelValue": (val) => isNumber(val) || val === void 0
  18318. };
  18319. const _sfc_main$q = defineComponent({
  18320. name: "ElInputNumber",
  18321. components: {
  18322. ElInput,
  18323. ElIcon,
  18324. ArrowUp: arrowUp,
  18325. ArrowDown: arrowDown,
  18326. Plus: plus,
  18327. Minus: minus
  18328. },
  18329. directives: {
  18330. RepeatClick
  18331. },
  18332. props: inputNumberProps,
  18333. emits: inputNumberEmits,
  18334. setup(props, { emit }) {
  18335. const input = ref();
  18336. const data2 = reactive({
  18337. currentValue: props.modelValue,
  18338. userInput: null
  18339. });
  18340. const { formItem } = useFormItem();
  18341. const ns = useNamespace("input-number");
  18342. const minDisabled = computed(() => ensurePrecision(props.modelValue, -1) < props.min);
  18343. const maxDisabled = computed(() => ensurePrecision(props.modelValue) > props.max);
  18344. const numPrecision = computed(() => {
  18345. const stepPrecision = getPrecision(props.step);
  18346. if (!isUndefined(props.precision)) {
  18347. if (stepPrecision > props.precision)
  18348. ;
  18349. return props.precision;
  18350. } else {
  18351. return Math.max(getPrecision(props.modelValue), stepPrecision);
  18352. }
  18353. });
  18354. const controlsAtRight = computed(() => {
  18355. return props.controls && props.controlsPosition === "right";
  18356. });
  18357. const inputNumberSize = useSize();
  18358. const inputNumberDisabled = useDisabled$1();
  18359. const displayValue = computed(() => {
  18360. if (data2.userInput !== null) {
  18361. return data2.userInput;
  18362. }
  18363. let currentValue = data2.currentValue;
  18364. if (isNumber(currentValue)) {
  18365. if (Number.isNaN(currentValue))
  18366. return "";
  18367. if (!isUndefined(props.precision)) {
  18368. currentValue = currentValue.toFixed(props.precision);
  18369. }
  18370. }
  18371. return currentValue;
  18372. });
  18373. const toPrecision = (num, pre) => {
  18374. if (isUndefined(pre))
  18375. pre = numPrecision.value;
  18376. return Number.parseFloat(`${Math.round(num * 10 ** pre) / 10 ** pre}`);
  18377. };
  18378. const getPrecision = (value) => {
  18379. if (isUndefined(value))
  18380. return 0;
  18381. const valueString = value.toString();
  18382. const dotPosition = valueString.indexOf(".");
  18383. let precision = 0;
  18384. if (dotPosition !== -1) {
  18385. precision = valueString.length - dotPosition - 1;
  18386. }
  18387. return precision;
  18388. };
  18389. const ensurePrecision = (val, coefficient = 1) => {
  18390. if (!isNumber(val))
  18391. return data2.currentValue;
  18392. val = isNumber(val) ? val : Number.NaN;
  18393. return toPrecision(val + props.step * coefficient);
  18394. };
  18395. const increase = () => {
  18396. if (inputNumberDisabled.value || maxDisabled.value)
  18397. return;
  18398. const value = props.modelValue || 0;
  18399. const newVal = ensurePrecision(value);
  18400. setCurrentValue(newVal);
  18401. };
  18402. const decrease = () => {
  18403. if (inputNumberDisabled.value || minDisabled.value)
  18404. return;
  18405. const value = props.modelValue || 0;
  18406. const newVal = ensurePrecision(value, -1);
  18407. setCurrentValue(newVal);
  18408. };
  18409. const verifyValue = (value, update) => {
  18410. const { max: max2, min: min2, step, precision, stepStrictly } = props;
  18411. let newVal = Number(value);
  18412. if (value === null) {
  18413. newVal = Number.NaN;
  18414. }
  18415. if (!Number.isNaN(newVal)) {
  18416. if (stepStrictly) {
  18417. newVal = Math.round(newVal / step) * step;
  18418. }
  18419. if (!isUndefined(precision)) {
  18420. newVal = toPrecision(newVal, precision);
  18421. }
  18422. if (newVal > max2 || newVal < min2) {
  18423. newVal = newVal > max2 ? max2 : min2;
  18424. update && emit("update:modelValue", newVal);
  18425. }
  18426. }
  18427. return newVal;
  18428. };
  18429. const setCurrentValue = (value) => {
  18430. var _a2;
  18431. const oldVal = data2.currentValue;
  18432. let newVal = verifyValue(value);
  18433. if (oldVal === newVal)
  18434. return;
  18435. if (Number.isNaN(newVal)) {
  18436. newVal = void 0;
  18437. }
  18438. data2.userInput = null;
  18439. emit("update:modelValue", newVal);
  18440. emit("input", newVal);
  18441. emit("change", newVal, oldVal);
  18442. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  18443. data2.currentValue = newVal;
  18444. };
  18445. const handleInput = (value) => {
  18446. return data2.userInput = value;
  18447. };
  18448. const handleInputChange = (value) => {
  18449. const newVal = value !== "" ? Number(value) : "";
  18450. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  18451. setCurrentValue(newVal);
  18452. }
  18453. data2.userInput = null;
  18454. };
  18455. const focus = () => {
  18456. var _a2, _b2;
  18457. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  18458. };
  18459. const blur = () => {
  18460. var _a2, _b2;
  18461. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b2.call(_a2);
  18462. };
  18463. const handleFocus = (event) => {
  18464. emit("focus", event);
  18465. };
  18466. const handleBlur = (event) => {
  18467. var _a2;
  18468. emit("blur", event);
  18469. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  18470. };
  18471. watch(() => props.modelValue, (value) => {
  18472. const newVal = verifyValue(value, true);
  18473. data2.currentValue = newVal;
  18474. data2.userInput = null;
  18475. }, { immediate: true });
  18476. onMounted(() => {
  18477. var _a2;
  18478. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18479. innerInput.setAttribute("role", "spinbutton");
  18480. innerInput.setAttribute("aria-valuemax", String(props.max));
  18481. innerInput.setAttribute("aria-valuemin", String(props.min));
  18482. innerInput.setAttribute("aria-valuenow", String(data2.currentValue));
  18483. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  18484. if (!isNumber(props.modelValue)) {
  18485. let val = Number(props.modelValue);
  18486. if (Number.isNaN(val)) {
  18487. val = void 0;
  18488. }
  18489. emit("update:modelValue", val);
  18490. }
  18491. });
  18492. onUpdated(() => {
  18493. var _a2;
  18494. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18495. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", data2.currentValue);
  18496. });
  18497. return {
  18498. input,
  18499. displayValue,
  18500. handleInput,
  18501. handleInputChange,
  18502. controlsAtRight,
  18503. decrease,
  18504. increase,
  18505. inputNumberSize,
  18506. inputNumberDisabled,
  18507. maxDisabled,
  18508. minDisabled,
  18509. focus,
  18510. blur,
  18511. handleFocus,
  18512. handleBlur,
  18513. ns
  18514. };
  18515. }
  18516. });
  18517. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  18518. const _component_arrow_down = resolveComponent("arrow-down");
  18519. const _component_minus = resolveComponent("minus");
  18520. const _component_el_icon = resolveComponent("el-icon");
  18521. const _component_arrow_up = resolveComponent("arrow-up");
  18522. const _component_plus = resolveComponent("plus");
  18523. const _component_el_input = resolveComponent("el-input");
  18524. const _directive_repeat_click = resolveDirective("repeat-click");
  18525. return openBlock(), createElementBlock("div", {
  18526. class: normalizeClass([
  18527. _ctx.ns.b(),
  18528. _ctx.ns.m(_ctx.inputNumberSize),
  18529. _ctx.ns.is("disabled", _ctx.inputNumberDisabled),
  18530. _ctx.ns.is("without-controls", !_ctx.controls),
  18531. _ctx.ns.is("controls-right", _ctx.controlsAtRight)
  18532. ]),
  18533. onDragstart: _cache[2] || (_cache[2] = withModifiers(() => {
  18534. }, ["prevent"]))
  18535. }, [
  18536. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18537. key: 0,
  18538. role: "button",
  18539. class: normalizeClass([_ctx.ns.e("decrease"), _ctx.ns.is("disabled", _ctx.minDisabled)]),
  18540. onKeydown: _cache[0] || (_cache[0] = withKeys((...args) => _ctx.decrease && _ctx.decrease(...args), ["enter"]))
  18541. }, [
  18542. createVNode(_component_el_icon, null, {
  18543. default: withCtx(() => [
  18544. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_down, { key: 0 })) : (openBlock(), createBlock(_component_minus, { key: 1 }))
  18545. ]),
  18546. _: 1
  18547. })
  18548. ], 34)), [
  18549. [_directive_repeat_click, _ctx.decrease]
  18550. ]) : createCommentVNode("v-if", true),
  18551. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18552. key: 1,
  18553. role: "button",
  18554. class: normalizeClass([_ctx.ns.e("increase"), _ctx.ns.is("disabled", _ctx.maxDisabled)]),
  18555. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.increase && _ctx.increase(...args), ["enter"]))
  18556. }, [
  18557. createVNode(_component_el_icon, null, {
  18558. default: withCtx(() => [
  18559. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_plus, { key: 1 }))
  18560. ]),
  18561. _: 1
  18562. })
  18563. ], 34)), [
  18564. [_directive_repeat_click, _ctx.increase]
  18565. ]) : createCommentVNode("v-if", true),
  18566. createVNode(_component_el_input, {
  18567. ref: "input",
  18568. type: "number",
  18569. step: _ctx.step,
  18570. "model-value": _ctx.displayValue,
  18571. placeholder: _ctx.placeholder,
  18572. disabled: _ctx.inputNumberDisabled,
  18573. size: _ctx.inputNumberSize,
  18574. max: _ctx.max,
  18575. min: _ctx.min,
  18576. name: _ctx.name,
  18577. label: _ctx.label,
  18578. "validate-event": false,
  18579. onKeydown: [
  18580. withKeys(withModifiers(_ctx.increase, ["prevent"]), ["up"]),
  18581. withKeys(withModifiers(_ctx.decrease, ["prevent"]), ["down"])
  18582. ],
  18583. onBlur: _ctx.handleBlur,
  18584. onFocus: _ctx.handleFocus,
  18585. onInput: _ctx.handleInput,
  18586. onChange: _ctx.handleInputChange
  18587. }, null, 8, ["step", "model-value", "placeholder", "disabled", "size", "max", "min", "name", "label", "onKeydown", "onBlur", "onFocus", "onInput", "onChange"])
  18588. ], 34);
  18589. }
  18590. 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"]]);
  18591. const ElInputNumber = withInstall(InputNumber);
  18592. const selectGroupKey = "ElSelectGroup";
  18593. const selectKey = "ElSelect";
  18594. function useOption(props, states) {
  18595. const select = inject(selectKey);
  18596. const selectGroup = inject(selectGroupKey, { disabled: false });
  18597. const isObject2 = computed(() => {
  18598. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  18599. });
  18600. const itemSelected = computed(() => {
  18601. if (!select.props.multiple) {
  18602. return isEqual2(props.value, select.props.modelValue);
  18603. } else {
  18604. return contains2(select.props.modelValue, props.value);
  18605. }
  18606. });
  18607. const limitReached = computed(() => {
  18608. if (select.props.multiple) {
  18609. const modelValue = select.props.modelValue || [];
  18610. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  18611. } else {
  18612. return false;
  18613. }
  18614. });
  18615. const currentLabel = computed(() => {
  18616. return props.label || (isObject2.value ? "" : props.value);
  18617. });
  18618. const currentValue = computed(() => {
  18619. return props.value || props.label || "";
  18620. });
  18621. const isDisabled = computed(() => {
  18622. return props.disabled || states.groupDisabled || limitReached.value;
  18623. });
  18624. const instance = getCurrentInstance();
  18625. const contains2 = (arr = [], target) => {
  18626. if (!isObject2.value) {
  18627. return arr && arr.includes(target);
  18628. } else {
  18629. const valueKey = select.props.valueKey;
  18630. return arr && arr.some((item) => {
  18631. return get(item, valueKey) === get(target, valueKey);
  18632. });
  18633. }
  18634. };
  18635. const isEqual2 = (a2, b2) => {
  18636. if (!isObject2.value) {
  18637. return a2 === b2;
  18638. } else {
  18639. const { valueKey } = select.props;
  18640. return get(a2, valueKey) === get(b2, valueKey);
  18641. }
  18642. };
  18643. const hoverItem = () => {
  18644. if (!props.disabled && !selectGroup.disabled) {
  18645. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  18646. }
  18647. };
  18648. watch(() => currentLabel.value, () => {
  18649. if (!props.created && !select.props.remote)
  18650. select.setSelected();
  18651. });
  18652. watch(() => props.value, (val, oldVal) => {
  18653. const { remote, valueKey } = select.props;
  18654. if (!props.created && !remote) {
  18655. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  18656. return;
  18657. }
  18658. select.setSelected();
  18659. }
  18660. });
  18661. watch(() => selectGroup.disabled, () => {
  18662. states.groupDisabled = selectGroup.disabled;
  18663. }, { immediate: true });
  18664. const { queryChange } = toRaw(select);
  18665. watch(queryChange, (changes) => {
  18666. const { query } = unref(changes);
  18667. const regexp4 = new RegExp(escapeStringRegexp(query), "i");
  18668. states.visible = regexp4.test(currentLabel.value) || props.created;
  18669. if (!states.visible) {
  18670. select.filteredOptionsCount--;
  18671. }
  18672. });
  18673. return {
  18674. select,
  18675. currentLabel,
  18676. currentValue,
  18677. itemSelected,
  18678. isDisabled,
  18679. hoverItem
  18680. };
  18681. }
  18682. const _sfc_main$p = defineComponent({
  18683. name: "ElOption",
  18684. componentName: "ElOption",
  18685. props: {
  18686. value: {
  18687. required: true,
  18688. type: [String, Number, Boolean, Object]
  18689. },
  18690. label: [String, Number],
  18691. created: Boolean,
  18692. disabled: {
  18693. type: Boolean,
  18694. default: false
  18695. }
  18696. },
  18697. setup(props) {
  18698. const ns = useNamespace("select");
  18699. const states = reactive({
  18700. index: -1,
  18701. groupDisabled: false,
  18702. visible: true,
  18703. hitState: false,
  18704. hover: false
  18705. });
  18706. const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption(props, states);
  18707. const { visible, hover } = toRefs(states);
  18708. const vm = getCurrentInstance().proxy;
  18709. const key = vm.value;
  18710. select.onOptionCreate(vm);
  18711. onBeforeUnmount(() => {
  18712. const { selected } = select;
  18713. const selectedOptions = select.props.multiple ? selected : [selected];
  18714. const doesSelected = selectedOptions.some((item) => {
  18715. return item.value === vm.value;
  18716. });
  18717. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  18718. nextTick(() => {
  18719. select.cachedOptions.delete(key);
  18720. });
  18721. }
  18722. select.onOptionDestroy(key, vm);
  18723. });
  18724. function selectOptionClick() {
  18725. if (props.disabled !== true && states.groupDisabled !== true) {
  18726. select.handleOptionSelect(vm, true);
  18727. }
  18728. }
  18729. return {
  18730. ns,
  18731. currentLabel,
  18732. itemSelected,
  18733. isDisabled,
  18734. select,
  18735. hoverItem,
  18736. visible,
  18737. hover,
  18738. selectOptionClick,
  18739. states
  18740. };
  18741. }
  18742. });
  18743. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  18744. return withDirectives((openBlock(), createElementBlock("li", {
  18745. class: normalizeClass([
  18746. _ctx.ns.be("dropdown", "item"),
  18747. _ctx.ns.is("disabled", _ctx.isDisabled),
  18748. {
  18749. selected: _ctx.itemSelected,
  18750. hover: _ctx.hover
  18751. }
  18752. ]),
  18753. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  18754. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  18755. }, [
  18756. renderSlot(_ctx.$slots, "default", {}, () => [
  18757. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  18758. ])
  18759. ], 34)), [
  18760. [vShow, _ctx.visible]
  18761. ]);
  18762. }
  18763. 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"]]);
  18764. const _sfc_main$o = defineComponent({
  18765. name: "ElSelectDropdown",
  18766. componentName: "ElSelectDropdown",
  18767. setup() {
  18768. const select = inject(selectKey);
  18769. const ns = useNamespace("select");
  18770. const popperClass = computed(() => select.props.popperClass);
  18771. const isMultiple = computed(() => select.props.multiple);
  18772. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  18773. const minWidth = ref("");
  18774. function updateMinWidth() {
  18775. var _a2;
  18776. minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.getBoundingClientRect().width}px`;
  18777. }
  18778. onMounted(() => {
  18779. updateMinWidth();
  18780. addResizeListener(select.selectWrapper, updateMinWidth);
  18781. });
  18782. onBeforeUnmount(() => {
  18783. removeResizeListener(select.selectWrapper, updateMinWidth);
  18784. });
  18785. return {
  18786. ns,
  18787. minWidth,
  18788. popperClass,
  18789. isMultiple,
  18790. isFitInputWidth
  18791. };
  18792. }
  18793. });
  18794. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  18795. return openBlock(), createElementBlock("div", {
  18796. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  18797. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  18798. }, [
  18799. renderSlot(_ctx.$slots, "default")
  18800. ], 6);
  18801. }
  18802. 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"]]);
  18803. function useSelectStates(props) {
  18804. const { t } = useLocale();
  18805. return reactive({
  18806. options: /* @__PURE__ */ new Map(),
  18807. cachedOptions: /* @__PURE__ */ new Map(),
  18808. createdLabel: null,
  18809. createdSelected: false,
  18810. selected: props.multiple ? [] : {},
  18811. inputLength: 20,
  18812. inputWidth: 0,
  18813. initialInputHeight: 0,
  18814. optionsCount: 0,
  18815. filteredOptionsCount: 0,
  18816. visible: false,
  18817. softFocus: false,
  18818. selectedLabel: "",
  18819. hoverIndex: -1,
  18820. query: "",
  18821. previousQuery: null,
  18822. inputHovering: false,
  18823. cachedPlaceHolder: "",
  18824. currentPlaceholder: t("el.select.placeholder"),
  18825. menuVisibleOnFocus: false,
  18826. isOnComposition: false,
  18827. isSilentBlur: false,
  18828. prefixWidth: 11,
  18829. tagInMultiLine: false
  18830. });
  18831. }
  18832. const useSelect = (props, states, ctx) => {
  18833. const { t } = useLocale();
  18834. const ns = useNamespace("select");
  18835. const reference2 = ref(null);
  18836. const input = ref(null);
  18837. const tooltipRef = ref(null);
  18838. const tags = ref(null);
  18839. const selectWrapper = ref(null);
  18840. const scrollbar = ref(null);
  18841. const hoverOption = ref(-1);
  18842. const queryChange = shallowRef({ query: "" });
  18843. const groupQueryChange = shallowRef("");
  18844. const elForm2 = inject(formContextKey, {});
  18845. const elFormItem2 = inject(formItemContextKey, {});
  18846. const readonly2 = computed(() => !props.filterable || props.multiple || !states.visible);
  18847. const selectDisabled = computed(() => props.disabled || elForm2.disabled);
  18848. const showClose = computed(() => {
  18849. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  18850. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  18851. return criteria;
  18852. });
  18853. const iconComponent = computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
  18854. const iconReverse = computed(() => ns.is("reverse", iconComponent.value && states.visible));
  18855. const debounce$1$1 = computed(() => props.remote ? 300 : 0);
  18856. const emptyText = computed(() => {
  18857. if (props.loading) {
  18858. return props.loadingText || t("el.select.loading");
  18859. } else {
  18860. if (props.remote && states.query === "" && states.options.size === 0)
  18861. return false;
  18862. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  18863. return props.noMatchText || t("el.select.noMatch");
  18864. }
  18865. if (states.options.size === 0) {
  18866. return props.noDataText || t("el.select.noData");
  18867. }
  18868. }
  18869. return null;
  18870. });
  18871. const optionsArray = computed(() => Array.from(states.options.values()));
  18872. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  18873. const showNewOption = computed(() => {
  18874. const hasExistingOption = optionsArray.value.filter((option) => {
  18875. return !option.created;
  18876. }).some((option) => {
  18877. return option.currentLabel === states.query;
  18878. });
  18879. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  18880. });
  18881. const selectSize = useSize();
  18882. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  18883. const dropMenuVisible = computed({
  18884. get() {
  18885. return states.visible && emptyText.value !== false;
  18886. },
  18887. set(val) {
  18888. states.visible = val;
  18889. }
  18890. });
  18891. watch(() => selectDisabled.value, () => {
  18892. nextTick(() => {
  18893. resetInputHeight();
  18894. });
  18895. });
  18896. watch(() => props.placeholder, (val) => {
  18897. states.cachedPlaceHolder = states.currentPlaceholder = val;
  18898. });
  18899. watch(() => props.modelValue, (val, oldVal) => {
  18900. var _a2;
  18901. if (props.multiple) {
  18902. resetInputHeight();
  18903. if (val && val.length > 0 || input.value && states.query !== "") {
  18904. states.currentPlaceholder = "";
  18905. } else {
  18906. states.currentPlaceholder = states.cachedPlaceHolder;
  18907. }
  18908. if (props.filterable && !props.reserveKeyword) {
  18909. states.query = "";
  18910. handleQueryChange(states.query);
  18911. }
  18912. }
  18913. setSelected();
  18914. if (props.filterable && !props.multiple) {
  18915. states.inputLength = 20;
  18916. }
  18917. if (!isEqual(val, oldVal)) {
  18918. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  18919. }
  18920. }, {
  18921. flush: "post",
  18922. deep: true
  18923. });
  18924. watch(() => states.visible, (val) => {
  18925. var _a2, _b2, _c;
  18926. if (!val) {
  18927. input.value && input.value.blur();
  18928. states.query = "";
  18929. states.previousQuery = null;
  18930. states.selectedLabel = "";
  18931. states.inputLength = 20;
  18932. states.menuVisibleOnFocus = false;
  18933. resetHoverIndex();
  18934. nextTick(() => {
  18935. if (input.value && input.value.value === "" && states.selected.length === 0) {
  18936. states.currentPlaceholder = states.cachedPlaceHolder;
  18937. }
  18938. });
  18939. if (!props.multiple) {
  18940. if (states.selected) {
  18941. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  18942. states.selectedLabel = states.createdLabel;
  18943. } else {
  18944. states.selectedLabel = states.selected.currentLabel;
  18945. }
  18946. if (props.filterable)
  18947. states.query = states.selectedLabel;
  18948. }
  18949. if (props.filterable) {
  18950. states.currentPlaceholder = states.cachedPlaceHolder;
  18951. }
  18952. }
  18953. } else {
  18954. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  18955. if (props.filterable) {
  18956. states.filteredOptionsCount = states.optionsCount;
  18957. states.query = props.remote ? "" : states.selectedLabel;
  18958. if (props.multiple) {
  18959. (_c = input.value) == null ? void 0 : _c.focus();
  18960. } else {
  18961. if (states.selectedLabel) {
  18962. states.currentPlaceholder = `${states.selectedLabel}`;
  18963. states.selectedLabel = "";
  18964. }
  18965. }
  18966. handleQueryChange(states.query);
  18967. if (!props.multiple && !props.remote) {
  18968. queryChange.value.query = "";
  18969. triggerRef(queryChange);
  18970. triggerRef(groupQueryChange);
  18971. }
  18972. }
  18973. }
  18974. ctx.emit("visible-change", val);
  18975. });
  18976. watch(() => states.options.entries(), () => {
  18977. var _a2, _b2, _c;
  18978. if (!isClient$1)
  18979. return;
  18980. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  18981. if (props.multiple) {
  18982. resetInputHeight();
  18983. }
  18984. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  18985. if (!Array.from(inputs).includes(document.activeElement)) {
  18986. setSelected();
  18987. }
  18988. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  18989. checkDefaultFirstOption();
  18990. }
  18991. }, {
  18992. flush: "post"
  18993. });
  18994. watch(() => states.hoverIndex, (val) => {
  18995. if (typeof val === "number" && val > -1) {
  18996. hoverOption.value = optionsArray.value[val] || {};
  18997. }
  18998. optionsArray.value.forEach((option) => {
  18999. option.hover = hoverOption.value === option;
  19000. });
  19001. });
  19002. const resetInputHeight = () => {
  19003. if (props.collapseTags && !props.filterable)
  19004. return;
  19005. nextTick(() => {
  19006. var _a2, _b2;
  19007. if (!reference2.value)
  19008. return;
  19009. const input2 = reference2.value.$el.querySelector("input");
  19010. const _tags = tags.value;
  19011. const sizeInMap = states.initialInputHeight || getComponentSize(selectSize.value || elForm2.size);
  19012. input2.style.height = states.selected.length === 0 ? `${sizeInMap}px` : `${Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)}px`;
  19013. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  19014. if (states.visible && emptyText.value !== false) {
  19015. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19016. }
  19017. });
  19018. };
  19019. const handleQueryChange = (val) => {
  19020. if (states.previousQuery === val || states.isOnComposition)
  19021. return;
  19022. if (states.previousQuery === null && (typeof props.filterMethod === "function" || typeof props.remoteMethod === "function")) {
  19023. states.previousQuery = val;
  19024. return;
  19025. }
  19026. states.previousQuery = val;
  19027. nextTick(() => {
  19028. var _a2, _b2;
  19029. if (states.visible)
  19030. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19031. });
  19032. states.hoverIndex = -1;
  19033. if (props.multiple && props.filterable) {
  19034. nextTick(() => {
  19035. const length = input.value.value.length * 15 + 20;
  19036. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  19037. managePlaceholder();
  19038. resetInputHeight();
  19039. });
  19040. }
  19041. if (props.remote && typeof props.remoteMethod === "function") {
  19042. states.hoverIndex = -1;
  19043. props.remoteMethod(val);
  19044. } else if (typeof props.filterMethod === "function") {
  19045. props.filterMethod(val);
  19046. triggerRef(groupQueryChange);
  19047. } else {
  19048. states.filteredOptionsCount = states.optionsCount;
  19049. queryChange.value.query = val;
  19050. triggerRef(queryChange);
  19051. triggerRef(groupQueryChange);
  19052. }
  19053. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  19054. checkDefaultFirstOption();
  19055. }
  19056. };
  19057. const managePlaceholder = () => {
  19058. if (states.currentPlaceholder !== "") {
  19059. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  19060. }
  19061. };
  19062. const checkDefaultFirstOption = () => {
  19063. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  19064. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  19065. const firstOriginOption = optionsInDropdown[0];
  19066. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  19067. };
  19068. const setSelected = () => {
  19069. var _a2;
  19070. if (!props.multiple) {
  19071. const option = getOption(props.modelValue);
  19072. if ((_a2 = option.props) == null ? void 0 : _a2.created) {
  19073. states.createdLabel = option.props.value;
  19074. states.createdSelected = true;
  19075. } else {
  19076. states.createdSelected = false;
  19077. }
  19078. states.selectedLabel = option.currentLabel;
  19079. states.selected = option;
  19080. if (props.filterable)
  19081. states.query = states.selectedLabel;
  19082. return;
  19083. } else {
  19084. states.selectedLabel = "";
  19085. }
  19086. const result = [];
  19087. if (Array.isArray(props.modelValue)) {
  19088. props.modelValue.forEach((value) => {
  19089. result.push(getOption(value));
  19090. });
  19091. }
  19092. states.selected = result;
  19093. nextTick(() => {
  19094. resetInputHeight();
  19095. });
  19096. };
  19097. const getOption = (value) => {
  19098. let option;
  19099. const isObjectValue = toRawType(value).toLowerCase() === "object";
  19100. const isNull = toRawType(value).toLowerCase() === "null";
  19101. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  19102. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  19103. const cachedOption = cachedOptionsArray.value[i];
  19104. const isEqualValue = isObjectValue ? get(cachedOption, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  19105. if (isEqualValue) {
  19106. option = {
  19107. value,
  19108. currentLabel: cachedOption.currentLabel,
  19109. isDisabled: cachedOption.isDisabled
  19110. };
  19111. break;
  19112. }
  19113. }
  19114. if (option)
  19115. return option;
  19116. const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  19117. const newOption = {
  19118. value,
  19119. currentLabel: label
  19120. };
  19121. if (props.multiple) {
  19122. newOption.hitState = false;
  19123. }
  19124. return newOption;
  19125. };
  19126. const resetHoverIndex = () => {
  19127. setTimeout(() => {
  19128. const valueKey = props.valueKey;
  19129. if (!props.multiple) {
  19130. states.hoverIndex = optionsArray.value.findIndex((item) => {
  19131. return getValueKey(item) === getValueKey(states.selected);
  19132. });
  19133. } else {
  19134. if (states.selected.length > 0) {
  19135. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  19136. return optionsArray.value.findIndex((item) => {
  19137. return get(item, valueKey) === get(selected, valueKey);
  19138. });
  19139. }));
  19140. } else {
  19141. states.hoverIndex = -1;
  19142. }
  19143. }
  19144. }, 300);
  19145. };
  19146. const handleResize = () => {
  19147. var _a2, _b2;
  19148. resetInputWidth();
  19149. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19150. if (props.multiple && !props.filterable)
  19151. resetInputHeight();
  19152. };
  19153. const resetInputWidth = () => {
  19154. var _a2;
  19155. states.inputWidth = (_a2 = reference2.value) == null ? void 0 : _a2.$el.getBoundingClientRect().width;
  19156. };
  19157. const onInputChange = () => {
  19158. if (props.filterable && states.query !== states.selectedLabel) {
  19159. states.query = states.selectedLabel;
  19160. handleQueryChange(states.query);
  19161. }
  19162. };
  19163. const debouncedOnInputChange = debounce$1(() => {
  19164. onInputChange();
  19165. }, debounce$1$1.value);
  19166. const debouncedQueryChange = debounce$1((e) => {
  19167. handleQueryChange(e.target.value);
  19168. }, debounce$1$1.value);
  19169. const emitChange = (val) => {
  19170. if (!isEqual(props.modelValue, val)) {
  19171. ctx.emit(CHANGE_EVENT, val);
  19172. }
  19173. };
  19174. const deletePrevTag = (e) => {
  19175. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  19176. const value = props.modelValue.slice();
  19177. value.pop();
  19178. ctx.emit(UPDATE_MODEL_EVENT, value);
  19179. emitChange(value);
  19180. }
  19181. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  19182. states.currentPlaceholder = states.cachedPlaceHolder;
  19183. }
  19184. };
  19185. const deleteTag = (event, tag) => {
  19186. const index = states.selected.indexOf(tag);
  19187. if (index > -1 && !selectDisabled.value) {
  19188. const value = props.modelValue.slice();
  19189. value.splice(index, 1);
  19190. ctx.emit(UPDATE_MODEL_EVENT, value);
  19191. emitChange(value);
  19192. ctx.emit("remove-tag", tag.value);
  19193. }
  19194. event.stopPropagation();
  19195. };
  19196. const deleteSelected = (event) => {
  19197. event.stopPropagation();
  19198. const value = props.multiple ? [] : "";
  19199. if (typeof value !== "string") {
  19200. for (const item of states.selected) {
  19201. if (item.isDisabled)
  19202. value.push(item.value);
  19203. }
  19204. }
  19205. ctx.emit(UPDATE_MODEL_EVENT, value);
  19206. emitChange(value);
  19207. states.visible = false;
  19208. ctx.emit("clear");
  19209. };
  19210. const handleOptionSelect = (option, byClick) => {
  19211. var _a2;
  19212. if (props.multiple) {
  19213. const value = (props.modelValue || []).slice();
  19214. const optionIndex = getValueIndex(value, option.value);
  19215. if (optionIndex > -1) {
  19216. value.splice(optionIndex, 1);
  19217. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  19218. value.push(option.value);
  19219. }
  19220. ctx.emit(UPDATE_MODEL_EVENT, value);
  19221. emitChange(value);
  19222. if (option.created) {
  19223. states.query = "";
  19224. handleQueryChange("");
  19225. states.inputLength = 20;
  19226. }
  19227. if (props.filterable)
  19228. (_a2 = input.value) == null ? void 0 : _a2.focus();
  19229. } else {
  19230. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  19231. emitChange(option.value);
  19232. states.visible = false;
  19233. }
  19234. states.isSilentBlur = byClick;
  19235. setSoftFocus();
  19236. if (states.visible)
  19237. return;
  19238. nextTick(() => {
  19239. scrollToOption(option);
  19240. });
  19241. };
  19242. const getValueIndex = (arr = [], value) => {
  19243. if (!isObject$1(value))
  19244. return arr.indexOf(value);
  19245. const valueKey = props.valueKey;
  19246. let index = -1;
  19247. arr.some((item, i) => {
  19248. if (get(item, valueKey) === get(value, valueKey)) {
  19249. index = i;
  19250. return true;
  19251. }
  19252. return false;
  19253. });
  19254. return index;
  19255. };
  19256. const setSoftFocus = () => {
  19257. states.softFocus = true;
  19258. const _input = input.value || reference2.value;
  19259. if (_input) {
  19260. _input == null ? void 0 : _input.focus();
  19261. }
  19262. };
  19263. const scrollToOption = (option) => {
  19264. var _a2, _b2, _c, _d, _e;
  19265. const targetOption = Array.isArray(option) ? option[0] : option;
  19266. let target = null;
  19267. if (targetOption == null ? void 0 : targetOption.value) {
  19268. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  19269. if (options.length > 0) {
  19270. target = options[0].$el;
  19271. }
  19272. }
  19273. if (tooltipRef.value && target) {
  19274. 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")}`);
  19275. if (menu) {
  19276. scrollIntoView(menu, target);
  19277. }
  19278. }
  19279. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  19280. };
  19281. const onOptionCreate = (vm) => {
  19282. states.optionsCount++;
  19283. states.filteredOptionsCount++;
  19284. states.options.set(vm.value, vm);
  19285. states.cachedOptions.set(vm.value, vm);
  19286. };
  19287. const onOptionDestroy = (key, vm) => {
  19288. if (states.options.get(key) === vm) {
  19289. states.optionsCount--;
  19290. states.filteredOptionsCount--;
  19291. states.options.delete(key);
  19292. }
  19293. };
  19294. const resetInputState = (e) => {
  19295. if (e.code !== EVENT_CODE.backspace)
  19296. toggleLastOptionHitState(false);
  19297. states.inputLength = input.value.value.length * 15 + 20;
  19298. resetInputHeight();
  19299. };
  19300. const toggleLastOptionHitState = (hit) => {
  19301. if (!Array.isArray(states.selected))
  19302. return;
  19303. const option = states.selected[states.selected.length - 1];
  19304. if (!option)
  19305. return;
  19306. if (hit === true || hit === false) {
  19307. option.hitState = hit;
  19308. return hit;
  19309. }
  19310. option.hitState = !option.hitState;
  19311. return option.hitState;
  19312. };
  19313. const handleComposition = (event) => {
  19314. const text = event.target.value;
  19315. if (event.type === "compositionend") {
  19316. states.isOnComposition = false;
  19317. nextTick(() => handleQueryChange(text));
  19318. } else {
  19319. const lastCharacter = text[text.length - 1] || "";
  19320. states.isOnComposition = !isKorean(lastCharacter);
  19321. }
  19322. };
  19323. const handleMenuEnter = () => {
  19324. nextTick(() => scrollToOption(states.selected));
  19325. };
  19326. const handleFocus = (event) => {
  19327. if (!states.softFocus) {
  19328. if (props.automaticDropdown || props.filterable) {
  19329. if (props.filterable && !states.visible) {
  19330. states.menuVisibleOnFocus = true;
  19331. }
  19332. states.visible = true;
  19333. }
  19334. ctx.emit("focus", event);
  19335. } else {
  19336. states.softFocus = false;
  19337. }
  19338. };
  19339. const blur = () => {
  19340. var _a2;
  19341. states.visible = false;
  19342. (_a2 = reference2.value) == null ? void 0 : _a2.blur();
  19343. };
  19344. const handleBlur = (event) => {
  19345. nextTick(() => {
  19346. if (states.isSilentBlur) {
  19347. states.isSilentBlur = false;
  19348. } else {
  19349. ctx.emit("blur", event);
  19350. }
  19351. });
  19352. states.softFocus = false;
  19353. };
  19354. const handleClearClick = (event) => {
  19355. deleteSelected(event);
  19356. };
  19357. const handleClose = () => {
  19358. states.visible = false;
  19359. };
  19360. const toggleMenu = () => {
  19361. var _a2;
  19362. if (props.automaticDropdown)
  19363. return;
  19364. if (!selectDisabled.value) {
  19365. if (states.menuVisibleOnFocus) {
  19366. states.menuVisibleOnFocus = false;
  19367. } else {
  19368. states.visible = !states.visible;
  19369. }
  19370. if (states.visible) {
  19371. (_a2 = input.value || reference2.value) == null ? void 0 : _a2.focus();
  19372. }
  19373. }
  19374. };
  19375. const selectOption = () => {
  19376. if (!states.visible) {
  19377. toggleMenu();
  19378. } else {
  19379. if (optionsArray.value[states.hoverIndex]) {
  19380. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  19381. }
  19382. }
  19383. };
  19384. const getValueKey = (item) => {
  19385. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  19386. };
  19387. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  19388. const navigateOptions = (direction) => {
  19389. if (!states.visible) {
  19390. states.visible = true;
  19391. return;
  19392. }
  19393. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  19394. return;
  19395. if (states.isOnComposition)
  19396. return;
  19397. if (!optionsAllDisabled.value) {
  19398. if (direction === "next") {
  19399. states.hoverIndex++;
  19400. if (states.hoverIndex === states.options.size) {
  19401. states.hoverIndex = 0;
  19402. }
  19403. } else if (direction === "prev") {
  19404. states.hoverIndex--;
  19405. if (states.hoverIndex < 0) {
  19406. states.hoverIndex = states.options.size - 1;
  19407. }
  19408. }
  19409. const option = optionsArray.value[states.hoverIndex];
  19410. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  19411. navigateOptions(direction);
  19412. }
  19413. nextTick(() => scrollToOption(hoverOption.value));
  19414. }
  19415. };
  19416. return {
  19417. optionsArray,
  19418. selectSize,
  19419. handleResize,
  19420. debouncedOnInputChange,
  19421. debouncedQueryChange,
  19422. deletePrevTag,
  19423. deleteTag,
  19424. deleteSelected,
  19425. handleOptionSelect,
  19426. scrollToOption,
  19427. readonly: readonly2,
  19428. resetInputHeight,
  19429. showClose,
  19430. iconComponent,
  19431. iconReverse,
  19432. showNewOption,
  19433. collapseTagSize,
  19434. setSelected,
  19435. managePlaceholder,
  19436. selectDisabled,
  19437. emptyText,
  19438. toggleLastOptionHitState,
  19439. resetInputState,
  19440. handleComposition,
  19441. onOptionCreate,
  19442. onOptionDestroy,
  19443. handleMenuEnter,
  19444. handleFocus,
  19445. blur,
  19446. handleBlur,
  19447. handleClearClick,
  19448. handleClose,
  19449. toggleMenu,
  19450. selectOption,
  19451. getValueKey,
  19452. navigateOptions,
  19453. dropMenuVisible,
  19454. queryChange,
  19455. groupQueryChange,
  19456. reference: reference2,
  19457. input,
  19458. tooltipRef,
  19459. tags,
  19460. selectWrapper,
  19461. scrollbar
  19462. };
  19463. };
  19464. const COMPONENT_NAME$1 = "ElSelect";
  19465. const _sfc_main$n = defineComponent({
  19466. name: COMPONENT_NAME$1,
  19467. componentName: COMPONENT_NAME$1,
  19468. components: {
  19469. ElInput,
  19470. ElSelectMenu,
  19471. ElOption: Option,
  19472. ElTag,
  19473. ElScrollbar,
  19474. ElTooltip,
  19475. ElIcon
  19476. },
  19477. directives: { ClickOutside },
  19478. props: {
  19479. name: String,
  19480. id: String,
  19481. modelValue: {
  19482. type: [Array, String, Number, Boolean, Object],
  19483. default: void 0
  19484. },
  19485. autocomplete: {
  19486. type: String,
  19487. default: "off"
  19488. },
  19489. automaticDropdown: Boolean,
  19490. size: {
  19491. type: String,
  19492. validator: isValidComponentSize
  19493. },
  19494. effect: {
  19495. type: String,
  19496. default: "light"
  19497. },
  19498. disabled: Boolean,
  19499. clearable: Boolean,
  19500. filterable: Boolean,
  19501. allowCreate: Boolean,
  19502. loading: Boolean,
  19503. popperClass: {
  19504. type: String,
  19505. default: ""
  19506. },
  19507. remote: Boolean,
  19508. loadingText: String,
  19509. noMatchText: String,
  19510. noDataText: String,
  19511. remoteMethod: Function,
  19512. filterMethod: Function,
  19513. multiple: Boolean,
  19514. multipleLimit: {
  19515. type: Number,
  19516. default: 0
  19517. },
  19518. placeholder: {
  19519. type: String
  19520. },
  19521. defaultFirstOption: Boolean,
  19522. reserveKeyword: {
  19523. type: Boolean,
  19524. default: true
  19525. },
  19526. valueKey: {
  19527. type: String,
  19528. default: "value"
  19529. },
  19530. collapseTags: Boolean,
  19531. collapseTagsTooltip: {
  19532. type: Boolean,
  19533. default: false
  19534. },
  19535. popperAppendToBody: {
  19536. type: Boolean,
  19537. default: void 0
  19538. },
  19539. teleported: useTooltipContentProps.teleported,
  19540. persistent: {
  19541. type: Boolean,
  19542. default: true
  19543. },
  19544. clearIcon: {
  19545. type: [String, Object],
  19546. default: circleClose
  19547. },
  19548. fitInputWidth: {
  19549. type: Boolean,
  19550. default: false
  19551. },
  19552. suffixIcon: {
  19553. type: [String, Object],
  19554. default: arrowUp
  19555. },
  19556. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  19557. },
  19558. emits: [
  19559. UPDATE_MODEL_EVENT,
  19560. CHANGE_EVENT,
  19561. "remove-tag",
  19562. "clear",
  19563. "visible-change",
  19564. "focus",
  19565. "blur"
  19566. ],
  19567. setup(props, ctx) {
  19568. const nsSelect = useNamespace("select");
  19569. const nsInput = useNamespace("input");
  19570. const { t } = useLocale();
  19571. const states = useSelectStates(props);
  19572. const {
  19573. optionsArray,
  19574. selectSize,
  19575. readonly: readonly2,
  19576. handleResize,
  19577. collapseTagSize,
  19578. debouncedOnInputChange,
  19579. debouncedQueryChange,
  19580. deletePrevTag,
  19581. deleteTag,
  19582. deleteSelected,
  19583. handleOptionSelect,
  19584. scrollToOption,
  19585. setSelected,
  19586. resetInputHeight,
  19587. managePlaceholder,
  19588. showClose,
  19589. selectDisabled,
  19590. iconComponent,
  19591. iconReverse,
  19592. showNewOption,
  19593. emptyText,
  19594. toggleLastOptionHitState,
  19595. resetInputState,
  19596. handleComposition,
  19597. onOptionCreate,
  19598. onOptionDestroy,
  19599. handleMenuEnter,
  19600. handleFocus,
  19601. blur,
  19602. handleBlur,
  19603. handleClearClick,
  19604. handleClose,
  19605. toggleMenu,
  19606. selectOption,
  19607. getValueKey,
  19608. navigateOptions,
  19609. dropMenuVisible,
  19610. reference: reference2,
  19611. input,
  19612. tooltipRef,
  19613. tags,
  19614. selectWrapper,
  19615. scrollbar,
  19616. queryChange,
  19617. groupQueryChange
  19618. } = useSelect(props, states, ctx);
  19619. const { focus } = useFocus(reference2);
  19620. const {
  19621. inputWidth,
  19622. selected,
  19623. inputLength,
  19624. filteredOptionsCount,
  19625. visible,
  19626. softFocus,
  19627. selectedLabel,
  19628. hoverIndex,
  19629. query,
  19630. inputHovering,
  19631. currentPlaceholder,
  19632. menuVisibleOnFocus,
  19633. isOnComposition,
  19634. isSilentBlur,
  19635. options,
  19636. cachedOptions,
  19637. optionsCount,
  19638. prefixWidth,
  19639. tagInMultiLine
  19640. } = toRefs(states);
  19641. const wrapperKls = computed(() => {
  19642. const classList = [nsSelect.b()];
  19643. const _selectSize = unref(selectSize);
  19644. if (_selectSize) {
  19645. classList.push(nsSelect.m(_selectSize));
  19646. }
  19647. if (props.disabled) {
  19648. classList.push(nsSelect.m("disabled"));
  19649. }
  19650. return classList;
  19651. });
  19652. const selectTagsStyle = computed(() => ({
  19653. maxWidth: `${unref(inputWidth) - 32}px`,
  19654. width: "100%"
  19655. }));
  19656. provide(selectKey, reactive({
  19657. props,
  19658. options,
  19659. optionsArray,
  19660. cachedOptions,
  19661. optionsCount,
  19662. filteredOptionsCount,
  19663. hoverIndex,
  19664. handleOptionSelect,
  19665. onOptionCreate,
  19666. onOptionDestroy,
  19667. selectWrapper,
  19668. selected,
  19669. setSelected,
  19670. queryChange,
  19671. groupQueryChange
  19672. }));
  19673. onMounted(() => {
  19674. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || t("el.select.placeholder");
  19675. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  19676. currentPlaceholder.value = "";
  19677. }
  19678. addResizeListener(selectWrapper.value, handleResize);
  19679. if (reference2.value && reference2.value.$el) {
  19680. const input2 = reference2.value.input;
  19681. states.initialInputHeight = input2.getBoundingClientRect().height || getComponentSize(selectSize.value);
  19682. }
  19683. if (props.remote && props.multiple) {
  19684. resetInputHeight();
  19685. }
  19686. nextTick(() => {
  19687. if (!reference2.value)
  19688. return;
  19689. if (reference2.value.$el) {
  19690. inputWidth.value = reference2.value.$el.getBoundingClientRect().width;
  19691. }
  19692. if (ctx.slots.prefix) {
  19693. const inputChildNodes = reference2.value.$el.childNodes;
  19694. const input2 = Array.from(inputChildNodes).find((item) => item.tagName === "INPUT");
  19695. const prefix = reference2.value.$el.querySelector(`.${nsInput.e("prefix")}`);
  19696. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  19697. if (states.prefixWidth) {
  19698. input2.style.paddingLeft = `${Math.max(states.prefixWidth, 30)}px`;
  19699. }
  19700. }
  19701. });
  19702. setSelected();
  19703. });
  19704. onBeforeUnmount(() => {
  19705. removeResizeListener(selectWrapper.value, handleResize);
  19706. });
  19707. if (props.multiple && !Array.isArray(props.modelValue)) {
  19708. ctx.emit(UPDATE_MODEL_EVENT, []);
  19709. }
  19710. if (!props.multiple && Array.isArray(props.modelValue)) {
  19711. ctx.emit(UPDATE_MODEL_EVENT, "");
  19712. }
  19713. const popperPaneRef = computed(() => {
  19714. var _a2, _b2;
  19715. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  19716. });
  19717. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$1, "popperAppendToBody");
  19718. return {
  19719. tagInMultiLine,
  19720. prefixWidth,
  19721. selectSize,
  19722. readonly: readonly2,
  19723. handleResize,
  19724. collapseTagSize,
  19725. debouncedOnInputChange,
  19726. debouncedQueryChange,
  19727. deletePrevTag,
  19728. deleteTag,
  19729. deleteSelected,
  19730. handleOptionSelect,
  19731. scrollToOption,
  19732. inputWidth,
  19733. selected,
  19734. inputLength,
  19735. filteredOptionsCount,
  19736. visible,
  19737. softFocus,
  19738. selectedLabel,
  19739. hoverIndex,
  19740. query,
  19741. inputHovering,
  19742. currentPlaceholder,
  19743. menuVisibleOnFocus,
  19744. isOnComposition,
  19745. isSilentBlur,
  19746. options,
  19747. resetInputHeight,
  19748. managePlaceholder,
  19749. showClose,
  19750. selectDisabled,
  19751. iconComponent,
  19752. iconReverse,
  19753. showNewOption,
  19754. emptyText,
  19755. toggleLastOptionHitState,
  19756. resetInputState,
  19757. handleComposition,
  19758. handleMenuEnter,
  19759. handleFocus,
  19760. blur,
  19761. handleBlur,
  19762. handleClearClick,
  19763. handleClose,
  19764. toggleMenu,
  19765. selectOption,
  19766. getValueKey,
  19767. navigateOptions,
  19768. dropMenuVisible,
  19769. focus,
  19770. reference: reference2,
  19771. input,
  19772. tooltipRef,
  19773. popperPaneRef,
  19774. tags,
  19775. selectWrapper,
  19776. scrollbar,
  19777. wrapperKls,
  19778. selectTagsStyle,
  19779. compatTeleported,
  19780. nsSelect
  19781. };
  19782. }
  19783. });
  19784. const _hoisted_1$g = { class: "select-trigger" };
  19785. const _hoisted_2$e = ["disabled", "autocomplete"];
  19786. const _hoisted_3$9 = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  19787. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  19788. const _component_el_tag = resolveComponent("el-tag");
  19789. const _component_el_tooltip = resolveComponent("el-tooltip");
  19790. const _component_el_icon = resolveComponent("el-icon");
  19791. const _component_el_input = resolveComponent("el-input");
  19792. const _component_el_option = resolveComponent("el-option");
  19793. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  19794. const _component_el_select_menu = resolveComponent("el-select-menu");
  19795. const _directive_click_outside = resolveDirective("click-outside");
  19796. return withDirectives((openBlock(), createElementBlock("div", {
  19797. ref: "selectWrapper",
  19798. class: normalizeClass(_ctx.wrapperKls),
  19799. onClick: _cache[24] || (_cache[24] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  19800. }, [
  19801. createVNode(_component_el_tooltip, {
  19802. ref: "tooltipRef",
  19803. visible: _ctx.dropMenuVisible,
  19804. "onUpdate:visible": _cache[23] || (_cache[23] = ($event) => _ctx.dropMenuVisible = $event),
  19805. placement: "bottom-start",
  19806. teleported: _ctx.compatTeleported,
  19807. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  19808. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  19809. effect: _ctx.effect,
  19810. pure: "",
  19811. trigger: "click",
  19812. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  19813. "stop-popper-mouse-event": false,
  19814. "gpu-acceleration": false,
  19815. persistent: _ctx.persistent,
  19816. onShow: _ctx.handleMenuEnter
  19817. }, {
  19818. default: withCtx(() => [
  19819. createElementVNode("div", _hoisted_1$g, [
  19820. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  19821. key: 0,
  19822. ref: "tags",
  19823. class: normalizeClass(_ctx.nsSelect.e("tags")),
  19824. style: normalizeStyle(_ctx.selectTagsStyle)
  19825. }, [
  19826. _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createElementBlock("span", {
  19827. key: 0,
  19828. class: normalizeClass([
  19829. _ctx.nsSelect.b("tags-wrapper"),
  19830. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  19831. ])
  19832. }, [
  19833. createVNode(_component_el_tag, {
  19834. closable: !_ctx.selectDisabled && !_ctx.selected[0].isDisabled,
  19835. size: _ctx.collapseTagSize,
  19836. hit: _ctx.selected[0].hitState,
  19837. type: _ctx.tagType,
  19838. "disable-transitions": "",
  19839. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.selected[0]))
  19840. }, {
  19841. default: withCtx(() => [
  19842. createElementVNode("span", {
  19843. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  19844. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 123 + "px" })
  19845. }, toDisplayString(_ctx.selected[0].currentLabel), 7)
  19846. ]),
  19847. _: 1
  19848. }, 8, ["closable", "size", "hit", "type"]),
  19849. _ctx.selected.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
  19850. key: 0,
  19851. closable: false,
  19852. size: _ctx.collapseTagSize,
  19853. type: _ctx.tagType,
  19854. "disable-transitions": ""
  19855. }, {
  19856. default: withCtx(() => [
  19857. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  19858. key: 0,
  19859. disabled: _ctx.dropMenuVisible,
  19860. "fallback-placements": ["bottom", "top", "right", "left"],
  19861. effect: _ctx.effect,
  19862. placement: "bottom",
  19863. teleported: false
  19864. }, {
  19865. default: withCtx(() => [
  19866. createElementVNode("span", {
  19867. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  19868. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3)
  19869. ]),
  19870. content: withCtx(() => [
  19871. createElementVNode("div", {
  19872. class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  19873. }, [
  19874. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item, idx) => {
  19875. return openBlock(), createElementBlock("div", {
  19876. key: idx,
  19877. class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  19878. }, [
  19879. (openBlock(), createBlock(_component_el_tag, {
  19880. key: _ctx.getValueKey(item),
  19881. class: "in-tooltip",
  19882. closable: !_ctx.selectDisabled && !item.isDisabled,
  19883. size: _ctx.collapseTagSize,
  19884. hit: item.hitState,
  19885. type: _ctx.tagType,
  19886. "disable-transitions": "",
  19887. style: { margin: "2px" },
  19888. onClose: ($event) => _ctx.deleteTag($event, item)
  19889. }, {
  19890. default: withCtx(() => [
  19891. createElementVNode("span", {
  19892. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  19893. style: normalizeStyle({
  19894. maxWidth: _ctx.inputWidth - 75 + "px"
  19895. })
  19896. }, toDisplayString(item.currentLabel), 7)
  19897. ]),
  19898. _: 2
  19899. }, 1032, ["closable", "size", "hit", "type", "onClose"]))
  19900. ], 2);
  19901. }), 128))
  19902. ], 2)
  19903. ]),
  19904. _: 1
  19905. }, 8, ["disabled", "effect"])) : (openBlock(), createElementBlock("span", {
  19906. key: 1,
  19907. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  19908. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3))
  19909. ]),
  19910. _: 1
  19911. }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
  19912. ], 2)) : createCommentVNode("v-if", true),
  19913. createCommentVNode(" <div> "),
  19914. !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
  19915. key: 1,
  19916. onAfterLeave: _ctx.resetInputHeight
  19917. }, {
  19918. default: withCtx(() => [
  19919. createElementVNode("span", {
  19920. class: normalizeClass([
  19921. _ctx.nsSelect.b("tags-wrapper"),
  19922. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  19923. ])
  19924. }, [
  19925. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
  19926. return openBlock(), createBlock(_component_el_tag, {
  19927. key: _ctx.getValueKey(item),
  19928. closable: !_ctx.selectDisabled && !item.isDisabled,
  19929. size: _ctx.collapseTagSize,
  19930. hit: item.hitState,
  19931. type: _ctx.tagType,
  19932. "disable-transitions": "",
  19933. onClose: ($event) => _ctx.deleteTag($event, item)
  19934. }, {
  19935. default: withCtx(() => [
  19936. createElementVNode("span", {
  19937. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  19938. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  19939. }, toDisplayString(item.currentLabel), 7)
  19940. ]),
  19941. _: 2
  19942. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  19943. }), 128))
  19944. ], 2)
  19945. ]),
  19946. _: 1
  19947. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  19948. createCommentVNode(" </div> "),
  19949. _ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
  19950. key: 2,
  19951. ref: "input",
  19952. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.query = $event),
  19953. type: "text",
  19954. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  19955. disabled: _ctx.selectDisabled,
  19956. autocomplete: _ctx.autocomplete,
  19957. style: normalizeStyle({
  19958. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  19959. flexGrow: 1,
  19960. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  19961. maxWidth: `${_ctx.inputWidth - 42}px`
  19962. }),
  19963. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  19964. onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  19965. onKeyup: _cache[4] || (_cache[4] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  19966. onKeydown: [
  19967. _cache[5] || (_cache[5] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  19968. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  19969. _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  19970. _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  19971. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  19972. _cache[10] || (_cache[10] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  19973. _cache[11] || (_cache[11] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  19974. ],
  19975. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  19976. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  19977. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  19978. onInput: _cache[15] || (_cache[15] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  19979. }, null, 46, _hoisted_2$e)), [
  19980. [vModelText, _ctx.query]
  19981. ]) : createCommentVNode("v-if", true)
  19982. ], 6)) : createCommentVNode("v-if", true),
  19983. createVNode(_component_el_input, {
  19984. id: _ctx.id,
  19985. ref: "reference",
  19986. modelValue: _ctx.selectedLabel,
  19987. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.selectedLabel = $event),
  19988. type: "text",
  19989. placeholder: _ctx.currentPlaceholder,
  19990. name: _ctx.name,
  19991. autocomplete: _ctx.autocomplete,
  19992. size: _ctx.selectSize,
  19993. disabled: _ctx.selectDisabled,
  19994. readonly: _ctx.readonly,
  19995. "validate-event": false,
  19996. class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  19997. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  19998. onFocus: _ctx.handleFocus,
  19999. onBlur: _ctx.handleBlur,
  20000. onInput: _ctx.debouncedOnInputChange,
  20001. onPaste: _ctx.debouncedOnInputChange,
  20002. onCompositionstart: _ctx.handleComposition,
  20003. onCompositionupdate: _ctx.handleComposition,
  20004. onCompositionend: _ctx.handleComposition,
  20005. onKeydown: [
  20006. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  20007. _cache[18] || (_cache[18] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  20008. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  20009. _cache[19] || (_cache[19] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  20010. _cache[20] || (_cache[20] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  20011. ],
  20012. onMouseenter: _cache[21] || (_cache[21] = ($event) => _ctx.inputHovering = true),
  20013. onMouseleave: _cache[22] || (_cache[22] = ($event) => _ctx.inputHovering = false)
  20014. }, createSlots({
  20015. suffix: withCtx(() => [
  20016. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  20017. key: 0,
  20018. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  20019. }, {
  20020. default: withCtx(() => [
  20021. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  20022. ]),
  20023. _: 1
  20024. }, 8, ["class"])) : createCommentVNode("v-if", true),
  20025. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  20026. key: 1,
  20027. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  20028. onClick: _ctx.handleClearClick
  20029. }, {
  20030. default: withCtx(() => [
  20031. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  20032. ]),
  20033. _: 1
  20034. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  20035. ]),
  20036. _: 2
  20037. }, [
  20038. _ctx.$slots.prefix ? {
  20039. name: "prefix",
  20040. fn: withCtx(() => [
  20041. createElementVNode("div", _hoisted_3$9, [
  20042. renderSlot(_ctx.$slots, "prefix")
  20043. ])
  20044. ])
  20045. } : void 0
  20046. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  20047. ])
  20048. ]),
  20049. content: withCtx(() => [
  20050. createVNode(_component_el_select_menu, null, {
  20051. default: withCtx(() => [
  20052. withDirectives(createVNode(_component_el_scrollbar, {
  20053. ref: "scrollbar",
  20054. tag: "ul",
  20055. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  20056. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  20057. class: normalizeClass([
  20058. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  20059. ])
  20060. }, {
  20061. default: withCtx(() => [
  20062. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  20063. key: 0,
  20064. value: _ctx.query,
  20065. created: true
  20066. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  20067. renderSlot(_ctx.$slots, "default")
  20068. ]),
  20069. _: 3
  20070. }, 8, ["wrap-class", "view-class", "class"]), [
  20071. [vShow, _ctx.options.size > 0 && !_ctx.loading]
  20072. ]),
  20073. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  20074. _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
  20075. key: 1,
  20076. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  20077. }, toDisplayString(_ctx.emptyText), 3))
  20078. ], 2112)) : createCommentVNode("v-if", true)
  20079. ]),
  20080. _: 3
  20081. })
  20082. ]),
  20083. _: 3
  20084. }, 8, ["visible", "teleported", "popper-class", "effect", "transition", "persistent", "onShow"])
  20085. ], 2)), [
  20086. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  20087. ]);
  20088. }
  20089. 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"]]);
  20090. const _sfc_main$m = defineComponent({
  20091. name: "ElOptionGroup",
  20092. componentName: "ElOptionGroup",
  20093. props: {
  20094. label: String,
  20095. disabled: {
  20096. type: Boolean,
  20097. default: false
  20098. }
  20099. },
  20100. setup(props) {
  20101. const ns = useNamespace("select");
  20102. const visible = ref(true);
  20103. const instance = getCurrentInstance();
  20104. const children = ref([]);
  20105. provide(selectGroupKey, reactive(__spreadValues({}, toRefs(props))));
  20106. const select = inject(selectKey);
  20107. onMounted(() => {
  20108. children.value = flattedChildren(instance.subTree);
  20109. });
  20110. const flattedChildren = (node) => {
  20111. const children2 = [];
  20112. if (Array.isArray(node.children)) {
  20113. node.children.forEach((child) => {
  20114. var _a2;
  20115. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  20116. children2.push(child.component.proxy);
  20117. } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
  20118. children2.push(...flattedChildren(child));
  20119. }
  20120. });
  20121. }
  20122. return children2;
  20123. };
  20124. const { groupQueryChange } = toRaw(select);
  20125. watch(groupQueryChange, () => {
  20126. visible.value = children.value.some((option) => option.visible === true);
  20127. });
  20128. return {
  20129. visible,
  20130. ns
  20131. };
  20132. }
  20133. });
  20134. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  20135. return withDirectives((openBlock(), createElementBlock("ul", {
  20136. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  20137. }, [
  20138. createElementVNode("li", {
  20139. class: normalizeClass(_ctx.ns.be("group", "title"))
  20140. }, toDisplayString(_ctx.label), 3),
  20141. createElementVNode("li", null, [
  20142. createElementVNode("ul", {
  20143. class: normalizeClass(_ctx.ns.b("group"))
  20144. }, [
  20145. renderSlot(_ctx.$slots, "default")
  20146. ], 2)
  20147. ])
  20148. ], 2)), [
  20149. [vShow, _ctx.visible]
  20150. ]);
  20151. }
  20152. 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"]]);
  20153. const ElSelect = withInstall(Select, {
  20154. Option,
  20155. OptionGroup
  20156. });
  20157. const ElOption = withNoopInstall(Option);
  20158. withNoopInstall(OptionGroup);
  20159. const progressProps = buildProps({
  20160. type: {
  20161. type: String,
  20162. default: "line",
  20163. values: ["line", "circle", "dashboard"]
  20164. },
  20165. percentage: {
  20166. type: Number,
  20167. default: 0,
  20168. validator: (val) => val >= 0 && val <= 100
  20169. },
  20170. status: {
  20171. type: String,
  20172. default: "",
  20173. values: ["", "success", "exception", "warning"]
  20174. },
  20175. indeterminate: {
  20176. type: Boolean,
  20177. default: false
  20178. },
  20179. duration: {
  20180. type: Number,
  20181. default: 3
  20182. },
  20183. strokeWidth: {
  20184. type: Number,
  20185. default: 6
  20186. },
  20187. strokeLinecap: {
  20188. type: definePropType(String),
  20189. default: "round"
  20190. },
  20191. textInside: {
  20192. type: Boolean,
  20193. default: false
  20194. },
  20195. width: {
  20196. type: Number,
  20197. default: 126
  20198. },
  20199. showText: {
  20200. type: Boolean,
  20201. default: true
  20202. },
  20203. color: {
  20204. type: definePropType([
  20205. String,
  20206. Array,
  20207. Function
  20208. ]),
  20209. default: ""
  20210. },
  20211. format: {
  20212. type: definePropType(Function),
  20213. default: (percentage) => `${percentage}%`
  20214. }
  20215. });
  20216. const _sfc_main$l = defineComponent({
  20217. name: "ElProgress",
  20218. components: {
  20219. ElIcon,
  20220. CircleCheck: circleCheck,
  20221. CircleClose: circleClose,
  20222. Check: check,
  20223. Close: close,
  20224. WarningFilled: warningFilled
  20225. },
  20226. props: progressProps,
  20227. setup(props) {
  20228. const ns = useNamespace("progress");
  20229. const barStyle = computed(() => ({
  20230. width: `${props.percentage}%`,
  20231. animationDuration: `${props.duration}s`,
  20232. backgroundColor: getCurrentColor(props.percentage)
  20233. }));
  20234. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  20235. const radius = computed(() => {
  20236. if (props.type === "circle" || props.type === "dashboard") {
  20237. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  20238. } else {
  20239. return 0;
  20240. }
  20241. });
  20242. const trackPath = computed(() => {
  20243. const r = radius.value;
  20244. const isDashboard = props.type === "dashboard";
  20245. return `
  20246. M 50 50
  20247. m 0 ${isDashboard ? "" : "-"}${r}
  20248. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  20249. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  20250. `;
  20251. });
  20252. const perimeter = computed(() => 2 * Math.PI * radius.value);
  20253. const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
  20254. const strokeDashoffset = computed(() => {
  20255. const offset2 = -1 * perimeter.value * (1 - rate.value) / 2;
  20256. return `${offset2}px`;
  20257. });
  20258. const trailPathStyle = computed(() => ({
  20259. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  20260. strokeDashoffset: strokeDashoffset.value
  20261. }));
  20262. const circlePathStyle = computed(() => ({
  20263. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  20264. strokeDashoffset: strokeDashoffset.value,
  20265. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"
  20266. }));
  20267. const stroke = computed(() => {
  20268. let ret;
  20269. if (props.color) {
  20270. ret = getCurrentColor(props.percentage);
  20271. } else {
  20272. switch (props.status) {
  20273. case "success":
  20274. ret = "#13ce66";
  20275. break;
  20276. case "exception":
  20277. ret = "#ff4949";
  20278. break;
  20279. case "warning":
  20280. ret = "#e6a23c";
  20281. break;
  20282. default:
  20283. ret = "#20a0ff";
  20284. }
  20285. }
  20286. return ret;
  20287. });
  20288. const statusIcon = computed(() => {
  20289. if (props.status === "warning") {
  20290. return warningFilled;
  20291. }
  20292. if (props.type === "line") {
  20293. return props.status === "success" ? circleCheck : circleClose;
  20294. } else {
  20295. return props.status === "success" ? check : close;
  20296. }
  20297. });
  20298. const progressTextSize = computed(() => {
  20299. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  20300. });
  20301. const content2 = computed(() => props.format(props.percentage));
  20302. const getCurrentColor = (percentage) => {
  20303. var _a2;
  20304. const { color } = props;
  20305. if (typeof color === "function") {
  20306. return color(percentage);
  20307. } else if (typeof color === "string") {
  20308. return color;
  20309. } else {
  20310. const span = 100 / color.length;
  20311. const seriesColors = color.map((seriesColor, index) => {
  20312. if (typeof seriesColor === "string") {
  20313. return {
  20314. color: seriesColor,
  20315. percentage: (index + 1) * span
  20316. };
  20317. }
  20318. return seriesColor;
  20319. });
  20320. const colors = seriesColors.sort((a2, b2) => a2.percentage - b2.percentage);
  20321. for (const color2 of colors) {
  20322. if (color2.percentage > percentage)
  20323. return color2.color;
  20324. }
  20325. return (_a2 = colors[colors.length - 1]) == null ? void 0 : _a2.color;
  20326. }
  20327. };
  20328. const slotData = computed(() => {
  20329. return {
  20330. percentage: props.percentage
  20331. };
  20332. });
  20333. return {
  20334. ns,
  20335. barStyle,
  20336. relativeStrokeWidth,
  20337. radius,
  20338. trackPath,
  20339. perimeter,
  20340. rate,
  20341. strokeDashoffset,
  20342. trailPathStyle,
  20343. circlePathStyle,
  20344. stroke,
  20345. statusIcon,
  20346. progressTextSize,
  20347. content: content2,
  20348. slotData
  20349. };
  20350. }
  20351. });
  20352. const _hoisted_1$f = ["aria-valuenow"];
  20353. const _hoisted_2$d = { viewBox: "0 0 100 100" };
  20354. const _hoisted_3$8 = ["d", "stroke-width"];
  20355. const _hoisted_4$7 = ["d", "stroke", "stroke-linecap", "stroke-width"];
  20356. const _hoisted_5$7 = { key: 0 };
  20357. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  20358. const _component_el_icon = resolveComponent("el-icon");
  20359. return openBlock(), createElementBlock("div", {
  20360. class: normalizeClass([
  20361. _ctx.ns.b(),
  20362. _ctx.ns.m(_ctx.type),
  20363. _ctx.ns.is(_ctx.status),
  20364. {
  20365. [_ctx.ns.m("without-text")]: !_ctx.showText,
  20366. [_ctx.ns.m("text-inside")]: _ctx.textInside
  20367. }
  20368. ]),
  20369. role: "progressbar",
  20370. "aria-valuenow": _ctx.percentage,
  20371. "aria-valuemin": "0",
  20372. "aria-valuemax": "100"
  20373. }, [
  20374. _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
  20375. key: 0,
  20376. class: normalizeClass(_ctx.ns.b("bar"))
  20377. }, [
  20378. createElementVNode("div", {
  20379. class: normalizeClass(_ctx.ns.be("bar", "outer")),
  20380. style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  20381. }, [
  20382. createElementVNode("div", {
  20383. class: normalizeClass([
  20384. _ctx.ns.be("bar", "inner"),
  20385. { [_ctx.ns.bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }
  20386. ]),
  20387. style: normalizeStyle(_ctx.barStyle)
  20388. }, [
  20389. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
  20390. key: 0,
  20391. class: normalizeClass(_ctx.ns.be("bar", "innerText"))
  20392. }, [
  20393. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20394. createElementVNode("span", null, toDisplayString(_ctx.content), 1)
  20395. ])
  20396. ], 2)) : createCommentVNode("v-if", true)
  20397. ], 6)
  20398. ], 6)
  20399. ], 2)) : (openBlock(), createElementBlock("div", {
  20400. key: 1,
  20401. class: normalizeClass(_ctx.ns.b("circle")),
  20402. style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  20403. }, [
  20404. (openBlock(), createElementBlock("svg", _hoisted_2$d, [
  20405. createElementVNode("path", {
  20406. class: normalizeClass(_ctx.ns.be("circle", "track")),
  20407. d: _ctx.trackPath,
  20408. stroke: "var(--el-fill-color-light, #e5e9f2)",
  20409. "stroke-width": _ctx.relativeStrokeWidth,
  20410. fill: "none",
  20411. style: normalizeStyle(_ctx.trailPathStyle)
  20412. }, null, 14, _hoisted_3$8),
  20413. createElementVNode("path", {
  20414. class: normalizeClass(_ctx.ns.be("circle", "path")),
  20415. d: _ctx.trackPath,
  20416. stroke: _ctx.stroke,
  20417. fill: "none",
  20418. "stroke-linecap": _ctx.strokeLinecap,
  20419. "stroke-width": _ctx.percentage ? _ctx.relativeStrokeWidth : 0,
  20420. style: normalizeStyle(_ctx.circlePathStyle)
  20421. }, null, 14, _hoisted_4$7)
  20422. ]))
  20423. ], 6)),
  20424. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
  20425. key: 2,
  20426. class: normalizeClass(_ctx.ns.e("text")),
  20427. style: normalizeStyle({ fontSize: `${_ctx.progressTextSize}px` })
  20428. }, [
  20429. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20430. !_ctx.status ? (openBlock(), createElementBlock("span", _hoisted_5$7, toDisplayString(_ctx.content), 1)) : (openBlock(), createBlock(_component_el_icon, { key: 1 }, {
  20431. default: withCtx(() => [
  20432. (openBlock(), createBlock(resolveDynamicComponent(_ctx.statusIcon)))
  20433. ]),
  20434. _: 1
  20435. }))
  20436. ])
  20437. ], 6)) : createCommentVNode("v-if", true)
  20438. ], 10, _hoisted_1$f);
  20439. }
  20440. 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"]]);
  20441. const ElProgress = withInstall(Progress);
  20442. const rateProps = buildProps({
  20443. modelValue: {
  20444. type: Number,
  20445. default: 0
  20446. },
  20447. lowThreshold: {
  20448. type: Number,
  20449. default: 2
  20450. },
  20451. highThreshold: {
  20452. type: Number,
  20453. default: 4
  20454. },
  20455. max: {
  20456. type: Number,
  20457. default: 5
  20458. },
  20459. colors: {
  20460. type: definePropType([Array, Object]),
  20461. default: () => mutable(["", "", ""])
  20462. },
  20463. voidColor: {
  20464. type: String,
  20465. default: ""
  20466. },
  20467. disabledVoidColor: {
  20468. type: String,
  20469. default: ""
  20470. },
  20471. icons: {
  20472. type: definePropType([Array, Object]),
  20473. default: () => [starFilled, starFilled, starFilled]
  20474. },
  20475. voidIcon: {
  20476. type: iconPropType,
  20477. default: () => star
  20478. },
  20479. disabledVoidIcon: {
  20480. type: iconPropType,
  20481. default: () => starFilled
  20482. },
  20483. disabled: {
  20484. type: Boolean,
  20485. default: false
  20486. },
  20487. allowHalf: {
  20488. type: Boolean,
  20489. default: false
  20490. },
  20491. showText: {
  20492. type: Boolean,
  20493. default: false
  20494. },
  20495. showScore: {
  20496. type: Boolean,
  20497. default: false
  20498. },
  20499. textColor: {
  20500. type: String,
  20501. default: ""
  20502. },
  20503. texts: {
  20504. type: definePropType(Array),
  20505. default: () => mutable([
  20506. "Extremely bad",
  20507. "Disappointed",
  20508. "Fair",
  20509. "Satisfied",
  20510. "Surprise"
  20511. ])
  20512. },
  20513. scoreTemplate: {
  20514. type: String,
  20515. default: "{value}"
  20516. },
  20517. size: {
  20518. type: String,
  20519. validator: isValidComponentSize
  20520. }
  20521. });
  20522. const rateEmits = {
  20523. change: (value) => typeof value === "number",
  20524. [UPDATE_MODEL_EVENT]: (value) => typeof value === "number"
  20525. };
  20526. const _hoisted_1$e = ["aria-valuenow", "aria-valuetext", "aria-valuemax"];
  20527. const _hoisted_2$c = ["onMousemove", "onClick"];
  20528. const __default__$5 = {
  20529. name: "ElRate"
  20530. };
  20531. const _sfc_main$k = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
  20532. props: rateProps,
  20533. emits: rateEmits,
  20534. setup(__props, { expose, emit }) {
  20535. const props = __props;
  20536. function getValueFromMap(value, map) {
  20537. const isExcludedObject = (val) => isObject$1(val);
  20538. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  20539. const val = map[key];
  20540. const excluded = isExcludedObject(val) ? val.excluded : false;
  20541. return excluded ? value < key : value <= key;
  20542. }).sort((a2, b2) => a2 - b2);
  20543. const matchedValue = map[matchedKeys[0]];
  20544. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  20545. }
  20546. const formContext = inject(formContextKey, void 0);
  20547. const rateSize = useSize();
  20548. const ns = useNamespace("rate");
  20549. const currentValue = ref(props.modelValue);
  20550. const hoverIndex = ref(-1);
  20551. const pointerAtLeftHalf = ref(true);
  20552. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  20553. const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  20554. const rateStyles = computed(() => {
  20555. return {
  20556. "--el-rate-void-color": props.voidColor,
  20557. "--el-rate-disabled-void-color": props.disabledVoidColor,
  20558. "--el-rate-fill-color": activeColor.value
  20559. };
  20560. });
  20561. const text = computed(() => {
  20562. let result = "";
  20563. if (props.showScore) {
  20564. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  20565. } else if (props.showText) {
  20566. result = props.texts[Math.ceil(currentValue.value) - 1];
  20567. }
  20568. return result;
  20569. });
  20570. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  20571. const colorMap = computed(() => isArray(props.colors) ? {
  20572. [props.lowThreshold]: props.colors[0],
  20573. [props.highThreshold]: { value: props.colors[1], excluded: true },
  20574. [props.max]: props.colors[2]
  20575. } : props.colors);
  20576. const activeColor = computed(() => {
  20577. const color = getValueFromMap(currentValue.value, colorMap.value);
  20578. return isObject$1(color) ? "" : color;
  20579. });
  20580. const decimalStyle = computed(() => {
  20581. let width = "";
  20582. if (rateDisabled.value) {
  20583. width = `${valueDecimal.value}%`;
  20584. } else if (props.allowHalf) {
  20585. width = "50%";
  20586. }
  20587. return {
  20588. color: activeColor.value,
  20589. width
  20590. };
  20591. });
  20592. const componentMap = computed(() => isArray(props.icons) ? {
  20593. [props.lowThreshold]: props.icons[0],
  20594. [props.highThreshold]: {
  20595. value: props.icons[1],
  20596. excluded: true
  20597. },
  20598. [props.max]: props.icons[2]
  20599. } : props.icons);
  20600. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  20601. const voidComponent = computed(() => rateDisabled.value ? props.disabledVoidIcon : props.voidIcon);
  20602. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  20603. const iconComponents = computed(() => {
  20604. const result = Array.from({ length: props.max });
  20605. const threshold = currentValue.value;
  20606. result.fill(activeComponent.value, 0, threshold);
  20607. result.fill(voidComponent.value, threshold, props.max);
  20608. return result;
  20609. });
  20610. function showDecimalIcon(item) {
  20611. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  20612. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  20613. return showWhenDisabled || showWhenAllowHalf;
  20614. }
  20615. function selectValue(value) {
  20616. if (rateDisabled.value) {
  20617. return;
  20618. }
  20619. if (props.allowHalf && pointerAtLeftHalf.value) {
  20620. emit(UPDATE_MODEL_EVENT, currentValue.value);
  20621. if (props.modelValue !== currentValue.value) {
  20622. emit("change", currentValue.value);
  20623. }
  20624. } else {
  20625. emit(UPDATE_MODEL_EVENT, value);
  20626. if (props.modelValue !== value) {
  20627. emit("change", value);
  20628. }
  20629. }
  20630. }
  20631. function handleKey(e) {
  20632. if (rateDisabled.value) {
  20633. return;
  20634. }
  20635. let _currentValue = currentValue.value;
  20636. const code = e.code;
  20637. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  20638. if (props.allowHalf) {
  20639. _currentValue += 0.5;
  20640. } else {
  20641. _currentValue += 1;
  20642. }
  20643. e.stopPropagation();
  20644. e.preventDefault();
  20645. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  20646. if (props.allowHalf) {
  20647. _currentValue -= 0.5;
  20648. } else {
  20649. _currentValue -= 1;
  20650. }
  20651. e.stopPropagation();
  20652. e.preventDefault();
  20653. }
  20654. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  20655. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  20656. emit(UPDATE_MODEL_EVENT, _currentValue);
  20657. emit("change", _currentValue);
  20658. return _currentValue;
  20659. }
  20660. function setCurrentValue(value, event) {
  20661. if (rateDisabled.value) {
  20662. return;
  20663. }
  20664. if (props.allowHalf) {
  20665. let target = event.target;
  20666. if (hasClass(target, ns.e("item"))) {
  20667. target = target.querySelector(`.${ns.e("icon")}`);
  20668. }
  20669. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  20670. target = target.parentNode;
  20671. }
  20672. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  20673. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  20674. } else {
  20675. currentValue.value = value;
  20676. }
  20677. hoverIndex.value = value;
  20678. }
  20679. function resetCurrentValue() {
  20680. if (rateDisabled.value) {
  20681. return;
  20682. }
  20683. if (props.allowHalf) {
  20684. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20685. }
  20686. currentValue.value = props.modelValue;
  20687. hoverIndex.value = -1;
  20688. }
  20689. watch(() => props.modelValue, (val) => {
  20690. currentValue.value = val;
  20691. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20692. });
  20693. if (!props.modelValue) {
  20694. emit(UPDATE_MODEL_EVENT, 0);
  20695. }
  20696. expose({
  20697. setCurrentValue,
  20698. resetCurrentValue
  20699. });
  20700. return (_ctx, _cache) => {
  20701. return openBlock(), createElementBlock("div", {
  20702. class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
  20703. role: "slider",
  20704. "aria-valuenow": currentValue.value,
  20705. "aria-valuetext": unref(text),
  20706. "aria-valuemin": "0",
  20707. "aria-valuemax": _ctx.max,
  20708. tabindex: "0",
  20709. style: normalizeStyle(unref(rateStyles)),
  20710. onKeydown: handleKey
  20711. }, [
  20712. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
  20713. return openBlock(), createElementBlock("span", {
  20714. key,
  20715. class: normalizeClass(unref(ns).e("item")),
  20716. onMousemove: ($event) => setCurrentValue(item, $event),
  20717. onMouseleave: resetCurrentValue,
  20718. onClick: ($event) => selectValue(item)
  20719. }, [
  20720. createVNode(unref(ElIcon), {
  20721. class: normalizeClass([
  20722. unref(ns).e("icon"),
  20723. { hover: hoverIndex.value === item },
  20724. unref(ns).is("active", item <= currentValue.value)
  20725. ])
  20726. }, {
  20727. default: withCtx(() => [
  20728. !showDecimalIcon(item) ? (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponents)[item - 1]), { key: 0 })) : createCommentVNode("v-if", true),
  20729. showDecimalIcon(item) ? (openBlock(), createBlock(unref(ElIcon), {
  20730. key: 1,
  20731. style: normalizeStyle(unref(decimalStyle)),
  20732. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  20733. }, {
  20734. default: withCtx(() => [
  20735. (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
  20736. ]),
  20737. _: 1
  20738. }, 8, ["style", "class"])) : createCommentVNode("v-if", true)
  20739. ]),
  20740. _: 2
  20741. }, 1032, ["class"])
  20742. ], 42, _hoisted_2$c);
  20743. }), 128)),
  20744. _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
  20745. key: 0,
  20746. class: normalizeClass(unref(ns).e("text"))
  20747. }, toDisplayString(unref(text)), 3)) : createCommentVNode("v-if", true)
  20748. ], 46, _hoisted_1$e);
  20749. };
  20750. }
  20751. }));
  20752. var Rate = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/rate/src/rate.vue"]]);
  20753. const ElRate = withInstall(Rate);
  20754. const useTooltip = (props, formatTooltip, showTooltip) => {
  20755. const tooltip = ref(null);
  20756. const tooltipVisible = ref(false);
  20757. const enableFormat = computed(() => {
  20758. return formatTooltip.value instanceof Function;
  20759. });
  20760. const formatValue = computed(() => {
  20761. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  20762. });
  20763. const displayTooltip = debounce$1(() => {
  20764. showTooltip.value && (tooltipVisible.value = true);
  20765. }, 50);
  20766. const hideTooltip = debounce$1(() => {
  20767. showTooltip.value && (tooltipVisible.value = false);
  20768. }, 50);
  20769. return {
  20770. tooltip,
  20771. tooltipVisible,
  20772. formatValue,
  20773. displayTooltip,
  20774. hideTooltip
  20775. };
  20776. };
  20777. const useSliderButton = (props, initData, emit) => {
  20778. const {
  20779. disabled,
  20780. min: min2,
  20781. max: max2,
  20782. step,
  20783. showTooltip,
  20784. precision,
  20785. sliderSize,
  20786. formatTooltip,
  20787. emitChange,
  20788. resetSize,
  20789. updateDragging
  20790. } = inject("SliderProvider");
  20791. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  20792. const currentPosition = computed(() => {
  20793. return `${(props.modelValue - min2.value) / (max2.value - min2.value) * 100}%`;
  20794. });
  20795. const wrapperStyle = computed(() => {
  20796. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  20797. });
  20798. const handleMouseEnter = () => {
  20799. initData.hovering = true;
  20800. displayTooltip();
  20801. };
  20802. const handleMouseLeave = () => {
  20803. initData.hovering = false;
  20804. if (!initData.dragging) {
  20805. hideTooltip();
  20806. }
  20807. };
  20808. const onButtonDown = (event) => {
  20809. if (disabled.value)
  20810. return;
  20811. event.preventDefault();
  20812. onDragStart(event);
  20813. on(window, "mousemove", onDragging);
  20814. on(window, "touchmove", onDragging);
  20815. on(window, "mouseup", onDragEnd);
  20816. on(window, "touchend", onDragEnd);
  20817. on(window, "contextmenu", onDragEnd);
  20818. };
  20819. const onLeftKeyDown = () => {
  20820. if (disabled.value)
  20821. return;
  20822. initData.newPosition = Number.parseFloat(currentPosition.value) - step.value / (max2.value - min2.value) * 100;
  20823. setPosition(initData.newPosition);
  20824. emitChange();
  20825. };
  20826. const onRightKeyDown = () => {
  20827. if (disabled.value)
  20828. return;
  20829. initData.newPosition = Number.parseFloat(currentPosition.value) + step.value / (max2.value - min2.value) * 100;
  20830. setPosition(initData.newPosition);
  20831. emitChange();
  20832. };
  20833. const getClientXY = (event) => {
  20834. let clientX;
  20835. let clientY;
  20836. if (event.type.startsWith("touch")) {
  20837. clientY = event.touches[0].clientY;
  20838. clientX = event.touches[0].clientX;
  20839. } else {
  20840. clientY = event.clientY;
  20841. clientX = event.clientX;
  20842. }
  20843. return {
  20844. clientX,
  20845. clientY
  20846. };
  20847. };
  20848. const onDragStart = (event) => {
  20849. initData.dragging = true;
  20850. initData.isClick = true;
  20851. const { clientX, clientY } = getClientXY(event);
  20852. if (props.vertical) {
  20853. initData.startY = clientY;
  20854. } else {
  20855. initData.startX = clientX;
  20856. }
  20857. initData.startPosition = Number.parseFloat(currentPosition.value);
  20858. initData.newPosition = initData.startPosition;
  20859. };
  20860. const onDragging = (event) => {
  20861. if (initData.dragging) {
  20862. initData.isClick = false;
  20863. displayTooltip();
  20864. resetSize();
  20865. let diff;
  20866. const { clientX, clientY } = getClientXY(event);
  20867. if (props.vertical) {
  20868. initData.currentY = clientY;
  20869. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  20870. } else {
  20871. initData.currentX = clientX;
  20872. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  20873. }
  20874. initData.newPosition = initData.startPosition + diff;
  20875. setPosition(initData.newPosition);
  20876. }
  20877. };
  20878. const onDragEnd = () => {
  20879. if (initData.dragging) {
  20880. setTimeout(() => {
  20881. initData.dragging = false;
  20882. if (!initData.hovering) {
  20883. hideTooltip();
  20884. }
  20885. if (!initData.isClick) {
  20886. setPosition(initData.newPosition);
  20887. emitChange();
  20888. }
  20889. }, 0);
  20890. off(window, "mousemove", onDragging);
  20891. off(window, "touchmove", onDragging);
  20892. off(window, "mouseup", onDragEnd);
  20893. off(window, "touchend", onDragEnd);
  20894. off(window, "contextmenu", onDragEnd);
  20895. }
  20896. };
  20897. const setPosition = async (newPosition) => {
  20898. if (newPosition === null || Number.isNaN(+newPosition))
  20899. return;
  20900. if (newPosition < 0) {
  20901. newPosition = 0;
  20902. } else if (newPosition > 100) {
  20903. newPosition = 100;
  20904. }
  20905. const lengthPerStep = 100 / ((max2.value - min2.value) / step.value);
  20906. const steps = Math.round(newPosition / lengthPerStep);
  20907. let value = steps * lengthPerStep * (max2.value - min2.value) * 0.01 + min2.value;
  20908. value = Number.parseFloat(value.toFixed(precision.value));
  20909. emit(UPDATE_MODEL_EVENT, value);
  20910. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  20911. initData.oldValue = props.modelValue;
  20912. }
  20913. await nextTick();
  20914. initData.dragging && displayTooltip();
  20915. tooltip.value.updatePopper();
  20916. };
  20917. watch(() => initData.dragging, (val) => {
  20918. updateDragging(val);
  20919. });
  20920. return {
  20921. tooltip,
  20922. tooltipVisible,
  20923. showTooltip,
  20924. wrapperStyle,
  20925. formatValue,
  20926. handleMouseEnter,
  20927. handleMouseLeave,
  20928. onButtonDown,
  20929. onLeftKeyDown,
  20930. onRightKeyDown,
  20931. setPosition
  20932. };
  20933. };
  20934. const _sfc_main$j = defineComponent({
  20935. name: "ElSliderButton",
  20936. components: {
  20937. ElTooltip
  20938. },
  20939. props: {
  20940. modelValue: {
  20941. type: Number,
  20942. default: 0
  20943. },
  20944. vertical: {
  20945. type: Boolean,
  20946. default: false
  20947. },
  20948. tooltipClass: {
  20949. type: String,
  20950. default: ""
  20951. }
  20952. },
  20953. emits: [UPDATE_MODEL_EVENT],
  20954. setup(props, { emit }) {
  20955. const ns = useNamespace("slider");
  20956. const initData = reactive({
  20957. hovering: false,
  20958. dragging: false,
  20959. isClick: false,
  20960. startX: 0,
  20961. currentX: 0,
  20962. startY: 0,
  20963. currentY: 0,
  20964. startPosition: 0,
  20965. newPosition: 0,
  20966. oldValue: props.modelValue
  20967. });
  20968. const {
  20969. tooltip,
  20970. showTooltip,
  20971. tooltipVisible,
  20972. wrapperStyle,
  20973. formatValue,
  20974. handleMouseEnter,
  20975. handleMouseLeave,
  20976. onButtonDown,
  20977. onLeftKeyDown,
  20978. onRightKeyDown,
  20979. setPosition
  20980. } = useSliderButton(props, initData, emit);
  20981. const { hovering, dragging } = toRefs(initData);
  20982. return {
  20983. ns,
  20984. tooltip,
  20985. tooltipVisible,
  20986. showTooltip,
  20987. wrapperStyle,
  20988. formatValue,
  20989. handleMouseEnter,
  20990. handleMouseLeave,
  20991. onButtonDown,
  20992. onLeftKeyDown,
  20993. onRightKeyDown,
  20994. setPosition,
  20995. hovering,
  20996. dragging
  20997. };
  20998. }
  20999. });
  21000. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  21001. const _component_el_tooltip = resolveComponent("el-tooltip");
  21002. return openBlock(), createElementBlock("div", {
  21003. ref: "button",
  21004. class: normalizeClass([_ctx.ns.e("button-wrapper"), { hover: _ctx.hovering, dragging: _ctx.dragging }]),
  21005. style: normalizeStyle(_ctx.wrapperStyle),
  21006. tabindex: "0",
  21007. onMouseenter: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  21008. onMouseleave: _cache[2] || (_cache[2] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  21009. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  21010. onTouchstart: _cache[4] || (_cache[4] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  21011. onFocus: _cache[5] || (_cache[5] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  21012. onBlur: _cache[6] || (_cache[6] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  21013. onKeydown: [
  21014. _cache[7] || (_cache[7] = withKeys((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["left"])),
  21015. _cache[8] || (_cache[8] = withKeys((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["right"])),
  21016. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["prevent"]), ["down"])),
  21017. _cache[10] || (_cache[10] = withKeys(withModifiers((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["prevent"]), ["up"]))
  21018. ]
  21019. }, [
  21020. createVNode(_component_el_tooltip, {
  21021. ref: "tooltip",
  21022. visible: _ctx.tooltipVisible,
  21023. "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.tooltipVisible = $event),
  21024. placement: "top",
  21025. "stop-popper-mouse-event": false,
  21026. "popper-class": _ctx.tooltipClass,
  21027. disabled: !_ctx.showTooltip,
  21028. persistent: ""
  21029. }, {
  21030. content: withCtx(() => [
  21031. createElementVNode("span", null, toDisplayString(_ctx.formatValue), 1)
  21032. ]),
  21033. default: withCtx(() => [
  21034. createElementVNode("div", {
  21035. class: normalizeClass([_ctx.ns.e("button"), { hover: _ctx.hovering, dragging: _ctx.dragging }])
  21036. }, null, 2)
  21037. ]),
  21038. _: 1
  21039. }, 8, ["visible", "popper-class", "disabled"])
  21040. ], 38);
  21041. }
  21042. 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"]]);
  21043. const _sfc_main$i = defineComponent({
  21044. name: "ElMarker",
  21045. props: {
  21046. mark: {
  21047. type: [String, Object],
  21048. default: () => void 0
  21049. }
  21050. },
  21051. setup(props) {
  21052. const ns = useNamespace("slider");
  21053. const label = computed(() => {
  21054. return typeof props.mark === "string" ? props.mark : props.mark.label;
  21055. });
  21056. return {
  21057. ns,
  21058. label
  21059. };
  21060. },
  21061. render() {
  21062. var _a2;
  21063. return h$1("div", {
  21064. class: this.ns.e("marks-text"),
  21065. style: (_a2 = this.mark) == null ? void 0 : _a2.style
  21066. }, this.label);
  21067. }
  21068. });
  21069. var SliderMarker = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/marker.vue"]]);
  21070. const useMarks = (props) => {
  21071. return computed(() => {
  21072. if (!props.marks) {
  21073. return [];
  21074. }
  21075. const marksKeys = Object.keys(props.marks);
  21076. return marksKeys.map(parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  21077. point,
  21078. position: (point - props.min) * 100 / (props.max - props.min),
  21079. mark: props.marks[point]
  21080. }));
  21081. });
  21082. };
  21083. const useSlide = (props, initData, emit) => {
  21084. const elForm2 = inject(formContextKey, {});
  21085. const elFormItem2 = inject(formItemContextKey, {});
  21086. const slider = shallowRef(null);
  21087. const firstButton = ref(null);
  21088. const secondButton = ref(null);
  21089. const buttonRefs = {
  21090. firstButton,
  21091. secondButton
  21092. };
  21093. const sliderDisabled = computed(() => {
  21094. return props.disabled || elForm2.disabled || false;
  21095. });
  21096. const minValue = computed(() => {
  21097. return Math.min(initData.firstValue, initData.secondValue);
  21098. });
  21099. const maxValue = computed(() => {
  21100. return Math.max(initData.firstValue, initData.secondValue);
  21101. });
  21102. const barSize = computed(() => {
  21103. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  21104. });
  21105. const barStart = computed(() => {
  21106. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  21107. });
  21108. const runwayStyle = computed(() => {
  21109. return props.vertical ? { height: props.height } : {};
  21110. });
  21111. const barStyle = computed(() => {
  21112. return props.vertical ? {
  21113. height: barSize.value,
  21114. bottom: barStart.value
  21115. } : {
  21116. width: barSize.value,
  21117. left: barStart.value
  21118. };
  21119. });
  21120. const resetSize = () => {
  21121. if (slider.value) {
  21122. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  21123. }
  21124. };
  21125. const setPosition = (percent) => {
  21126. const targetValue = props.min + percent * (props.max - props.min) / 100;
  21127. if (!props.range) {
  21128. firstButton.value.setPosition(percent);
  21129. return;
  21130. }
  21131. let buttonRefName;
  21132. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  21133. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  21134. } else {
  21135. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  21136. }
  21137. buttonRefs[buttonRefName].value.setPosition(percent);
  21138. };
  21139. const setFirstValue = (firstValue) => {
  21140. initData.firstValue = firstValue;
  21141. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  21142. };
  21143. const setSecondValue = (secondValue) => {
  21144. initData.secondValue = secondValue;
  21145. if (props.range) {
  21146. _emit([minValue.value, maxValue.value]);
  21147. }
  21148. };
  21149. const _emit = (val) => {
  21150. emit(UPDATE_MODEL_EVENT, val);
  21151. emit(INPUT_EVENT, val);
  21152. };
  21153. const emitChange = async () => {
  21154. await nextTick();
  21155. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  21156. };
  21157. const onSliderClick = (event) => {
  21158. if (sliderDisabled.value || initData.dragging)
  21159. return;
  21160. resetSize();
  21161. if (props.vertical) {
  21162. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  21163. setPosition((sliderOffsetBottom - event.clientY) / initData.sliderSize * 100);
  21164. } else {
  21165. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  21166. setPosition((event.clientX - sliderOffsetLeft) / initData.sliderSize * 100);
  21167. }
  21168. emitChange();
  21169. };
  21170. return {
  21171. elFormItem: elFormItem2,
  21172. slider,
  21173. firstButton,
  21174. secondButton,
  21175. sliderDisabled,
  21176. minValue,
  21177. maxValue,
  21178. runwayStyle,
  21179. barStyle,
  21180. resetSize,
  21181. setPosition,
  21182. emitChange,
  21183. onSliderClick,
  21184. setFirstValue,
  21185. setSecondValue
  21186. };
  21187. };
  21188. const useStops = (props, initData, minValue, maxValue) => {
  21189. const stops = computed(() => {
  21190. if (!props.showStops || props.min > props.max)
  21191. return [];
  21192. if (props.step === 0) {
  21193. return [];
  21194. }
  21195. const stopCount = (props.max - props.min) / props.step;
  21196. const stepWidth = 100 * props.step / (props.max - props.min);
  21197. const result = Array.from({ length: stopCount - 1 }).map((_2, index) => (index + 1) * stepWidth);
  21198. if (props.range) {
  21199. return result.filter((step) => {
  21200. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  21201. });
  21202. } else {
  21203. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  21204. }
  21205. });
  21206. const getStopStyle = (position) => {
  21207. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  21208. };
  21209. return {
  21210. stops,
  21211. getStopStyle
  21212. };
  21213. };
  21214. const _sfc_main$h = defineComponent({
  21215. name: "ElSlider",
  21216. components: {
  21217. ElInputNumber,
  21218. SliderButton,
  21219. SliderMarker
  21220. },
  21221. props: {
  21222. modelValue: {
  21223. type: [Number, Array],
  21224. default: 0
  21225. },
  21226. min: {
  21227. type: Number,
  21228. default: 0
  21229. },
  21230. max: {
  21231. type: Number,
  21232. default: 100
  21233. },
  21234. step: {
  21235. type: Number,
  21236. default: 1
  21237. },
  21238. showInput: {
  21239. type: Boolean,
  21240. default: false
  21241. },
  21242. showInputControls: {
  21243. type: Boolean,
  21244. default: true
  21245. },
  21246. size: {
  21247. type: String,
  21248. validator: isValidComponentSize
  21249. },
  21250. inputSize: {
  21251. type: String,
  21252. validator: isValidComponentSize
  21253. },
  21254. showStops: {
  21255. type: Boolean,
  21256. default: false
  21257. },
  21258. showTooltip: {
  21259. type: Boolean,
  21260. default: true
  21261. },
  21262. formatTooltip: {
  21263. type: Function,
  21264. default: void 0
  21265. },
  21266. disabled: {
  21267. type: Boolean,
  21268. default: false
  21269. },
  21270. range: {
  21271. type: Boolean,
  21272. default: false
  21273. },
  21274. vertical: {
  21275. type: Boolean,
  21276. default: false
  21277. },
  21278. height: {
  21279. type: String,
  21280. default: ""
  21281. },
  21282. debounce: {
  21283. type: Number,
  21284. default: 300
  21285. },
  21286. label: {
  21287. type: String,
  21288. default: void 0
  21289. },
  21290. tooltipClass: {
  21291. type: String,
  21292. default: void 0
  21293. },
  21294. marks: Object
  21295. },
  21296. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT],
  21297. setup(props, { emit }) {
  21298. const ns = useNamespace("slider");
  21299. const initData = reactive({
  21300. firstValue: 0,
  21301. secondValue: 0,
  21302. oldValue: 0,
  21303. dragging: false,
  21304. sliderSize: 1
  21305. });
  21306. const {
  21307. elFormItem: elFormItem2,
  21308. slider,
  21309. firstButton,
  21310. secondButton,
  21311. sliderDisabled,
  21312. minValue,
  21313. maxValue,
  21314. runwayStyle,
  21315. barStyle,
  21316. resetSize,
  21317. emitChange,
  21318. onSliderClick,
  21319. setFirstValue,
  21320. setSecondValue
  21321. } = useSlide(props, initData, emit);
  21322. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  21323. const sliderWrapperSize = useSize();
  21324. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  21325. const sliderKls = computed(() => [
  21326. ns.b(),
  21327. ns.m(sliderWrapperSize.value),
  21328. ns.is("vertical", props.vertical),
  21329. { [ns.m("with-input")]: props.showInput }
  21330. ]);
  21331. const markList = useMarks(props);
  21332. useWatch(props, initData, minValue, maxValue, emit, elFormItem2);
  21333. const precision = computed(() => {
  21334. const precisions = [props.min, props.max, props.step].map((item) => {
  21335. const decimal = `${item}`.split(".")[1];
  21336. return decimal ? decimal.length : 0;
  21337. });
  21338. return Math.max.apply(null, precisions);
  21339. });
  21340. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  21341. const { firstValue, secondValue, oldValue, dragging, sliderSize } = toRefs(initData);
  21342. const updateDragging = (val) => {
  21343. initData.dragging = val;
  21344. };
  21345. provide("SliderProvider", __spreadProps(__spreadValues({}, toRefs(props)), {
  21346. sliderSize,
  21347. disabled: sliderDisabled,
  21348. precision,
  21349. emitChange,
  21350. resetSize,
  21351. updateDragging
  21352. }));
  21353. return {
  21354. ns,
  21355. firstValue,
  21356. secondValue,
  21357. oldValue,
  21358. dragging,
  21359. sliderSize,
  21360. slider,
  21361. firstButton,
  21362. secondButton,
  21363. sliderDisabled,
  21364. runwayStyle,
  21365. barStyle,
  21366. emitChange,
  21367. onSliderClick,
  21368. getStopStyle,
  21369. setFirstValue,
  21370. setSecondValue,
  21371. stops,
  21372. markList,
  21373. sliderWrapper,
  21374. sliderWrapperSize,
  21375. sliderInputSize,
  21376. sliderKls
  21377. };
  21378. }
  21379. });
  21380. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem2) => {
  21381. const _emit = (val) => {
  21382. emit(UPDATE_MODEL_EVENT, val);
  21383. emit(INPUT_EVENT, val);
  21384. };
  21385. const valueChanged = () => {
  21386. if (props.range) {
  21387. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  21388. } else {
  21389. return props.modelValue !== initData.oldValue;
  21390. }
  21391. };
  21392. const setValues = () => {
  21393. var _a2, _b2;
  21394. if (props.min > props.max) {
  21395. throwError("Slider", "min should not be greater than max.");
  21396. return;
  21397. }
  21398. const val = props.modelValue;
  21399. if (props.range && Array.isArray(val)) {
  21400. if (val[1] < props.min) {
  21401. _emit([props.min, props.min]);
  21402. } else if (val[0] > props.max) {
  21403. _emit([props.max, props.max]);
  21404. } else if (val[0] < props.min) {
  21405. _emit([props.min, val[1]]);
  21406. } else if (val[1] > props.max) {
  21407. _emit([val[0], props.max]);
  21408. } else {
  21409. initData.firstValue = val[0];
  21410. initData.secondValue = val[1];
  21411. if (valueChanged()) {
  21412. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  21413. initData.oldValue = val.slice();
  21414. }
  21415. }
  21416. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  21417. if (val < props.min) {
  21418. _emit(props.min);
  21419. } else if (val > props.max) {
  21420. _emit(props.max);
  21421. } else {
  21422. initData.firstValue = val;
  21423. if (valueChanged()) {
  21424. (_b2 = elFormItem2.validate) == null ? void 0 : _b2.call(elFormItem2, "change").catch((err) => debugWarn());
  21425. initData.oldValue = val;
  21426. }
  21427. }
  21428. }
  21429. };
  21430. setValues();
  21431. watch(() => initData.dragging, (val) => {
  21432. if (!val) {
  21433. setValues();
  21434. }
  21435. });
  21436. watch(() => props.modelValue, (val, oldVal) => {
  21437. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  21438. return;
  21439. }
  21440. setValues();
  21441. }, {
  21442. deep: true
  21443. });
  21444. watch(() => [props.min, props.max], () => {
  21445. setValues();
  21446. });
  21447. };
  21448. const useLifecycle = (props, initData, resetSize) => {
  21449. const sliderWrapper = ref(null);
  21450. onMounted(async () => {
  21451. let valuetext;
  21452. if (props.range) {
  21453. if (Array.isArray(props.modelValue)) {
  21454. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  21455. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  21456. } else {
  21457. initData.firstValue = props.min;
  21458. initData.secondValue = props.max;
  21459. }
  21460. initData.oldValue = [initData.firstValue, initData.secondValue];
  21461. valuetext = `${initData.firstValue}-${initData.secondValue}`;
  21462. } else {
  21463. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  21464. initData.firstValue = props.min;
  21465. } else {
  21466. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  21467. }
  21468. initData.oldValue = initData.firstValue;
  21469. valuetext = initData.firstValue;
  21470. }
  21471. sliderWrapper.value.setAttribute("aria-valuetext", valuetext);
  21472. sliderWrapper.value.setAttribute("aria-label", props.label ? props.label : `slider between ${props.min} and ${props.max}`);
  21473. on(window, "resize", resetSize);
  21474. await nextTick();
  21475. resetSize();
  21476. });
  21477. onBeforeUnmount(() => {
  21478. off(window, "resize", resetSize);
  21479. });
  21480. return {
  21481. sliderWrapper
  21482. };
  21483. };
  21484. const _hoisted_1$d = ["aria-valuemin", "aria-valuemax", "aria-orientation", "aria-disabled"];
  21485. const _hoisted_2$b = { key: 1 };
  21486. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  21487. const _component_slider_button = resolveComponent("slider-button");
  21488. const _component_slider_marker = resolveComponent("slider-marker");
  21489. const _component_el_input_number = resolveComponent("el-input-number");
  21490. return openBlock(), createElementBlock("div", {
  21491. ref: "sliderWrapper",
  21492. class: normalizeClass(_ctx.sliderKls),
  21493. role: "slider",
  21494. "aria-valuemin": _ctx.min,
  21495. "aria-valuemax": _ctx.max,
  21496. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  21497. "aria-disabled": _ctx.sliderDisabled
  21498. }, [
  21499. createElementVNode("div", {
  21500. ref: "slider",
  21501. class: normalizeClass([
  21502. _ctx.ns.e("runway"),
  21503. { "show-input": _ctx.showInput && !_ctx.range },
  21504. _ctx.ns.is("disabled", _ctx.sliderDisabled)
  21505. ]),
  21506. style: normalizeStyle(_ctx.runwayStyle),
  21507. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onSliderClick && _ctx.onSliderClick(...args))
  21508. }, [
  21509. createElementVNode("div", {
  21510. class: normalizeClass(_ctx.ns.e("bar")),
  21511. style: normalizeStyle(_ctx.barStyle)
  21512. }, null, 6),
  21513. createVNode(_component_slider_button, {
  21514. ref: "firstButton",
  21515. "model-value": _ctx.firstValue,
  21516. vertical: _ctx.vertical,
  21517. "tooltip-class": _ctx.tooltipClass,
  21518. "onUpdate:modelValue": _ctx.setFirstValue
  21519. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"]),
  21520. _ctx.range ? (openBlock(), createBlock(_component_slider_button, {
  21521. key: 0,
  21522. ref: "secondButton",
  21523. "model-value": _ctx.secondValue,
  21524. vertical: _ctx.vertical,
  21525. "tooltip-class": _ctx.tooltipClass,
  21526. "onUpdate:modelValue": _ctx.setSecondValue
  21527. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
  21528. _ctx.showStops ? (openBlock(), createElementBlock("div", _hoisted_2$b, [
  21529. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.stops, (item, key) => {
  21530. return openBlock(), createElementBlock("div", {
  21531. key,
  21532. class: normalizeClass(_ctx.ns.e("stop")),
  21533. style: normalizeStyle(_ctx.getStopStyle(item))
  21534. }, null, 6);
  21535. }), 128))
  21536. ])) : createCommentVNode("v-if", true),
  21537. _ctx.markList.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  21538. createElementVNode("div", null, [
  21539. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  21540. return openBlock(), createElementBlock("div", {
  21541. key,
  21542. style: normalizeStyle(_ctx.getStopStyle(item.position)),
  21543. class: normalizeClass([_ctx.ns.e("stop"), _ctx.ns.e("marks-stop")])
  21544. }, null, 6);
  21545. }), 128))
  21546. ]),
  21547. createElementVNode("div", {
  21548. class: normalizeClass(_ctx.ns.e("marks"))
  21549. }, [
  21550. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  21551. return openBlock(), createBlock(_component_slider_marker, {
  21552. key,
  21553. mark: item.mark,
  21554. style: normalizeStyle(_ctx.getStopStyle(item.position))
  21555. }, null, 8, ["mark", "style"]);
  21556. }), 128))
  21557. ], 2)
  21558. ], 64)) : createCommentVNode("v-if", true)
  21559. ], 6),
  21560. _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(_component_el_input_number, {
  21561. key: 0,
  21562. ref: "input",
  21563. "model-value": _ctx.firstValue,
  21564. class: normalizeClass(_ctx.ns.e("input")),
  21565. step: _ctx.step,
  21566. disabled: _ctx.sliderDisabled,
  21567. controls: _ctx.showInputControls,
  21568. min: _ctx.min,
  21569. max: _ctx.max,
  21570. debounce: _ctx.debounce,
  21571. size: _ctx.sliderInputSize,
  21572. "onUpdate:modelValue": _ctx.setFirstValue,
  21573. onChange: _ctx.emitChange
  21574. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
  21575. ], 10, _hoisted_1$d);
  21576. }
  21577. 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"]]);
  21578. Slider.install = (app) => {
  21579. app.component(Slider.name, Slider);
  21580. };
  21581. const _Slider = Slider;
  21582. const ElSlider = _Slider;
  21583. const spaceItem = buildProps({
  21584. prefixCls: {
  21585. type: String,
  21586. default: ""
  21587. }
  21588. });
  21589. const _sfc_main$g = defineComponent({
  21590. props: spaceItem,
  21591. setup(props) {
  21592. const ns = useNamespace("space");
  21593. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  21594. return {
  21595. classes
  21596. };
  21597. }
  21598. });
  21599. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  21600. return openBlock(), createElementBlock("div", {
  21601. class: normalizeClass(_ctx.classes)
  21602. }, [
  21603. renderSlot(_ctx.$slots, "default")
  21604. ], 2);
  21605. }
  21606. 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"]]);
  21607. const SIZE_MAP = {
  21608. small: 8,
  21609. default: 12,
  21610. large: 16
  21611. };
  21612. function useSpace(props) {
  21613. const ns = useNamespace("space");
  21614. const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
  21615. const horizontalSize = ref(0);
  21616. const verticalSize = ref(0);
  21617. const containerStyle = computed(() => {
  21618. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
  21619. const alignment = {
  21620. alignItems: props.alignment
  21621. };
  21622. return [wrapKls, alignment, props.style];
  21623. });
  21624. const itemStyle = computed(() => {
  21625. const itemBaseStyle = {
  21626. paddingBottom: `${verticalSize.value}px`,
  21627. marginRight: `${horizontalSize.value}px`
  21628. };
  21629. const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  21630. return [itemBaseStyle, fillStyle];
  21631. });
  21632. watchEffect(() => {
  21633. const { size = "small", wrap, direction: dir, fill } = props;
  21634. if (Array.isArray(size)) {
  21635. const [h2 = 0, v2 = 0] = size;
  21636. horizontalSize.value = h2;
  21637. verticalSize.value = v2;
  21638. } else {
  21639. let val;
  21640. if (isNumber(size)) {
  21641. val = size;
  21642. } else {
  21643. val = SIZE_MAP[size] || SIZE_MAP.small;
  21644. }
  21645. if ((wrap || fill) && dir === "horizontal") {
  21646. horizontalSize.value = verticalSize.value = val;
  21647. } else {
  21648. if (dir === "horizontal") {
  21649. horizontalSize.value = val;
  21650. verticalSize.value = 0;
  21651. } else {
  21652. verticalSize.value = val;
  21653. horizontalSize.value = 0;
  21654. }
  21655. }
  21656. }
  21657. });
  21658. return {
  21659. classes,
  21660. containerStyle,
  21661. itemStyle
  21662. };
  21663. }
  21664. const spaceProps = buildProps({
  21665. direction: {
  21666. type: String,
  21667. values: ["horizontal", "vertical"],
  21668. default: "horizontal"
  21669. },
  21670. class: {
  21671. type: definePropType([
  21672. String,
  21673. Object,
  21674. Array
  21675. ]),
  21676. default: ""
  21677. },
  21678. style: {
  21679. type: definePropType([String, Array, Object]),
  21680. default: ""
  21681. },
  21682. alignment: {
  21683. type: definePropType(String),
  21684. default: "center"
  21685. },
  21686. prefixCls: {
  21687. type: String
  21688. },
  21689. spacer: {
  21690. type: definePropType([Object, String, Number, Array]),
  21691. default: null,
  21692. validator: (val) => isVNode(val) || isNumber(val) || isString(val)
  21693. },
  21694. wrap: {
  21695. type: Boolean,
  21696. default: false
  21697. },
  21698. fill: {
  21699. type: Boolean,
  21700. default: false
  21701. },
  21702. fillRatio: {
  21703. type: Number,
  21704. default: 100
  21705. },
  21706. size: {
  21707. type: [String, Array, Number],
  21708. values: componentSizes,
  21709. validator: (val) => {
  21710. return isNumber(val) || isArray(val) && val.length === 2 && val.every((i) => isNumber(i));
  21711. }
  21712. }
  21713. });
  21714. var Space = defineComponent({
  21715. name: "ElSpace",
  21716. props: spaceProps,
  21717. setup(props, { slots }) {
  21718. const { classes, containerStyle, itemStyle } = useSpace(props);
  21719. return () => {
  21720. var _a2;
  21721. const { spacer, prefixCls, direction } = props;
  21722. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  21723. if (((_a2 = children.children) != null ? _a2 : []).length === 0)
  21724. return null;
  21725. if (isArray(children.children)) {
  21726. let extractedChildren = [];
  21727. children.children.forEach((child, loopKey) => {
  21728. if (isFragment(child)) {
  21729. if (isArray(child.children)) {
  21730. child.children.forEach((nested, key) => {
  21731. extractedChildren.push(createVNode(Item, {
  21732. style: itemStyle.value,
  21733. prefixCls,
  21734. key: `nested-${key}`
  21735. }, {
  21736. default: () => [nested]
  21737. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  21738. });
  21739. }
  21740. } else if (isValidElementNode(child)) {
  21741. extractedChildren.push(createVNode(Item, {
  21742. style: itemStyle.value,
  21743. prefixCls,
  21744. key: `LoopKey${loopKey}`
  21745. }, {
  21746. default: () => [child]
  21747. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  21748. }
  21749. });
  21750. if (spacer) {
  21751. const len = extractedChildren.length - 1;
  21752. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  21753. const children2 = [...acc, child];
  21754. if (idx !== len) {
  21755. children2.push(createVNode("span", {
  21756. style: [
  21757. itemStyle.value,
  21758. direction === "vertical" ? "width: 100%" : null
  21759. ],
  21760. key: idx
  21761. }, [
  21762. isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
  21763. ], PatchFlags.STYLE));
  21764. }
  21765. return children2;
  21766. }, []);
  21767. }
  21768. return createVNode("div", {
  21769. class: classes.value,
  21770. style: containerStyle.value
  21771. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  21772. }
  21773. return children.children;
  21774. };
  21775. }
  21776. });
  21777. const ElSpace = withInstall(Space);
  21778. const switchProps = buildProps({
  21779. modelValue: {
  21780. type: [Boolean, String, Number],
  21781. default: false
  21782. },
  21783. value: {
  21784. type: [Boolean, String, Number],
  21785. default: false
  21786. },
  21787. disabled: {
  21788. type: Boolean,
  21789. default: false
  21790. },
  21791. width: {
  21792. type: Number,
  21793. default: 40
  21794. },
  21795. inlinePrompt: {
  21796. type: Boolean,
  21797. default: false
  21798. },
  21799. activeIcon: {
  21800. type: iconPropType,
  21801. default: ""
  21802. },
  21803. inactiveIcon: {
  21804. type: iconPropType,
  21805. default: ""
  21806. },
  21807. activeText: {
  21808. type: String,
  21809. default: ""
  21810. },
  21811. inactiveText: {
  21812. type: String,
  21813. default: ""
  21814. },
  21815. activeColor: {
  21816. type: String,
  21817. default: ""
  21818. },
  21819. inactiveColor: {
  21820. type: String,
  21821. default: ""
  21822. },
  21823. borderColor: {
  21824. type: String,
  21825. default: ""
  21826. },
  21827. activeValue: {
  21828. type: [Boolean, String, Number],
  21829. default: true
  21830. },
  21831. inactiveValue: {
  21832. type: [Boolean, String, Number],
  21833. default: false
  21834. },
  21835. name: {
  21836. type: String,
  21837. default: ""
  21838. },
  21839. validateEvent: {
  21840. type: Boolean,
  21841. default: true
  21842. },
  21843. id: String,
  21844. loading: {
  21845. type: Boolean,
  21846. default: false
  21847. },
  21848. beforeChange: {
  21849. type: definePropType(Function)
  21850. },
  21851. size: {
  21852. type: String,
  21853. validator: isValidComponentSize
  21854. }
  21855. });
  21856. const switchEmits = {
  21857. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  21858. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  21859. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  21860. };
  21861. const COMPONENT_NAME = "ElSwitch";
  21862. const _sfc_main$f = defineComponent({
  21863. name: COMPONENT_NAME,
  21864. components: { ElIcon, Loading: loading },
  21865. props: switchProps,
  21866. emits: switchEmits,
  21867. setup(props, { emit }) {
  21868. const { formItem } = useFormItem();
  21869. const switchDisabled = useDisabled$1(computed(() => props.loading));
  21870. const ns = useNamespace("switch");
  21871. const switchSize = useSize();
  21872. const isModelValue = ref(props.modelValue !== false);
  21873. const input = ref();
  21874. const core = ref();
  21875. const switchKls = computed(() => [
  21876. ns.b(),
  21877. ns.m(switchSize.value),
  21878. ns.is("disabled", switchDisabled.value),
  21879. ns.is("checked", checked.value)
  21880. ]);
  21881. watch(() => props.modelValue, () => {
  21882. isModelValue.value = true;
  21883. });
  21884. watch(() => props.value, () => {
  21885. isModelValue.value = false;
  21886. });
  21887. const actualValue = computed(() => {
  21888. return isModelValue.value ? props.modelValue : props.value;
  21889. });
  21890. const checked = computed(() => actualValue.value === props.activeValue);
  21891. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  21892. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  21893. emit(CHANGE_EVENT, props.inactiveValue);
  21894. emit(INPUT_EVENT, props.inactiveValue);
  21895. }
  21896. watch(checked, () => {
  21897. var _a2;
  21898. input.value.checked = checked.value;
  21899. if (props.activeColor || props.inactiveColor) {
  21900. setBackgroundColor();
  21901. }
  21902. if (props.validateEvent) {
  21903. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  21904. }
  21905. });
  21906. const handleChange2 = () => {
  21907. const val = checked.value ? props.inactiveValue : props.activeValue;
  21908. emit(UPDATE_MODEL_EVENT, val);
  21909. emit(CHANGE_EVENT, val);
  21910. emit(INPUT_EVENT, val);
  21911. nextTick(() => {
  21912. input.value.checked = checked.value;
  21913. });
  21914. };
  21915. const switchValue = () => {
  21916. if (switchDisabled.value)
  21917. return;
  21918. const { beforeChange } = props;
  21919. if (!beforeChange) {
  21920. handleChange2();
  21921. return;
  21922. }
  21923. const shouldChange = beforeChange();
  21924. const isExpectType = [
  21925. isPromise(shouldChange),
  21926. isBoolean(shouldChange)
  21927. ].some((i) => i);
  21928. if (!isExpectType) {
  21929. throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
  21930. }
  21931. if (isPromise(shouldChange)) {
  21932. shouldChange.then((result) => {
  21933. if (result) {
  21934. handleChange2();
  21935. }
  21936. }).catch((e) => {
  21937. });
  21938. } else if (shouldChange) {
  21939. handleChange2();
  21940. }
  21941. };
  21942. const setBackgroundColor = () => {
  21943. const newColor = checked.value ? props.activeColor : props.inactiveColor;
  21944. const coreEl = core.value;
  21945. if (props.borderColor)
  21946. coreEl.style.borderColor = props.borderColor;
  21947. else if (!props.borderColor)
  21948. coreEl.style.borderColor = newColor;
  21949. coreEl.style.backgroundColor = newColor;
  21950. coreEl.children[0].style.color = newColor;
  21951. };
  21952. const focus = () => {
  21953. var _a2, _b2;
  21954. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  21955. };
  21956. onMounted(() => {
  21957. if (props.activeColor || props.inactiveColor || props.borderColor) {
  21958. setBackgroundColor();
  21959. }
  21960. input.value.checked = checked.value;
  21961. });
  21962. return {
  21963. ns,
  21964. input,
  21965. core,
  21966. switchDisabled,
  21967. checked,
  21968. switchKls,
  21969. handleChange: handleChange2,
  21970. switchValue,
  21971. focus
  21972. };
  21973. }
  21974. });
  21975. const _hoisted_1$c = ["aria-checked", "aria-disabled"];
  21976. const _hoisted_2$a = ["id", "name", "true-value", "false-value", "disabled"];
  21977. const _hoisted_3$7 = ["aria-hidden"];
  21978. const _hoisted_4$6 = ["aria-hidden"];
  21979. const _hoisted_5$6 = ["aria-hidden"];
  21980. const _hoisted_6$5 = ["aria-hidden"];
  21981. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  21982. const _component_el_icon = resolveComponent("el-icon");
  21983. const _component_loading = resolveComponent("loading");
  21984. return openBlock(), createElementBlock("div", {
  21985. class: normalizeClass(_ctx.switchKls),
  21986. role: "switch",
  21987. "aria-checked": _ctx.checked,
  21988. "aria-disabled": _ctx.switchDisabled,
  21989. onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["prevent"]))
  21990. }, [
  21991. createElementVNode("input", {
  21992. id: _ctx.id,
  21993. ref: "input",
  21994. class: normalizeClass(_ctx.ns.e("input")),
  21995. type: "checkbox",
  21996. name: _ctx.name,
  21997. "true-value": _ctx.activeValue,
  21998. "false-value": _ctx.inactiveValue,
  21999. disabled: _ctx.switchDisabled,
  22000. onChange: _cache[0] || (_cache[0] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  22001. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["enter"]))
  22002. }, null, 42, _hoisted_2$a),
  22003. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  22004. key: 0,
  22005. class: normalizeClass([
  22006. _ctx.ns.e("label"),
  22007. _ctx.ns.em("label", "left"),
  22008. _ctx.ns.is("active", !_ctx.checked)
  22009. ])
  22010. }, [
  22011. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  22012. default: withCtx(() => [
  22013. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  22014. ]),
  22015. _: 1
  22016. })) : createCommentVNode("v-if", true),
  22017. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  22018. key: 1,
  22019. "aria-hidden": _ctx.checked
  22020. }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$7)) : createCommentVNode("v-if", true)
  22021. ], 2)) : createCommentVNode("v-if", true),
  22022. createElementVNode("span", {
  22023. ref: "core",
  22024. class: normalizeClass(_ctx.ns.e("core")),
  22025. style: normalizeStyle({ width: (_ctx.width || 40) + "px" })
  22026. }, [
  22027. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  22028. key: 0,
  22029. class: normalizeClass(_ctx.ns.e("inner"))
  22030. }, [
  22031. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  22032. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, {
  22033. key: 0,
  22034. class: normalizeClass([_ctx.ns.is("icon"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  22035. }, {
  22036. default: withCtx(() => [
  22037. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  22038. ]),
  22039. _: 1
  22040. }, 8, ["class"])) : createCommentVNode("v-if", true),
  22041. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, {
  22042. key: 1,
  22043. class: normalizeClass([_ctx.ns.is("icon"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  22044. }, {
  22045. default: withCtx(() => [
  22046. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  22047. ]),
  22048. _: 1
  22049. }, 8, ["class"])) : createCommentVNode("v-if", true)
  22050. ], 64)) : _ctx.activeText || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  22051. _ctx.activeText ? (openBlock(), createElementBlock("span", {
  22052. key: 0,
  22053. class: normalizeClass([_ctx.ns.is("text"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  22054. "aria-hidden": !_ctx.checked
  22055. }, toDisplayString(_ctx.activeText.substring(0, 3)), 11, _hoisted_4$6)) : createCommentVNode("v-if", true),
  22056. _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  22057. key: 1,
  22058. class: normalizeClass([_ctx.ns.is("text"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  22059. "aria-hidden": _ctx.checked
  22060. }, toDisplayString(_ctx.inactiveText.substring(0, 3)), 11, _hoisted_5$6)) : createCommentVNode("v-if", true)
  22061. ], 64)) : createCommentVNode("v-if", true)
  22062. ], 2)) : createCommentVNode("v-if", true),
  22063. createElementVNode("div", {
  22064. class: normalizeClass(_ctx.ns.e("action"))
  22065. }, [
  22066. _ctx.loading ? (openBlock(), createBlock(_component_el_icon, {
  22067. key: 0,
  22068. class: normalizeClass(_ctx.ns.is("loading"))
  22069. }, {
  22070. default: withCtx(() => [
  22071. createVNode(_component_loading)
  22072. ]),
  22073. _: 1
  22074. }, 8, ["class"])) : createCommentVNode("v-if", true)
  22075. ], 2)
  22076. ], 6),
  22077. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  22078. key: 1,
  22079. class: normalizeClass([
  22080. _ctx.ns.e("label"),
  22081. _ctx.ns.em("label", "right"),
  22082. _ctx.ns.is("active", _ctx.checked)
  22083. ])
  22084. }, [
  22085. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  22086. default: withCtx(() => [
  22087. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  22088. ]),
  22089. _: 1
  22090. })) : createCommentVNode("v-if", true),
  22091. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  22092. key: 1,
  22093. "aria-hidden": !_ctx.checked
  22094. }, toDisplayString(_ctx.activeText), 9, _hoisted_6$5)) : createCommentVNode("v-if", true)
  22095. ], 2)) : createCommentVNode("v-if", true)
  22096. ], 10, _hoisted_1$c);
  22097. }
  22098. 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"]]);
  22099. const ElSwitch = withInstall(Switch);
  22100. /*!
  22101. * escape-html
  22102. * Copyright(c) 2012-2013 TJ Holowaychuk
  22103. * Copyright(c) 2015 Andreas Lubbe
  22104. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  22105. * MIT Licensed
  22106. */
  22107. var matchHtmlRegExp = /["'&<>]/;
  22108. var escapeHtml_1 = escapeHtml;
  22109. function escapeHtml(string3) {
  22110. var str = "" + string3;
  22111. var match = matchHtmlRegExp.exec(str);
  22112. if (!match) {
  22113. return str;
  22114. }
  22115. var escape;
  22116. var html = "";
  22117. var index = 0;
  22118. var lastIndex = 0;
  22119. for (index = match.index; index < str.length; index++) {
  22120. switch (str.charCodeAt(index)) {
  22121. case 34:
  22122. escape = "&quot;";
  22123. break;
  22124. case 38:
  22125. escape = "&amp;";
  22126. break;
  22127. case 39:
  22128. escape = "&#39;";
  22129. break;
  22130. case 60:
  22131. escape = "&lt;";
  22132. break;
  22133. case 62:
  22134. escape = "&gt;";
  22135. break;
  22136. default:
  22137. continue;
  22138. }
  22139. if (lastIndex !== index) {
  22140. html += str.substring(lastIndex, index);
  22141. }
  22142. lastIndex = index + 1;
  22143. html += escape;
  22144. }
  22145. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  22146. }
  22147. const getCell = function(event) {
  22148. let cell = event.target;
  22149. while (cell && cell.tagName.toUpperCase() !== "HTML") {
  22150. if (cell.tagName.toUpperCase() === "TD") {
  22151. return cell;
  22152. }
  22153. cell = cell.parentNode;
  22154. }
  22155. return null;
  22156. };
  22157. const isObject = function(obj) {
  22158. return obj !== null && typeof obj === "object";
  22159. };
  22160. const orderBy = function(array4, sortKey, reverse, sortMethod, sortBy) {
  22161. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  22162. return array4;
  22163. }
  22164. if (typeof reverse === "string") {
  22165. reverse = reverse === "descending" ? -1 : 1;
  22166. } else {
  22167. reverse = reverse && reverse < 0 ? -1 : 1;
  22168. }
  22169. const getKey = sortMethod ? null : function(value, index) {
  22170. if (sortBy) {
  22171. if (!Array.isArray(sortBy)) {
  22172. sortBy = [sortBy];
  22173. }
  22174. return sortBy.map((by) => {
  22175. if (typeof by === "string") {
  22176. return get(value, by);
  22177. } else {
  22178. return by(value, index, array4);
  22179. }
  22180. });
  22181. }
  22182. if (sortKey !== "$key") {
  22183. if (isObject(value) && "$value" in value)
  22184. value = value.$value;
  22185. }
  22186. return [isObject(value) ? get(value, sortKey) : value];
  22187. };
  22188. const compare = function(a2, b2) {
  22189. if (sortMethod) {
  22190. return sortMethod(a2.value, b2.value);
  22191. }
  22192. for (let i = 0, len = a2.key.length; i < len; i++) {
  22193. if (a2.key[i] < b2.key[i]) {
  22194. return -1;
  22195. }
  22196. if (a2.key[i] > b2.key[i]) {
  22197. return 1;
  22198. }
  22199. }
  22200. return 0;
  22201. };
  22202. return array4.map((value, index) => {
  22203. return {
  22204. value,
  22205. index,
  22206. key: getKey ? getKey(value, index) : null
  22207. };
  22208. }).sort((a2, b2) => {
  22209. let order2 = compare(a2, b2);
  22210. if (!order2) {
  22211. order2 = a2.index - b2.index;
  22212. }
  22213. return order2 * +reverse;
  22214. }).map((item) => item.value);
  22215. };
  22216. const getColumnById = function(table, columnId) {
  22217. let column = null;
  22218. table.columns.forEach((item) => {
  22219. if (item.id === columnId) {
  22220. column = item;
  22221. }
  22222. });
  22223. return column;
  22224. };
  22225. const getColumnByKey = function(table, columnKey) {
  22226. let column = null;
  22227. for (let i = 0; i < table.columns.length; i++) {
  22228. const item = table.columns[i];
  22229. if (item.columnKey === columnKey) {
  22230. column = item;
  22231. break;
  22232. }
  22233. }
  22234. return column;
  22235. };
  22236. const getColumnByCell = function(table, cell, namespace) {
  22237. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  22238. if (matches) {
  22239. return getColumnById(table, matches[0]);
  22240. }
  22241. return null;
  22242. };
  22243. const getRowIdentity = (row, rowKey) => {
  22244. if (!row)
  22245. throw new Error("Row is required when get row identity");
  22246. if (typeof rowKey === "string") {
  22247. if (!rowKey.includes(".")) {
  22248. return `${row[rowKey]}`;
  22249. }
  22250. const key = rowKey.split(".");
  22251. let current = row;
  22252. for (const element of key) {
  22253. current = current[element];
  22254. }
  22255. return `${current}`;
  22256. } else if (typeof rowKey === "function") {
  22257. return rowKey.call(null, row);
  22258. }
  22259. };
  22260. const getKeysMap = function(array4, rowKey) {
  22261. const arrayMap2 = {};
  22262. (array4 || []).forEach((row, index) => {
  22263. arrayMap2[getRowIdentity(row, rowKey)] = { row, index };
  22264. });
  22265. return arrayMap2;
  22266. };
  22267. function mergeOptions(defaults, config) {
  22268. const options = {};
  22269. let key;
  22270. for (key in defaults) {
  22271. options[key] = defaults[key];
  22272. }
  22273. for (key in config) {
  22274. if (hasOwn(config, key)) {
  22275. const value = config[key];
  22276. if (typeof value !== "undefined") {
  22277. options[key] = value;
  22278. }
  22279. }
  22280. }
  22281. return options;
  22282. }
  22283. function parseWidth(width) {
  22284. if (width === "")
  22285. return width;
  22286. if (width !== void 0) {
  22287. width = Number.parseInt(width, 10);
  22288. if (Number.isNaN(width)) {
  22289. width = "";
  22290. }
  22291. }
  22292. return width;
  22293. }
  22294. function parseMinWidth(minWidth) {
  22295. if (minWidth === "")
  22296. return minWidth;
  22297. if (minWidth !== void 0) {
  22298. minWidth = parseWidth(minWidth);
  22299. if (Number.isNaN(minWidth)) {
  22300. minWidth = 80;
  22301. }
  22302. }
  22303. return minWidth;
  22304. }
  22305. function parseHeight(height) {
  22306. if (typeof height === "number") {
  22307. return height;
  22308. }
  22309. if (typeof height === "string") {
  22310. if (/^\d+(?:px)?$/.test(height)) {
  22311. return Number.parseInt(height, 10);
  22312. } else {
  22313. return height;
  22314. }
  22315. }
  22316. return null;
  22317. }
  22318. function compose(...funcs) {
  22319. if (funcs.length === 0) {
  22320. return (arg) => arg;
  22321. }
  22322. if (funcs.length === 1) {
  22323. return funcs[0];
  22324. }
  22325. return funcs.reduce((a2, b2) => (...args) => a2(b2(...args)));
  22326. }
  22327. function toggleRowStatus(statusArr, row, newVal) {
  22328. let changed = false;
  22329. const index = statusArr.indexOf(row);
  22330. const included = index !== -1;
  22331. const addRow = () => {
  22332. statusArr.push(row);
  22333. changed = true;
  22334. };
  22335. const removeRow = () => {
  22336. statusArr.splice(index, 1);
  22337. changed = true;
  22338. };
  22339. if (typeof newVal === "boolean") {
  22340. if (newVal && !included) {
  22341. addRow();
  22342. } else if (!newVal && included) {
  22343. removeRow();
  22344. }
  22345. } else {
  22346. if (included) {
  22347. removeRow();
  22348. } else {
  22349. addRow();
  22350. }
  22351. }
  22352. return changed;
  22353. }
  22354. function walkTreeNode(root2, cb, childrenKey = "children", lazyKey = "hasChildren") {
  22355. const isNil2 = (array4) => !(Array.isArray(array4) && array4.length);
  22356. function _walker(parent, children, level) {
  22357. cb(parent, children, level);
  22358. children.forEach((item) => {
  22359. if (item[lazyKey]) {
  22360. cb(item, null, level + 1);
  22361. return;
  22362. }
  22363. const children2 = item[childrenKey];
  22364. if (!isNil2(children2)) {
  22365. _walker(item, children2, level + 1);
  22366. }
  22367. });
  22368. }
  22369. root2.forEach((item) => {
  22370. if (item[lazyKey]) {
  22371. cb(item, null, 0);
  22372. return;
  22373. }
  22374. const children = item[childrenKey];
  22375. if (!isNil2(children)) {
  22376. _walker(item, children, 0);
  22377. }
  22378. });
  22379. }
  22380. let removePopper;
  22381. function createTablePopper(trigger, popperContent, popperOptions2, tooltipEffect) {
  22382. const { nextZIndex } = useZIndex();
  22383. function renderContent() {
  22384. const isLight = tooltipEffect === "light";
  22385. const content22 = document.createElement("div");
  22386. content22.className = `el-popper ${isLight ? "is-light" : "is-dark"}`;
  22387. popperContent = escapeHtml_1(popperContent);
  22388. content22.innerHTML = popperContent;
  22389. content22.style.zIndex = String(nextZIndex());
  22390. document.body.appendChild(content22);
  22391. return content22;
  22392. }
  22393. function renderArrow() {
  22394. const arrow22 = document.createElement("div");
  22395. arrow22.className = "el-popper__arrow";
  22396. return arrow22;
  22397. }
  22398. function showPopper() {
  22399. popperInstance && popperInstance.update();
  22400. }
  22401. removePopper = function removePopper2() {
  22402. try {
  22403. popperInstance && popperInstance.destroy();
  22404. content2 && document.body.removeChild(content2);
  22405. off(trigger, "mouseenter", showPopper);
  22406. off(trigger, "mouseleave", removePopper2);
  22407. } catch (e) {
  22408. }
  22409. };
  22410. let popperInstance = null;
  22411. const content2 = renderContent();
  22412. const arrow2 = renderArrow();
  22413. content2.appendChild(arrow2);
  22414. popperInstance = createPopper(trigger, content2, __spreadValues({
  22415. modifiers: [
  22416. {
  22417. name: "offset",
  22418. options: {
  22419. offset: [0, 8]
  22420. }
  22421. },
  22422. {
  22423. name: "arrow",
  22424. options: {
  22425. element: arrow2,
  22426. padding: 10
  22427. }
  22428. }
  22429. ]
  22430. }, popperOptions2));
  22431. on(trigger, "mouseenter", showPopper);
  22432. on(trigger, "mouseleave", removePopper);
  22433. return popperInstance;
  22434. }
  22435. const isFixedColumn = (index, fixed, store, realColumns) => {
  22436. let start2 = 0;
  22437. let after = index;
  22438. if (realColumns) {
  22439. if (realColumns[index].colSpan > 1) {
  22440. return {};
  22441. }
  22442. for (let i = 0; i < index; i++) {
  22443. start2 += realColumns[i].colSpan;
  22444. }
  22445. after = start2 + realColumns[index].colSpan - 1;
  22446. } else {
  22447. start2 = index;
  22448. }
  22449. let fixedLayout;
  22450. const columns = store.states.columns;
  22451. switch (fixed) {
  22452. case "left":
  22453. if (after < store.states.fixedLeafColumnsLength.value) {
  22454. fixedLayout = "left";
  22455. }
  22456. break;
  22457. case "right":
  22458. if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22459. fixedLayout = "right";
  22460. }
  22461. break;
  22462. default:
  22463. if (after < store.states.fixedLeafColumnsLength.value) {
  22464. fixedLayout = "left";
  22465. } else if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22466. fixedLayout = "right";
  22467. }
  22468. }
  22469. return fixedLayout ? {
  22470. direction: fixedLayout,
  22471. start: start2,
  22472. after
  22473. } : {};
  22474. };
  22475. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns) => {
  22476. const classes = [];
  22477. const { direction, start: start2 } = isFixedColumn(index, fixed, store, realColumns);
  22478. if (direction) {
  22479. const isLeft = direction === "left";
  22480. classes.push(`${namespace}-fixed-column--${direction}`);
  22481. if (isLeft && start2 === store.states.fixedLeafColumnsLength.value - 1) {
  22482. classes.push("is-last-column");
  22483. } else if (!isLeft && start2 === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  22484. classes.push("is-first-column");
  22485. }
  22486. }
  22487. return classes;
  22488. };
  22489. function getOffset(offset2, column) {
  22490. return offset2 + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  22491. }
  22492. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  22493. const { direction, start: start2 = 0 } = isFixedColumn(index, fixed, store, realColumns);
  22494. if (!direction) {
  22495. return;
  22496. }
  22497. const styles = {};
  22498. const isLeft = direction === "left";
  22499. const columns = store.states.columns.value;
  22500. if (isLeft) {
  22501. styles.left = columns.slice(0, index).reduce(getOffset, 0);
  22502. } else {
  22503. styles.right = columns.slice(start2 + 1).reverse().reduce(getOffset, 0);
  22504. }
  22505. return styles;
  22506. };
  22507. const ensurePosition = (style, key) => {
  22508. if (!style)
  22509. return;
  22510. if (!Number.isNaN(style[key])) {
  22511. style[key] = `${style[key]}px`;
  22512. }
  22513. };
  22514. function useExpand(watcherData) {
  22515. const instance = getCurrentInstance();
  22516. const defaultExpandAll = ref(false);
  22517. const expandRows = ref([]);
  22518. const updateExpandRows = () => {
  22519. const data2 = watcherData.data.value || [];
  22520. const rowKey = watcherData.rowKey.value;
  22521. if (defaultExpandAll.value) {
  22522. expandRows.value = data2.slice();
  22523. } else if (rowKey) {
  22524. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  22525. expandRows.value = data2.reduce((prev, row) => {
  22526. const rowId = getRowIdentity(row, rowKey);
  22527. const rowInfo = expandRowsMap[rowId];
  22528. if (rowInfo) {
  22529. prev.push(row);
  22530. }
  22531. return prev;
  22532. }, []);
  22533. } else {
  22534. expandRows.value = [];
  22535. }
  22536. };
  22537. const toggleRowExpansion = (row, expanded) => {
  22538. const changed = toggleRowStatus(expandRows.value, row, expanded);
  22539. if (changed) {
  22540. instance.emit("expand-change", row, expandRows.value.slice());
  22541. }
  22542. };
  22543. const setExpandRowKeys = (rowKeys) => {
  22544. instance.store.assertRowKey();
  22545. const data2 = watcherData.data.value || [];
  22546. const rowKey = watcherData.rowKey.value;
  22547. const keysMap = getKeysMap(data2, rowKey);
  22548. expandRows.value = rowKeys.reduce((prev, cur) => {
  22549. const info = keysMap[cur];
  22550. if (info) {
  22551. prev.push(info.row);
  22552. }
  22553. return prev;
  22554. }, []);
  22555. };
  22556. const isRowExpanded = (row) => {
  22557. const rowKey = watcherData.rowKey.value;
  22558. if (rowKey) {
  22559. const expandMap = getKeysMap(expandRows.value, rowKey);
  22560. return !!expandMap[getRowIdentity(row, rowKey)];
  22561. }
  22562. return expandRows.value.includes(row);
  22563. };
  22564. return {
  22565. updateExpandRows,
  22566. toggleRowExpansion,
  22567. setExpandRowKeys,
  22568. isRowExpanded,
  22569. states: {
  22570. expandRows,
  22571. defaultExpandAll
  22572. }
  22573. };
  22574. }
  22575. function useCurrent(watcherData) {
  22576. const instance = getCurrentInstance();
  22577. const _currentRowKey = ref(null);
  22578. const currentRow = ref(null);
  22579. const setCurrentRowKey = (key) => {
  22580. instance.store.assertRowKey();
  22581. _currentRowKey.value = key;
  22582. setCurrentRowByKey(key);
  22583. };
  22584. const restoreCurrentRowKey = () => {
  22585. _currentRowKey.value = null;
  22586. };
  22587. const setCurrentRowByKey = (key) => {
  22588. const { data: data2, rowKey } = watcherData;
  22589. let _currentRow = null;
  22590. if (rowKey.value) {
  22591. _currentRow = (unref(data2) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  22592. }
  22593. currentRow.value = _currentRow;
  22594. instance.emit("current-change", currentRow.value, null);
  22595. };
  22596. const updateCurrentRow = (_currentRow) => {
  22597. const oldCurrentRow = currentRow.value;
  22598. if (_currentRow && _currentRow !== oldCurrentRow) {
  22599. currentRow.value = _currentRow;
  22600. instance.emit("current-change", currentRow.value, oldCurrentRow);
  22601. return;
  22602. }
  22603. if (!_currentRow && oldCurrentRow) {
  22604. currentRow.value = null;
  22605. instance.emit("current-change", null, oldCurrentRow);
  22606. }
  22607. };
  22608. const updateCurrentRowData = () => {
  22609. const rowKey = watcherData.rowKey.value;
  22610. const data2 = watcherData.data.value || [];
  22611. const oldCurrentRow = currentRow.value;
  22612. if (!data2.includes(oldCurrentRow) && oldCurrentRow) {
  22613. if (rowKey) {
  22614. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  22615. setCurrentRowByKey(currentRowKey);
  22616. } else {
  22617. currentRow.value = null;
  22618. }
  22619. if (currentRow.value === null) {
  22620. instance.emit("current-change", null, oldCurrentRow);
  22621. }
  22622. } else if (_currentRowKey.value) {
  22623. setCurrentRowByKey(_currentRowKey.value);
  22624. restoreCurrentRowKey();
  22625. }
  22626. };
  22627. return {
  22628. setCurrentRowKey,
  22629. restoreCurrentRowKey,
  22630. setCurrentRowByKey,
  22631. updateCurrentRow,
  22632. updateCurrentRowData,
  22633. states: {
  22634. _currentRowKey,
  22635. currentRow
  22636. }
  22637. };
  22638. }
  22639. function useTree(watcherData) {
  22640. const expandRowKeys = ref([]);
  22641. const treeData = ref({});
  22642. const indent = ref(16);
  22643. const lazy = ref(false);
  22644. const lazyTreeNodeMap = ref({});
  22645. const lazyColumnIdentifier = ref("hasChildren");
  22646. const childrenColumnName = ref("children");
  22647. const instance = getCurrentInstance();
  22648. const normalizedData = computed(() => {
  22649. if (!watcherData.rowKey.value)
  22650. return {};
  22651. const data2 = watcherData.data.value || [];
  22652. return normalize(data2);
  22653. });
  22654. const normalizedLazyNode = computed(() => {
  22655. const rowKey = watcherData.rowKey.value;
  22656. const keys2 = Object.keys(lazyTreeNodeMap.value);
  22657. const res = {};
  22658. if (!keys2.length)
  22659. return res;
  22660. keys2.forEach((key) => {
  22661. if (lazyTreeNodeMap.value[key].length) {
  22662. const item = { children: [] };
  22663. lazyTreeNodeMap.value[key].forEach((row) => {
  22664. const currentRowKey = getRowIdentity(row, rowKey);
  22665. item.children.push(currentRowKey);
  22666. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  22667. res[currentRowKey] = { children: [] };
  22668. }
  22669. });
  22670. res[key] = item;
  22671. }
  22672. });
  22673. return res;
  22674. });
  22675. const normalize = (data2) => {
  22676. const rowKey = watcherData.rowKey.value;
  22677. const res = {};
  22678. walkTreeNode(data2, (parent, children, level) => {
  22679. const parentId = getRowIdentity(parent, rowKey);
  22680. if (Array.isArray(children)) {
  22681. res[parentId] = {
  22682. children: children.map((row) => getRowIdentity(row, rowKey)),
  22683. level
  22684. };
  22685. } else if (lazy.value) {
  22686. res[parentId] = {
  22687. children: [],
  22688. lazy: true,
  22689. level
  22690. };
  22691. }
  22692. }, childrenColumnName.value, lazyColumnIdentifier.value);
  22693. return res;
  22694. };
  22695. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a2) => (_a2 = instance.store) == null ? void 0 : _a2.states.defaultExpandAll.value)()) => {
  22696. var _a2;
  22697. const nested = normalizedData.value;
  22698. const normalizedLazyNode_ = normalizedLazyNode.value;
  22699. const keys2 = Object.keys(nested);
  22700. const newTreeData = {};
  22701. if (keys2.length) {
  22702. const oldTreeData = unref(treeData);
  22703. const rootLazyRowKeys = [];
  22704. const getExpanded = (oldValue, key) => {
  22705. if (ifChangeExpandRowKeys) {
  22706. if (expandRowKeys.value) {
  22707. return ifExpandAll || expandRowKeys.value.includes(key);
  22708. } else {
  22709. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  22710. }
  22711. } else {
  22712. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  22713. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  22714. }
  22715. };
  22716. keys2.forEach((key) => {
  22717. const oldValue = oldTreeData[key];
  22718. const newValue = __spreadValues({}, nested[key]);
  22719. newValue.expanded = getExpanded(oldValue, key);
  22720. if (newValue.lazy) {
  22721. const { loaded = false, loading: loading2 = false } = oldValue || {};
  22722. newValue.loaded = !!loaded;
  22723. newValue.loading = !!loading2;
  22724. rootLazyRowKeys.push(key);
  22725. }
  22726. newTreeData[key] = newValue;
  22727. });
  22728. const lazyKeys = Object.keys(normalizedLazyNode_);
  22729. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  22730. lazyKeys.forEach((key) => {
  22731. const oldValue = oldTreeData[key];
  22732. const lazyNodeChildren = normalizedLazyNode_[key].children;
  22733. if (rootLazyRowKeys.includes(key)) {
  22734. if (newTreeData[key].children.length !== 0) {
  22735. throw new Error("[ElTable]children must be an empty array.");
  22736. }
  22737. newTreeData[key].children = lazyNodeChildren;
  22738. } else {
  22739. const { loaded = false, loading: loading2 = false } = oldValue || {};
  22740. newTreeData[key] = {
  22741. lazy: true,
  22742. loaded: !!loaded,
  22743. loading: !!loading2,
  22744. expanded: getExpanded(oldValue, key),
  22745. children: lazyNodeChildren,
  22746. level: ""
  22747. };
  22748. }
  22749. });
  22750. }
  22751. }
  22752. treeData.value = newTreeData;
  22753. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  22754. };
  22755. watch(() => expandRowKeys.value, () => {
  22756. updateTreeData(true);
  22757. });
  22758. watch(() => normalizedData.value, () => {
  22759. updateTreeData();
  22760. });
  22761. watch(() => normalizedLazyNode.value, () => {
  22762. updateTreeData();
  22763. });
  22764. const updateTreeExpandKeys = (value) => {
  22765. expandRowKeys.value = value;
  22766. updateTreeData();
  22767. };
  22768. const toggleTreeExpansion = (row, expanded) => {
  22769. instance.store.assertRowKey();
  22770. const rowKey = watcherData.rowKey.value;
  22771. const id = getRowIdentity(row, rowKey);
  22772. const data2 = id && treeData.value[id];
  22773. if (id && data2 && "expanded" in data2) {
  22774. const oldExpanded = data2.expanded;
  22775. expanded = typeof expanded === "undefined" ? !data2.expanded : expanded;
  22776. treeData.value[id].expanded = expanded;
  22777. if (oldExpanded !== expanded) {
  22778. instance.emit("expand-change", row, expanded);
  22779. }
  22780. instance.store.updateTableScrollY();
  22781. }
  22782. };
  22783. const loadOrToggle = (row) => {
  22784. instance.store.assertRowKey();
  22785. const rowKey = watcherData.rowKey.value;
  22786. const id = getRowIdentity(row, rowKey);
  22787. const data2 = treeData.value[id];
  22788. if (lazy.value && data2 && "loaded" in data2 && !data2.loaded) {
  22789. loadData(row, id, data2);
  22790. } else {
  22791. toggleTreeExpansion(row, void 0);
  22792. }
  22793. };
  22794. const loadData = (row, key, treeNode) => {
  22795. const { load } = instance.props;
  22796. if (load && !treeData.value[key].loaded) {
  22797. treeData.value[key].loading = true;
  22798. load(row, treeNode, (data2) => {
  22799. if (!Array.isArray(data2)) {
  22800. throw new TypeError("[ElTable] data must be an array");
  22801. }
  22802. treeData.value[key].loading = false;
  22803. treeData.value[key].loaded = true;
  22804. treeData.value[key].expanded = true;
  22805. if (data2.length) {
  22806. lazyTreeNodeMap.value[key] = data2;
  22807. }
  22808. instance.emit("expand-change", row, true);
  22809. });
  22810. }
  22811. };
  22812. return {
  22813. loadData,
  22814. loadOrToggle,
  22815. toggleTreeExpansion,
  22816. updateTreeExpandKeys,
  22817. updateTreeData,
  22818. normalize,
  22819. states: {
  22820. expandRowKeys,
  22821. treeData,
  22822. indent,
  22823. lazy,
  22824. lazyTreeNodeMap,
  22825. lazyColumnIdentifier,
  22826. childrenColumnName
  22827. }
  22828. };
  22829. }
  22830. const sortData = (data2, states) => {
  22831. const sortingColumn = states.sortingColumn;
  22832. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  22833. return data2;
  22834. }
  22835. return orderBy(data2, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  22836. };
  22837. const doFlattenColumns = (columns) => {
  22838. const result = [];
  22839. columns.forEach((column) => {
  22840. if (column.children) {
  22841. result.push.apply(result, doFlattenColumns(column.children));
  22842. } else {
  22843. result.push(column);
  22844. }
  22845. });
  22846. return result;
  22847. };
  22848. function useWatcher$1() {
  22849. var _a2;
  22850. const instance = getCurrentInstance();
  22851. const { size: tableSize } = toRefs((_a2 = instance.proxy) == null ? void 0 : _a2.$props);
  22852. const rowKey = ref(null);
  22853. const data2 = ref([]);
  22854. const _data = ref([]);
  22855. const isComplex = ref(false);
  22856. const _columns = ref([]);
  22857. const originColumns = ref([]);
  22858. const columns = ref([]);
  22859. const fixedColumns = ref([]);
  22860. const rightFixedColumns = ref([]);
  22861. const leafColumns = ref([]);
  22862. const fixedLeafColumns = ref([]);
  22863. const rightFixedLeafColumns = ref([]);
  22864. const leafColumnsLength = ref(0);
  22865. const fixedLeafColumnsLength = ref(0);
  22866. const rightFixedLeafColumnsLength = ref(0);
  22867. const isAllSelected = ref(false);
  22868. const selection = ref([]);
  22869. const reserveSelection = ref(false);
  22870. const selectOnIndeterminate = ref(false);
  22871. const selectable = ref(null);
  22872. const filters = ref({});
  22873. const filteredData = ref(null);
  22874. const sortingColumn = ref(null);
  22875. const sortProp = ref(null);
  22876. const sortOrder = ref(null);
  22877. const hoverRow = ref(null);
  22878. watch(data2, () => instance.state && scheduleLayout(false), {
  22879. deep: true
  22880. });
  22881. const assertRowKey = () => {
  22882. if (!rowKey.value)
  22883. throw new Error("[ElTable] prop row-key is required");
  22884. };
  22885. const updateColumns = () => {
  22886. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  22887. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  22888. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  22889. _columns.value[0].fixed = true;
  22890. fixedColumns.value.unshift(_columns.value[0]);
  22891. }
  22892. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  22893. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  22894. const leafColumns2 = doFlattenColumns(notFixedColumns);
  22895. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  22896. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  22897. leafColumnsLength.value = leafColumns2.length;
  22898. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  22899. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  22900. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  22901. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  22902. };
  22903. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  22904. if (needUpdateColumns) {
  22905. updateColumns();
  22906. }
  22907. if (immediate) {
  22908. instance.state.doLayout();
  22909. } else {
  22910. instance.state.debouncedUpdateLayout();
  22911. }
  22912. };
  22913. const isSelected = (row) => {
  22914. return selection.value.includes(row);
  22915. };
  22916. const clearSelection = () => {
  22917. isAllSelected.value = false;
  22918. const oldSelection = selection.value;
  22919. if (oldSelection.length) {
  22920. selection.value = [];
  22921. instance.emit("selection-change", []);
  22922. }
  22923. };
  22924. const cleanSelection = () => {
  22925. let deleted;
  22926. if (rowKey.value) {
  22927. deleted = [];
  22928. const selectedMap = getKeysMap(selection.value, rowKey.value);
  22929. const dataMap = getKeysMap(data2.value, rowKey.value);
  22930. for (const key in selectedMap) {
  22931. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  22932. deleted.push(selectedMap[key].row);
  22933. }
  22934. }
  22935. } else {
  22936. deleted = selection.value.filter((item) => !data2.value.includes(item));
  22937. }
  22938. if (deleted.length) {
  22939. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  22940. selection.value = newSelection;
  22941. instance.emit("selection-change", newSelection.slice());
  22942. }
  22943. };
  22944. const getSelectionRows = () => {
  22945. return (selection.value || []).slice();
  22946. };
  22947. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  22948. const changed = toggleRowStatus(selection.value, row, selected);
  22949. if (changed) {
  22950. const newSelection = (selection.value || []).slice();
  22951. if (emitChange) {
  22952. instance.emit("select", newSelection, row);
  22953. }
  22954. instance.emit("selection-change", newSelection);
  22955. }
  22956. };
  22957. const _toggleAllSelection = () => {
  22958. var _a22, _b2;
  22959. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  22960. isAllSelected.value = value;
  22961. let selectionChanged = false;
  22962. let childrenCount = 0;
  22963. const rowKey2 = (_b2 = (_a22 = instance == null ? void 0 : instance.store) == null ? void 0 : _a22.states) == null ? void 0 : _b2.rowKey.value;
  22964. data2.value.forEach((row, index) => {
  22965. const rowIndex = index + childrenCount;
  22966. if (selectable.value) {
  22967. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  22968. selectionChanged = true;
  22969. }
  22970. } else {
  22971. if (toggleRowStatus(selection.value, row, value)) {
  22972. selectionChanged = true;
  22973. }
  22974. }
  22975. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  22976. });
  22977. if (selectionChanged) {
  22978. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  22979. }
  22980. instance.emit("select-all", selection.value);
  22981. };
  22982. const updateSelectionByRowKey = () => {
  22983. const selectedMap = getKeysMap(selection.value, rowKey.value);
  22984. data2.value.forEach((row) => {
  22985. const rowId = getRowIdentity(row, rowKey.value);
  22986. const rowInfo = selectedMap[rowId];
  22987. if (rowInfo) {
  22988. selection.value[rowInfo.index] = row;
  22989. }
  22990. });
  22991. };
  22992. const updateAllSelected = () => {
  22993. var _a22, _b2, _c;
  22994. if (((_a22 = data2.value) == null ? void 0 : _a22.length) === 0) {
  22995. isAllSelected.value = false;
  22996. return;
  22997. }
  22998. let selectedMap;
  22999. if (rowKey.value) {
  23000. selectedMap = getKeysMap(selection.value, rowKey.value);
  23001. }
  23002. const isSelected2 = function(row) {
  23003. if (selectedMap) {
  23004. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  23005. } else {
  23006. return selection.value.includes(row);
  23007. }
  23008. };
  23009. let isAllSelected_ = true;
  23010. let selectedCount = 0;
  23011. let childrenCount = 0;
  23012. for (let i = 0, j = (data2.value || []).length; i < j; i++) {
  23013. const keyProp = (_c = (_b2 = instance == null ? void 0 : instance.store) == null ? void 0 : _b2.states) == null ? void 0 : _c.rowKey.value;
  23014. const rowIndex = i + childrenCount;
  23015. const item = data2.value[i];
  23016. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  23017. if (!isSelected2(item)) {
  23018. if (!selectable.value || isRowSelectable) {
  23019. isAllSelected_ = false;
  23020. break;
  23021. }
  23022. } else {
  23023. selectedCount++;
  23024. }
  23025. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  23026. }
  23027. if (selectedCount === 0)
  23028. isAllSelected_ = false;
  23029. isAllSelected.value = isAllSelected_;
  23030. };
  23031. const getChildrenCount = (rowKey2) => {
  23032. var _a22;
  23033. if (!instance || !instance.store)
  23034. return 0;
  23035. const { treeData } = instance.store.states;
  23036. let count = 0;
  23037. const children = (_a22 = treeData.value[rowKey2]) == null ? void 0 : _a22.children;
  23038. if (children) {
  23039. count += children.length;
  23040. children.forEach((childKey) => {
  23041. count += getChildrenCount(childKey);
  23042. });
  23043. }
  23044. return count;
  23045. };
  23046. const updateFilters = (columns2, values) => {
  23047. if (!Array.isArray(columns2)) {
  23048. columns2 = [columns2];
  23049. }
  23050. const filters_ = {};
  23051. columns2.forEach((col) => {
  23052. filters.value[col.id] = values;
  23053. filters_[col.columnKey || col.id] = values;
  23054. });
  23055. return filters_;
  23056. };
  23057. const updateSort = (column, prop, order2) => {
  23058. if (sortingColumn.value && sortingColumn.value !== column) {
  23059. sortingColumn.value.order = null;
  23060. }
  23061. sortingColumn.value = column;
  23062. sortProp.value = prop;
  23063. sortOrder.value = order2;
  23064. };
  23065. const execFilter = () => {
  23066. let sourceData = unref(_data);
  23067. Object.keys(filters.value).forEach((columnId) => {
  23068. const values = filters.value[columnId];
  23069. if (!values || values.length === 0)
  23070. return;
  23071. const column = getColumnById({
  23072. columns: columns.value
  23073. }, columnId);
  23074. if (column && column.filterMethod) {
  23075. sourceData = sourceData.filter((row) => {
  23076. return values.some((value) => column.filterMethod.call(null, value, row, column));
  23077. });
  23078. }
  23079. });
  23080. filteredData.value = sourceData;
  23081. };
  23082. const execSort = () => {
  23083. data2.value = sortData(filteredData.value, {
  23084. sortingColumn: sortingColumn.value,
  23085. sortProp: sortProp.value,
  23086. sortOrder: sortOrder.value
  23087. });
  23088. };
  23089. const execQuery = (ignore = void 0) => {
  23090. if (!(ignore && ignore.filter)) {
  23091. execFilter();
  23092. }
  23093. execSort();
  23094. };
  23095. const clearFilter = (columnKeys) => {
  23096. const { tableHeaderRef } = instance.refs;
  23097. if (!tableHeaderRef)
  23098. return;
  23099. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  23100. const keys2 = Object.keys(panels);
  23101. if (!keys2.length)
  23102. return;
  23103. if (typeof columnKeys === "string") {
  23104. columnKeys = [columnKeys];
  23105. }
  23106. if (Array.isArray(columnKeys)) {
  23107. const columns_ = columnKeys.map((key) => getColumnByKey({
  23108. columns: columns.value
  23109. }, key));
  23110. keys2.forEach((key) => {
  23111. const column = columns_.find((col) => col.id === key);
  23112. if (column) {
  23113. column.filteredValue = [];
  23114. }
  23115. });
  23116. instance.store.commit("filterChange", {
  23117. column: columns_,
  23118. values: [],
  23119. silent: true,
  23120. multi: true
  23121. });
  23122. } else {
  23123. keys2.forEach((key) => {
  23124. const column = columns.value.find((col) => col.id === key);
  23125. if (column) {
  23126. column.filteredValue = [];
  23127. }
  23128. });
  23129. filters.value = {};
  23130. instance.store.commit("filterChange", {
  23131. column: {},
  23132. values: [],
  23133. silent: true
  23134. });
  23135. }
  23136. };
  23137. const clearSort = () => {
  23138. if (!sortingColumn.value)
  23139. return;
  23140. updateSort(null, null, null);
  23141. instance.store.commit("changeSortCondition", {
  23142. silent: true
  23143. });
  23144. };
  23145. const {
  23146. setExpandRowKeys,
  23147. toggleRowExpansion,
  23148. updateExpandRows,
  23149. states: expandStates,
  23150. isRowExpanded
  23151. } = useExpand({
  23152. data: data2,
  23153. rowKey
  23154. });
  23155. const {
  23156. updateTreeExpandKeys,
  23157. toggleTreeExpansion,
  23158. updateTreeData,
  23159. loadOrToggle,
  23160. states: treeStates
  23161. } = useTree({
  23162. data: data2,
  23163. rowKey
  23164. });
  23165. const {
  23166. updateCurrentRowData,
  23167. updateCurrentRow,
  23168. setCurrentRowKey,
  23169. states: currentData
  23170. } = useCurrent({
  23171. data: data2,
  23172. rowKey
  23173. });
  23174. const setExpandRowKeysAdapter = (val) => {
  23175. setExpandRowKeys(val);
  23176. updateTreeExpandKeys(val);
  23177. };
  23178. const toggleRowExpansionAdapter = (row, expanded) => {
  23179. const hasExpandColumn = columns.value.some(({ type: type4 }) => type4 === "expand");
  23180. if (hasExpandColumn) {
  23181. toggleRowExpansion(row, expanded);
  23182. } else {
  23183. toggleTreeExpansion(row, expanded);
  23184. }
  23185. };
  23186. return {
  23187. assertRowKey,
  23188. updateColumns,
  23189. scheduleLayout,
  23190. isSelected,
  23191. clearSelection,
  23192. cleanSelection,
  23193. getSelectionRows,
  23194. toggleRowSelection,
  23195. _toggleAllSelection,
  23196. toggleAllSelection: null,
  23197. updateSelectionByRowKey,
  23198. updateAllSelected,
  23199. updateFilters,
  23200. updateCurrentRow,
  23201. updateSort,
  23202. execFilter,
  23203. execSort,
  23204. execQuery,
  23205. clearFilter,
  23206. clearSort,
  23207. toggleRowExpansion,
  23208. setExpandRowKeysAdapter,
  23209. setCurrentRowKey,
  23210. toggleRowExpansionAdapter,
  23211. isRowExpanded,
  23212. updateExpandRows,
  23213. updateCurrentRowData,
  23214. loadOrToggle,
  23215. updateTreeData,
  23216. states: __spreadValues(__spreadValues(__spreadValues({
  23217. tableSize,
  23218. rowKey,
  23219. data: data2,
  23220. _data,
  23221. isComplex,
  23222. _columns,
  23223. originColumns,
  23224. columns,
  23225. fixedColumns,
  23226. rightFixedColumns,
  23227. leafColumns,
  23228. fixedLeafColumns,
  23229. rightFixedLeafColumns,
  23230. leafColumnsLength,
  23231. fixedLeafColumnsLength,
  23232. rightFixedLeafColumnsLength,
  23233. isAllSelected,
  23234. selection,
  23235. reserveSelection,
  23236. selectOnIndeterminate,
  23237. selectable,
  23238. filters,
  23239. filteredData,
  23240. sortingColumn,
  23241. sortProp,
  23242. sortOrder,
  23243. hoverRow
  23244. }, expandStates), treeStates), currentData)
  23245. };
  23246. }
  23247. function replaceColumn(array4, column) {
  23248. return array4.map((item) => {
  23249. var _a2;
  23250. if (item.id === column.id) {
  23251. return column;
  23252. } else if ((_a2 = item.children) == null ? void 0 : _a2.length) {
  23253. item.children = replaceColumn(item.children, column);
  23254. }
  23255. return item;
  23256. });
  23257. }
  23258. function sortColumn(array4) {
  23259. array4.forEach((item) => {
  23260. var _a2, _b2;
  23261. item.no = (_a2 = item.getColumnIndex) == null ? void 0 : _a2.call(item);
  23262. if ((_b2 = item.children) == null ? void 0 : _b2.length) {
  23263. sortColumn(item.children);
  23264. }
  23265. });
  23266. array4.sort((cur, pre) => cur.no - pre.no);
  23267. }
  23268. function useStore() {
  23269. const instance = getCurrentInstance();
  23270. const watcher = useWatcher$1();
  23271. const ns = useNamespace("table");
  23272. const mutations = {
  23273. setData(states, data2) {
  23274. const dataInstanceChanged = unref(states._data) !== data2;
  23275. states.data.value = data2;
  23276. states._data.value = data2;
  23277. instance.store.execQuery();
  23278. instance.store.updateCurrentRowData();
  23279. instance.store.updateExpandRows();
  23280. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  23281. if (unref(states.reserveSelection)) {
  23282. instance.store.assertRowKey();
  23283. instance.store.updateSelectionByRowKey();
  23284. } else {
  23285. if (dataInstanceChanged) {
  23286. instance.store.clearSelection();
  23287. } else {
  23288. instance.store.cleanSelection();
  23289. }
  23290. }
  23291. instance.store.updateAllSelected();
  23292. if (instance.$ready) {
  23293. instance.store.scheduleLayout();
  23294. }
  23295. },
  23296. insertColumn(states, column, parent) {
  23297. const array4 = unref(states._columns);
  23298. let newColumns = [];
  23299. if (!parent) {
  23300. array4.push(column);
  23301. newColumns = array4;
  23302. } else {
  23303. if (parent && !parent.children) {
  23304. parent.children = [];
  23305. }
  23306. parent.children.push(column);
  23307. newColumns = replaceColumn(array4, parent);
  23308. }
  23309. sortColumn(newColumns);
  23310. states._columns.value = newColumns;
  23311. if (column.type === "selection") {
  23312. states.selectable.value = column.selectable;
  23313. states.reserveSelection.value = column.reserveSelection;
  23314. }
  23315. if (instance.$ready) {
  23316. instance.store.updateColumns();
  23317. instance.store.scheduleLayout();
  23318. }
  23319. },
  23320. removeColumn(states, column, parent) {
  23321. const array4 = unref(states._columns) || [];
  23322. if (parent) {
  23323. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  23324. if (parent.children.length === 0) {
  23325. delete parent.children;
  23326. }
  23327. states._columns.value = replaceColumn(array4, parent);
  23328. } else {
  23329. const index = array4.indexOf(column);
  23330. if (index > -1) {
  23331. array4.splice(index, 1);
  23332. states._columns.value = array4;
  23333. }
  23334. }
  23335. if (instance.$ready) {
  23336. instance.store.updateColumns();
  23337. instance.store.scheduleLayout();
  23338. }
  23339. },
  23340. sort(states, options) {
  23341. const { prop, order: order2, init } = options;
  23342. if (prop) {
  23343. const column = unref(states.columns).find((column2) => column2.property === prop);
  23344. if (column) {
  23345. column.order = order2;
  23346. instance.store.updateSort(column, prop, order2);
  23347. instance.store.commit("changeSortCondition", { init });
  23348. }
  23349. }
  23350. },
  23351. changeSortCondition(states, options) {
  23352. const { sortingColumn: column, sortProp: prop, sortOrder: order2 } = states;
  23353. if (unref(order2) === null) {
  23354. states.sortingColumn.value = null;
  23355. states.sortProp.value = null;
  23356. }
  23357. const ingore = { filter: true };
  23358. instance.store.execQuery(ingore);
  23359. if (!options || !(options.silent || options.init)) {
  23360. instance.emit("sort-change", {
  23361. column: unref(column),
  23362. prop: unref(prop),
  23363. order: unref(order2)
  23364. });
  23365. }
  23366. instance.store.updateTableScrollY();
  23367. },
  23368. filterChange(_states, options) {
  23369. const { column, values, silent } = options;
  23370. const newFilters = instance.store.updateFilters(column, values);
  23371. instance.store.execQuery();
  23372. if (!silent) {
  23373. instance.emit("filter-change", newFilters);
  23374. }
  23375. instance.store.updateTableScrollY();
  23376. },
  23377. toggleAllSelection() {
  23378. instance.store.toggleAllSelection();
  23379. },
  23380. rowSelectedChanged(_states, row) {
  23381. instance.store.toggleRowSelection(row);
  23382. instance.store.updateAllSelected();
  23383. },
  23384. setHoverRow(states, row) {
  23385. states.hoverRow.value = row;
  23386. },
  23387. setCurrentRow(_states, row) {
  23388. instance.store.updateCurrentRow(row);
  23389. }
  23390. };
  23391. const commit = function(name, ...args) {
  23392. const mutations2 = instance.store.mutations;
  23393. if (mutations2[name]) {
  23394. mutations2[name].apply(instance, [instance.store.states].concat(args));
  23395. } else {
  23396. throw new Error(`Action not found: ${name}`);
  23397. }
  23398. };
  23399. const updateTableScrollY = function() {
  23400. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  23401. };
  23402. return __spreadProps(__spreadValues({
  23403. ns
  23404. }, watcher), {
  23405. mutations,
  23406. commit,
  23407. updateTableScrollY
  23408. });
  23409. }
  23410. const InitialStateMap = {
  23411. rowKey: "rowKey",
  23412. defaultExpandAll: "defaultExpandAll",
  23413. selectOnIndeterminate: "selectOnIndeterminate",
  23414. indent: "indent",
  23415. lazy: "lazy",
  23416. data: "data",
  23417. ["treeProps.hasChildren"]: {
  23418. key: "lazyColumnIdentifier",
  23419. default: "hasChildren"
  23420. },
  23421. ["treeProps.children"]: {
  23422. key: "childrenColumnName",
  23423. default: "children"
  23424. }
  23425. };
  23426. function createStore(table, props) {
  23427. if (!table) {
  23428. throw new Error("Table is required.");
  23429. }
  23430. const store = useStore();
  23431. store.toggleAllSelection = debounce$1(store._toggleAllSelection, 10);
  23432. Object.keys(InitialStateMap).forEach((key) => {
  23433. handleValue(getArrKeysValue(props, key), key, store);
  23434. });
  23435. proxyTableProps(store, props);
  23436. return store;
  23437. }
  23438. function proxyTableProps(store, props) {
  23439. Object.keys(InitialStateMap).forEach((key) => {
  23440. watch(() => getArrKeysValue(props, key), (value) => {
  23441. handleValue(value, key, store);
  23442. });
  23443. });
  23444. }
  23445. function handleValue(value, propsKey, store) {
  23446. let newVal = value;
  23447. let storeKey = InitialStateMap[propsKey];
  23448. if (typeof InitialStateMap[propsKey] === "object") {
  23449. storeKey = storeKey.key;
  23450. newVal = newVal || InitialStateMap[propsKey].default;
  23451. }
  23452. store.states[storeKey].value = newVal;
  23453. }
  23454. function getArrKeysValue(props, keys2) {
  23455. if (keys2.includes(".")) {
  23456. const keyList = keys2.split(".");
  23457. let value = props;
  23458. keyList.forEach((key) => {
  23459. value = value[key];
  23460. });
  23461. return value;
  23462. } else {
  23463. return props[keys2];
  23464. }
  23465. }
  23466. class TableLayout {
  23467. constructor(options) {
  23468. this.observers = [];
  23469. this.table = null;
  23470. this.store = null;
  23471. this.columns = [];
  23472. this.fit = true;
  23473. this.showHeader = true;
  23474. this.height = ref(null);
  23475. this.scrollX = ref(false);
  23476. this.scrollY = ref(false);
  23477. this.bodyWidth = ref(null);
  23478. this.fixedWidth = ref(null);
  23479. this.rightFixedWidth = ref(null);
  23480. this.tableHeight = ref(null);
  23481. this.headerHeight = ref(44);
  23482. this.appendHeight = ref(0);
  23483. this.footerHeight = ref(44);
  23484. this.viewportHeight = ref(null);
  23485. this.bodyHeight = ref(null);
  23486. this.bodyScrollHeight = ref(0);
  23487. this.fixedBodyHeight = ref(null);
  23488. this.gutterWidth = 0;
  23489. for (const name in options) {
  23490. if (hasOwn(options, name)) {
  23491. if (isRef(this[name])) {
  23492. this[name].value = options[name];
  23493. } else {
  23494. this[name] = options[name];
  23495. }
  23496. }
  23497. }
  23498. if (!this.table) {
  23499. throw new Error("Table is required for Table Layout");
  23500. }
  23501. if (!this.store) {
  23502. throw new Error("Store is required for Table Layout");
  23503. }
  23504. }
  23505. updateScrollY() {
  23506. const height = this.height.value;
  23507. if (height === null)
  23508. return false;
  23509. const bodyWrapper = this.table.refs.bodyWrapper;
  23510. if (this.table.vnode.el && bodyWrapper) {
  23511. let scrollY = true;
  23512. const prevScrollY = this.scrollY.value;
  23513. if (this.bodyHeight.value === null) {
  23514. scrollY = false;
  23515. } else {
  23516. scrollY = bodyWrapper.scrollHeight > this.bodyHeight.value;
  23517. }
  23518. this.scrollY.value = scrollY;
  23519. return prevScrollY !== scrollY;
  23520. }
  23521. return false;
  23522. }
  23523. setHeight(value, prop = "height") {
  23524. if (!isClient$1)
  23525. return;
  23526. const el = this.table.vnode.el;
  23527. value = parseHeight(value);
  23528. this.height.value = Number(value);
  23529. if (!el && (value || value === 0))
  23530. return nextTick(() => this.setHeight(value, prop));
  23531. if (typeof value === "number") {
  23532. el.style[prop] = `${value}px`;
  23533. this.updateElsHeight();
  23534. } else if (typeof value === "string") {
  23535. el.style[prop] = value;
  23536. this.updateElsHeight();
  23537. }
  23538. }
  23539. setMaxHeight(value) {
  23540. this.setHeight(value, "max-height");
  23541. }
  23542. getFlattenColumns() {
  23543. const flattenColumns = [];
  23544. const columns = this.table.store.states.columns.value;
  23545. columns.forEach((column) => {
  23546. if (column.isColumnGroup) {
  23547. flattenColumns.push.apply(flattenColumns, column.columns);
  23548. } else {
  23549. flattenColumns.push(column);
  23550. }
  23551. });
  23552. return flattenColumns;
  23553. }
  23554. updateElsHeight() {
  23555. var _a2, _b2;
  23556. if (!this.table.$ready)
  23557. return nextTick(() => this.updateElsHeight());
  23558. const {
  23559. tableWrapper,
  23560. headerWrapper,
  23561. appendWrapper,
  23562. footerWrapper,
  23563. tableHeader,
  23564. tableBody
  23565. } = this.table.refs;
  23566. if (tableWrapper && tableWrapper.style.display === "none") {
  23567. return;
  23568. }
  23569. const { tableLayout } = this.table.props;
  23570. this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0;
  23571. if (this.showHeader && !headerWrapper && tableLayout === "fixed") {
  23572. return;
  23573. }
  23574. const headerTrElm = tableHeader ? tableHeader : null;
  23575. const noneHeader = this.headerDisplayNone(headerTrElm);
  23576. const headerWrapperOffsetHeight = (headerWrapper == null ? void 0 : headerWrapper.offsetHeight) || 0;
  23577. const headerHeight = this.headerHeight.value = !this.showHeader ? 0 : headerWrapperOffsetHeight;
  23578. if (this.showHeader && !noneHeader && headerWrapperOffsetHeight > 0 && (this.table.store.states.columns.value || []).length > 0 && headerHeight < 2) {
  23579. return nextTick(() => this.updateElsHeight());
  23580. }
  23581. const tableHeight = this.tableHeight.value = (_b2 = (_a2 = this.table) == null ? void 0 : _a2.vnode.el) == null ? void 0 : _b2.clientHeight;
  23582. const footerHeight = this.footerHeight.value = footerWrapper ? footerWrapper.offsetHeight : 0;
  23583. if (this.height.value !== null) {
  23584. if (this.bodyHeight.value === null) {
  23585. requestAnimationFrame(() => this.updateElsHeight());
  23586. }
  23587. this.bodyHeight.value = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
  23588. this.bodyScrollHeight.value = tableBody == null ? void 0 : tableBody.scrollHeight;
  23589. }
  23590. this.fixedBodyHeight.value = this.scrollX.value ? this.bodyHeight.value - this.gutterWidth : this.bodyHeight.value;
  23591. this.viewportHeight.value = this.scrollX.value ? tableHeight - this.gutterWidth : tableHeight;
  23592. this.updateScrollY();
  23593. this.notifyObservers("scrollable");
  23594. }
  23595. headerDisplayNone(elm) {
  23596. if (!elm)
  23597. return true;
  23598. let headerChild = elm;
  23599. while (headerChild.tagName !== "DIV") {
  23600. if (getComputedStyle(headerChild).display === "none") {
  23601. return true;
  23602. }
  23603. headerChild = headerChild.parentElement;
  23604. }
  23605. return false;
  23606. }
  23607. updateColumnsWidth() {
  23608. if (!isClient$1)
  23609. return;
  23610. const fit = this.fit;
  23611. const bodyWidth = this.table.vnode.el.clientWidth;
  23612. let bodyMinWidth = 0;
  23613. const flattenColumns = this.getFlattenColumns();
  23614. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  23615. flattenColumns.forEach((column) => {
  23616. if (typeof column.width === "number" && column.realWidth)
  23617. column.realWidth = null;
  23618. });
  23619. if (flexColumns.length > 0 && fit) {
  23620. flattenColumns.forEach((column) => {
  23621. bodyMinWidth += Number(column.width || column.minWidth || 80);
  23622. });
  23623. if (bodyMinWidth <= bodyWidth) {
  23624. this.scrollX.value = false;
  23625. const totalFlexWidth = bodyWidth - bodyMinWidth;
  23626. if (flexColumns.length === 1) {
  23627. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  23628. } else {
  23629. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  23630. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  23631. let noneFirstWidth = 0;
  23632. flexColumns.forEach((column, index) => {
  23633. if (index === 0)
  23634. return;
  23635. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  23636. noneFirstWidth += flexWidth;
  23637. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  23638. });
  23639. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  23640. }
  23641. } else {
  23642. this.scrollX.value = true;
  23643. flexColumns.forEach((column) => {
  23644. column.realWidth = Number(column.minWidth);
  23645. });
  23646. }
  23647. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  23648. this.table.state.resizeState.value.width = this.bodyWidth.value;
  23649. } else {
  23650. flattenColumns.forEach((column) => {
  23651. if (!column.width && !column.minWidth) {
  23652. column.realWidth = 80;
  23653. } else {
  23654. column.realWidth = Number(column.width || column.minWidth);
  23655. }
  23656. bodyMinWidth += column.realWidth;
  23657. });
  23658. this.scrollX.value = bodyMinWidth > bodyWidth;
  23659. this.bodyWidth.value = bodyMinWidth;
  23660. }
  23661. const fixedColumns = this.store.states.fixedColumns.value;
  23662. if (fixedColumns.length > 0) {
  23663. let fixedWidth = 0;
  23664. fixedColumns.forEach((column) => {
  23665. fixedWidth += Number(column.realWidth || column.width);
  23666. });
  23667. this.fixedWidth.value = fixedWidth;
  23668. }
  23669. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  23670. if (rightFixedColumns.length > 0) {
  23671. let rightFixedWidth = 0;
  23672. rightFixedColumns.forEach((column) => {
  23673. rightFixedWidth += Number(column.realWidth || column.width);
  23674. });
  23675. this.rightFixedWidth.value = rightFixedWidth;
  23676. }
  23677. this.notifyObservers("columns");
  23678. }
  23679. addObserver(observer) {
  23680. this.observers.push(observer);
  23681. }
  23682. removeObserver(observer) {
  23683. const index = this.observers.indexOf(observer);
  23684. if (index !== -1) {
  23685. this.observers.splice(index, 1);
  23686. }
  23687. }
  23688. notifyObservers(event) {
  23689. const observers = this.observers;
  23690. observers.forEach((observer) => {
  23691. var _a2, _b2;
  23692. switch (event) {
  23693. case "columns":
  23694. (_a2 = observer.state) == null ? void 0 : _a2.onColumnsChange(this);
  23695. break;
  23696. case "scrollable":
  23697. (_b2 = observer.state) == null ? void 0 : _b2.onScrollableChange(this);
  23698. break;
  23699. default:
  23700. throw new Error(`Table Layout don't have event ${event}.`);
  23701. }
  23702. });
  23703. }
  23704. }
  23705. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  23706. const _sfc_main$e = defineComponent({
  23707. name: "ElTableFilterPanel",
  23708. components: {
  23709. ElCheckbox,
  23710. ElCheckboxGroup,
  23711. ElScrollbar,
  23712. ElTooltip,
  23713. ElIcon,
  23714. ArrowDown: arrowDown,
  23715. ArrowUp: arrowUp
  23716. },
  23717. directives: { ClickOutside },
  23718. props: {
  23719. placement: {
  23720. type: String,
  23721. default: "bottom-start"
  23722. },
  23723. store: {
  23724. type: Object
  23725. },
  23726. column: {
  23727. type: Object
  23728. },
  23729. upDataColumn: {
  23730. type: Function
  23731. }
  23732. },
  23733. setup(props) {
  23734. const instance = getCurrentInstance();
  23735. const { t } = useLocale();
  23736. const ns = useNamespace("table-filter");
  23737. const parent = instance == null ? void 0 : instance.parent;
  23738. if (!parent.filterPanels.value[props.column.id]) {
  23739. parent.filterPanels.value[props.column.id] = instance;
  23740. }
  23741. const tooltipVisible = ref(false);
  23742. const tooltip = ref(null);
  23743. const filters = computed(() => {
  23744. return props.column && props.column.filters;
  23745. });
  23746. const filterValue = computed({
  23747. get: () => {
  23748. var _a2;
  23749. return (((_a2 = props.column) == null ? void 0 : _a2.filteredValue) || [])[0];
  23750. },
  23751. set: (value) => {
  23752. if (filteredValue.value) {
  23753. if (typeof value !== "undefined" && value !== null) {
  23754. filteredValue.value.splice(0, 1, value);
  23755. } else {
  23756. filteredValue.value.splice(0, 1);
  23757. }
  23758. }
  23759. }
  23760. });
  23761. const filteredValue = computed({
  23762. get() {
  23763. if (props.column) {
  23764. return props.column.filteredValue || [];
  23765. }
  23766. return [];
  23767. },
  23768. set(value) {
  23769. if (props.column) {
  23770. props.upDataColumn("filteredValue", value);
  23771. }
  23772. }
  23773. });
  23774. const multiple = computed(() => {
  23775. if (props.column) {
  23776. return props.column.filterMultiple;
  23777. }
  23778. return true;
  23779. });
  23780. const isActive = (filter) => {
  23781. return filter.value === filterValue.value;
  23782. };
  23783. const hidden = () => {
  23784. tooltipVisible.value = false;
  23785. };
  23786. const showFilterPanel = (e) => {
  23787. e.stopPropagation();
  23788. tooltipVisible.value = !tooltipVisible.value;
  23789. };
  23790. const hideFilterPanel = () => {
  23791. tooltipVisible.value = false;
  23792. };
  23793. const handleConfirm = () => {
  23794. confirmFilter(filteredValue.value);
  23795. hidden();
  23796. };
  23797. const handleReset = () => {
  23798. filteredValue.value = [];
  23799. confirmFilter(filteredValue.value);
  23800. hidden();
  23801. };
  23802. const handleSelect = (_filterValue) => {
  23803. filterValue.value = _filterValue;
  23804. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  23805. confirmFilter(filteredValue.value);
  23806. } else {
  23807. confirmFilter([]);
  23808. }
  23809. hidden();
  23810. };
  23811. const confirmFilter = (filteredValue2) => {
  23812. props.store.commit("filterChange", {
  23813. column: props.column,
  23814. values: filteredValue2
  23815. });
  23816. props.store.updateAllSelected();
  23817. };
  23818. watch(tooltipVisible, (value) => {
  23819. if (props.column) {
  23820. props.upDataColumn("filterOpened", value);
  23821. }
  23822. }, {
  23823. immediate: true
  23824. });
  23825. const popperPaneRef = computed(() => {
  23826. var _a2, _b2;
  23827. return (_b2 = (_a2 = tooltip.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  23828. });
  23829. return {
  23830. tooltipVisible,
  23831. multiple,
  23832. filteredValue,
  23833. filterValue,
  23834. filters,
  23835. handleConfirm,
  23836. handleReset,
  23837. handleSelect,
  23838. isActive,
  23839. t,
  23840. ns,
  23841. showFilterPanel,
  23842. hideFilterPanel,
  23843. popperPaneRef,
  23844. tooltip
  23845. };
  23846. }
  23847. });
  23848. const _hoisted_1$b = { key: 0 };
  23849. const _hoisted_2$9 = ["disabled"];
  23850. const _hoisted_3$6 = ["label", "onClick"];
  23851. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  23852. const _component_el_checkbox = resolveComponent("el-checkbox");
  23853. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  23854. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  23855. const _component_arrow_up = resolveComponent("arrow-up");
  23856. const _component_arrow_down = resolveComponent("arrow-down");
  23857. const _component_el_icon = resolveComponent("el-icon");
  23858. const _component_el_tooltip = resolveComponent("el-tooltip");
  23859. const _directive_click_outside = resolveDirective("click-outside");
  23860. return openBlock(), createBlock(_component_el_tooltip, {
  23861. ref: "tooltip",
  23862. visible: _ctx.tooltipVisible,
  23863. "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => _ctx.tooltipVisible = $event),
  23864. offset: 0,
  23865. placement: _ctx.placement,
  23866. "show-arrow": false,
  23867. "stop-popper-mouse-event": false,
  23868. "append-to-body": "",
  23869. effect: "light",
  23870. pure: "",
  23871. "popper-class": _ctx.ns.b(),
  23872. persistent: ""
  23873. }, {
  23874. content: withCtx(() => [
  23875. _ctx.multiple ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
  23876. createElementVNode("div", {
  23877. class: normalizeClass(_ctx.ns.e("content"))
  23878. }, [
  23879. createVNode(_component_el_scrollbar, {
  23880. "wrap-class": _ctx.ns.e("wrap")
  23881. }, {
  23882. default: withCtx(() => [
  23883. createVNode(_component_el_checkbox_group, {
  23884. modelValue: _ctx.filteredValue,
  23885. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  23886. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  23887. }, {
  23888. default: withCtx(() => [
  23889. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  23890. return openBlock(), createBlock(_component_el_checkbox, {
  23891. key: filter.value,
  23892. label: filter.value
  23893. }, {
  23894. default: withCtx(() => [
  23895. createTextVNode(toDisplayString(filter.text), 1)
  23896. ]),
  23897. _: 2
  23898. }, 1032, ["label"]);
  23899. }), 128))
  23900. ]),
  23901. _: 1
  23902. }, 8, ["modelValue", "class"])
  23903. ]),
  23904. _: 1
  23905. }, 8, ["wrap-class"])
  23906. ], 2),
  23907. createElementVNode("div", {
  23908. class: normalizeClass(_ctx.ns.e("bottom"))
  23909. }, [
  23910. createElementVNode("button", {
  23911. class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  23912. disabled: _ctx.filteredValue.length === 0,
  23913. type: "button",
  23914. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  23915. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$9),
  23916. createElementVNode("button", {
  23917. type: "button",
  23918. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  23919. }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  23920. ], 2)
  23921. ])) : (openBlock(), createElementBlock("ul", {
  23922. key: 1,
  23923. class: normalizeClass(_ctx.ns.e("list"))
  23924. }, [
  23925. createElementVNode("li", {
  23926. class: normalizeClass([
  23927. _ctx.ns.e("list-item"),
  23928. {
  23929. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  23930. }
  23931. ]),
  23932. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  23933. }, toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  23934. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  23935. return openBlock(), createElementBlock("li", {
  23936. key: filter.value,
  23937. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  23938. label: filter.value,
  23939. onClick: ($event) => _ctx.handleSelect(filter.value)
  23940. }, toDisplayString(filter.text), 11, _hoisted_3$6);
  23941. }), 128))
  23942. ], 2))
  23943. ]),
  23944. default: withCtx(() => [
  23945. withDirectives((openBlock(), createElementBlock("span", {
  23946. class: normalizeClass([
  23947. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  23948. `${_ctx.ns.namespace.value}-none-outline`
  23949. ]),
  23950. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  23951. }, [
  23952. createVNode(_component_el_icon, null, {
  23953. default: withCtx(() => [
  23954. _ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
  23955. ]),
  23956. _: 1
  23957. })
  23958. ], 2)), [
  23959. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  23960. ])
  23961. ]),
  23962. _: 1
  23963. }, 8, ["visible", "placement", "popper-class"]);
  23964. }
  23965. 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"]]);
  23966. function useLayoutObserver(root2) {
  23967. const instance = getCurrentInstance();
  23968. onBeforeMount(() => {
  23969. tableLayout.value.addObserver(instance);
  23970. });
  23971. onMounted(() => {
  23972. onColumnsChange(tableLayout.value);
  23973. onScrollableChange(tableLayout.value);
  23974. });
  23975. onUpdated(() => {
  23976. onColumnsChange(tableLayout.value);
  23977. onScrollableChange(tableLayout.value);
  23978. });
  23979. onUnmounted(() => {
  23980. tableLayout.value.removeObserver(instance);
  23981. });
  23982. const tableLayout = computed(() => {
  23983. const layout = root2.layout;
  23984. if (!layout) {
  23985. throw new Error("Can not find table layout.");
  23986. }
  23987. return layout;
  23988. });
  23989. const onColumnsChange = (layout) => {
  23990. var _a2;
  23991. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col")) || [];
  23992. if (!cols.length)
  23993. return;
  23994. const flattenColumns = layout.getFlattenColumns();
  23995. const columnsMap = {};
  23996. flattenColumns.forEach((column) => {
  23997. columnsMap[column.id] = column;
  23998. });
  23999. for (let i = 0, j = cols.length; i < j; i++) {
  24000. const col = cols[i];
  24001. const name = col.getAttribute("name");
  24002. const column = columnsMap[name];
  24003. if (column) {
  24004. col.setAttribute("width", column.realWidth || column.width);
  24005. }
  24006. }
  24007. };
  24008. const onScrollableChange = (layout) => {
  24009. var _a2, _b2;
  24010. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col[name=gutter]")) || [];
  24011. for (let i = 0, j = cols.length; i < j; i++) {
  24012. const col = cols[i];
  24013. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  24014. }
  24015. const ths = ((_b2 = root2.vnode.el) == null ? void 0 : _b2.querySelectorAll("th.gutter")) || [];
  24016. for (let i = 0, j = ths.length; i < j; i++) {
  24017. const th = ths[i];
  24018. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  24019. th.style.display = layout.scrollY.value ? "" : "none";
  24020. }
  24021. };
  24022. return {
  24023. tableLayout: tableLayout.value,
  24024. onColumnsChange,
  24025. onScrollableChange
  24026. };
  24027. }
  24028. const TABLE_INJECTION_KEY = Symbol("ElTable");
  24029. function useEvent(props, emit) {
  24030. const instance = getCurrentInstance();
  24031. const parent = inject(TABLE_INJECTION_KEY);
  24032. const handleFilterClick = (event) => {
  24033. event.stopPropagation();
  24034. return;
  24035. };
  24036. const handleHeaderClick = (event, column) => {
  24037. if (!column.filters && column.sortable) {
  24038. handleSortClick(event, column, false);
  24039. } else if (column.filterable && !column.sortable) {
  24040. handleFilterClick(event);
  24041. }
  24042. parent == null ? void 0 : parent.emit("header-click", column, event);
  24043. };
  24044. const handleHeaderContextMenu = (event, column) => {
  24045. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  24046. };
  24047. const draggingColumn = ref(null);
  24048. const dragging = ref(false);
  24049. const dragState = ref({});
  24050. const handleMouseDown = (event, column) => {
  24051. if (!isClient$1)
  24052. return;
  24053. if (column.children && column.children.length > 0)
  24054. return;
  24055. if (draggingColumn.value && props.border) {
  24056. dragging.value = true;
  24057. const table = parent;
  24058. emit("set-drag-visible", true);
  24059. const tableEl = table == null ? void 0 : table.vnode.el;
  24060. const tableLeft = tableEl.getBoundingClientRect().left;
  24061. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  24062. const columnRect = columnEl.getBoundingClientRect();
  24063. const minLeft = columnRect.left - tableLeft + 30;
  24064. addClass(columnEl, "noclick");
  24065. dragState.value = {
  24066. startMouseLeft: event.clientX,
  24067. startLeft: columnRect.right - tableLeft,
  24068. startColumnLeft: columnRect.left - tableLeft,
  24069. tableLeft
  24070. };
  24071. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  24072. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  24073. document.onselectstart = function() {
  24074. return false;
  24075. };
  24076. document.ondragstart = function() {
  24077. return false;
  24078. };
  24079. const handleMouseMove2 = (event2) => {
  24080. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  24081. const proxyLeft = dragState.value.startLeft + deltaLeft;
  24082. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  24083. };
  24084. const handleMouseUp = () => {
  24085. if (dragging.value) {
  24086. const { startColumnLeft, startLeft } = dragState.value;
  24087. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  24088. const columnWidth = finalLeft - startColumnLeft;
  24089. column.width = column.realWidth = columnWidth;
  24090. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  24091. requestAnimationFrame(() => {
  24092. props.store.scheduleLayout(false, true);
  24093. });
  24094. document.body.style.cursor = "";
  24095. dragging.value = false;
  24096. draggingColumn.value = null;
  24097. dragState.value = {};
  24098. emit("set-drag-visible", false);
  24099. }
  24100. document.removeEventListener("mousemove", handleMouseMove2);
  24101. document.removeEventListener("mouseup", handleMouseUp);
  24102. document.onselectstart = null;
  24103. document.ondragstart = null;
  24104. setTimeout(() => {
  24105. removeClass(columnEl, "noclick");
  24106. }, 0);
  24107. };
  24108. document.addEventListener("mousemove", handleMouseMove2);
  24109. document.addEventListener("mouseup", handleMouseUp);
  24110. }
  24111. };
  24112. const handleMouseMove = (event, column) => {
  24113. if (column.children && column.children.length > 0)
  24114. return;
  24115. let target = event.target;
  24116. while (target && target.tagName !== "TH") {
  24117. target = target.parentNode;
  24118. }
  24119. if (!column || !column.resizable)
  24120. return;
  24121. if (!dragging.value && props.border) {
  24122. const rect = target.getBoundingClientRect();
  24123. const bodyStyle = document.body.style;
  24124. if (rect.width > 12 && rect.right - event.pageX < 8) {
  24125. bodyStyle.cursor = "col-resize";
  24126. if (hasClass(target, "is-sortable")) {
  24127. target.style.cursor = "col-resize";
  24128. }
  24129. draggingColumn.value = column;
  24130. } else if (!dragging.value) {
  24131. bodyStyle.cursor = "";
  24132. if (hasClass(target, "is-sortable")) {
  24133. target.style.cursor = "pointer";
  24134. }
  24135. draggingColumn.value = null;
  24136. }
  24137. }
  24138. };
  24139. const handleMouseOut = () => {
  24140. if (!isClient$1)
  24141. return;
  24142. document.body.style.cursor = "";
  24143. };
  24144. const toggleOrder = ({ order: order2, sortOrders }) => {
  24145. if (order2 === "")
  24146. return sortOrders[0];
  24147. const index = sortOrders.indexOf(order2 || null);
  24148. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  24149. };
  24150. const handleSortClick = (event, column, givenOrder) => {
  24151. event.stopPropagation();
  24152. const order2 = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  24153. let target = event.target;
  24154. while (target && target.tagName !== "TH") {
  24155. target = target.parentNode;
  24156. }
  24157. if (target && target.tagName === "TH") {
  24158. if (hasClass(target, "noclick")) {
  24159. removeClass(target, "noclick");
  24160. return;
  24161. }
  24162. }
  24163. if (!column.sortable)
  24164. return;
  24165. const states = props.store.states;
  24166. let sortProp = states.sortProp.value;
  24167. let sortOrder;
  24168. const sortingColumn = states.sortingColumn.value;
  24169. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  24170. if (sortingColumn) {
  24171. sortingColumn.order = null;
  24172. }
  24173. states.sortingColumn.value = column;
  24174. sortProp = column.property;
  24175. }
  24176. if (!order2) {
  24177. sortOrder = column.order = null;
  24178. } else {
  24179. sortOrder = column.order = order2;
  24180. }
  24181. states.sortProp.value = sortProp;
  24182. states.sortOrder.value = sortOrder;
  24183. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  24184. };
  24185. return {
  24186. handleHeaderClick,
  24187. handleHeaderContextMenu,
  24188. handleMouseDown,
  24189. handleMouseMove,
  24190. handleMouseOut,
  24191. handleSortClick,
  24192. handleFilterClick
  24193. };
  24194. }
  24195. function useStyle$2(props) {
  24196. const parent = inject(TABLE_INJECTION_KEY);
  24197. const ns = useNamespace("table");
  24198. const getHeaderRowStyle = (rowIndex) => {
  24199. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  24200. if (typeof headerRowStyle === "function") {
  24201. return headerRowStyle.call(null, { rowIndex });
  24202. }
  24203. return headerRowStyle;
  24204. };
  24205. const getHeaderRowClass = (rowIndex) => {
  24206. const classes = [];
  24207. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  24208. if (typeof headerRowClassName === "string") {
  24209. classes.push(headerRowClassName);
  24210. } else if (typeof headerRowClassName === "function") {
  24211. classes.push(headerRowClassName.call(null, { rowIndex }));
  24212. }
  24213. return classes.join(" ");
  24214. };
  24215. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  24216. var _a2;
  24217. let headerCellStyles = (_a2 = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a2 : {};
  24218. if (typeof headerCellStyles === "function") {
  24219. headerCellStyles = headerCellStyles.call(null, {
  24220. rowIndex,
  24221. columnIndex,
  24222. row,
  24223. column
  24224. });
  24225. }
  24226. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  24227. ensurePosition(fixedStyle, "left");
  24228. ensurePosition(fixedStyle, "right");
  24229. return Object.assign({}, headerCellStyles, fixedStyle);
  24230. };
  24231. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  24232. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  24233. const classes = [
  24234. column.id,
  24235. column.order,
  24236. column.headerAlign,
  24237. column.className,
  24238. column.labelClassName,
  24239. ...fixedClasses
  24240. ];
  24241. if (!column.children) {
  24242. classes.push("is-leaf");
  24243. }
  24244. if (column.sortable) {
  24245. classes.push("is-sortable");
  24246. }
  24247. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  24248. if (typeof headerCellClassName === "string") {
  24249. classes.push(headerCellClassName);
  24250. } else if (typeof headerCellClassName === "function") {
  24251. classes.push(headerCellClassName.call(null, {
  24252. rowIndex,
  24253. columnIndex,
  24254. row,
  24255. column
  24256. }));
  24257. }
  24258. classes.push(ns.e("cell"));
  24259. return classes.filter((className) => Boolean(className)).join(" ");
  24260. };
  24261. return {
  24262. getHeaderRowStyle,
  24263. getHeaderRowClass,
  24264. getHeaderCellStyle,
  24265. getHeaderCellClass
  24266. };
  24267. }
  24268. const getAllColumns = (columns) => {
  24269. const result = [];
  24270. columns.forEach((column) => {
  24271. if (column.children) {
  24272. result.push(column);
  24273. result.push.apply(result, getAllColumns(column.children));
  24274. } else {
  24275. result.push(column);
  24276. }
  24277. });
  24278. return result;
  24279. };
  24280. const convertToRows = (originColumns) => {
  24281. let maxLevel = 1;
  24282. const traverse = (column, parent) => {
  24283. if (parent) {
  24284. column.level = parent.level + 1;
  24285. if (maxLevel < column.level) {
  24286. maxLevel = column.level;
  24287. }
  24288. }
  24289. if (column.children) {
  24290. let colSpan = 0;
  24291. column.children.forEach((subColumn) => {
  24292. traverse(subColumn, column);
  24293. colSpan += subColumn.colSpan;
  24294. });
  24295. column.colSpan = colSpan;
  24296. } else {
  24297. column.colSpan = 1;
  24298. }
  24299. };
  24300. originColumns.forEach((column) => {
  24301. column.level = 1;
  24302. traverse(column, void 0);
  24303. });
  24304. const rows = [];
  24305. for (let i = 0; i < maxLevel; i++) {
  24306. rows.push([]);
  24307. }
  24308. const allColumns = getAllColumns(originColumns);
  24309. allColumns.forEach((column) => {
  24310. if (!column.children) {
  24311. column.rowSpan = maxLevel - column.level + 1;
  24312. } else {
  24313. column.rowSpan = 1;
  24314. column.children.forEach((col) => col.isSubColumn = true);
  24315. }
  24316. rows[column.level - 1].push(column);
  24317. });
  24318. return rows;
  24319. };
  24320. function useUtils$1(props) {
  24321. const parent = inject(TABLE_INJECTION_KEY);
  24322. const columnRows = computed(() => {
  24323. return convertToRows(props.store.states.originColumns.value);
  24324. });
  24325. const isGroup = computed(() => {
  24326. const result = columnRows.value.length > 1;
  24327. if (result && parent) {
  24328. parent.state.isGroup.value = true;
  24329. }
  24330. return result;
  24331. });
  24332. const toggleAllSelection = (event) => {
  24333. event.stopPropagation();
  24334. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  24335. };
  24336. return {
  24337. isGroup,
  24338. toggleAllSelection,
  24339. columnRows
  24340. };
  24341. }
  24342. var TableHeader = defineComponent({
  24343. name: "ElTableHeader",
  24344. components: {
  24345. ElCheckbox
  24346. },
  24347. props: {
  24348. fixed: {
  24349. type: String,
  24350. default: ""
  24351. },
  24352. store: {
  24353. required: true,
  24354. type: Object
  24355. },
  24356. border: Boolean,
  24357. defaultSort: {
  24358. type: Object,
  24359. default: () => {
  24360. return {
  24361. prop: "",
  24362. order: ""
  24363. };
  24364. }
  24365. }
  24366. },
  24367. setup(props, { emit }) {
  24368. const instance = getCurrentInstance();
  24369. const parent = inject(TABLE_INJECTION_KEY);
  24370. const ns = useNamespace("table");
  24371. const filterPanels = ref({});
  24372. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  24373. onMounted(async () => {
  24374. await nextTick();
  24375. await nextTick();
  24376. const { prop, order: order2 } = props.defaultSort;
  24377. parent == null ? void 0 : parent.store.commit("sort", { prop, order: order2, init: true });
  24378. });
  24379. const {
  24380. handleHeaderClick,
  24381. handleHeaderContextMenu,
  24382. handleMouseDown,
  24383. handleMouseMove,
  24384. handleMouseOut,
  24385. handleSortClick,
  24386. handleFilterClick
  24387. } = useEvent(props, emit);
  24388. const {
  24389. getHeaderRowStyle,
  24390. getHeaderRowClass,
  24391. getHeaderCellStyle,
  24392. getHeaderCellClass
  24393. } = useStyle$2(props);
  24394. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  24395. instance.state = {
  24396. onColumnsChange,
  24397. onScrollableChange
  24398. };
  24399. instance.filterPanels = filterPanels;
  24400. return {
  24401. ns,
  24402. filterPanels,
  24403. onColumnsChange,
  24404. onScrollableChange,
  24405. columnRows,
  24406. getHeaderRowClass,
  24407. getHeaderRowStyle,
  24408. getHeaderCellClass,
  24409. getHeaderCellStyle,
  24410. handleHeaderClick,
  24411. handleHeaderContextMenu,
  24412. handleMouseDown,
  24413. handleMouseMove,
  24414. handleMouseOut,
  24415. handleSortClick,
  24416. handleFilterClick,
  24417. isGroup,
  24418. toggleAllSelection
  24419. };
  24420. },
  24421. render() {
  24422. const {
  24423. ns,
  24424. isGroup,
  24425. columnRows,
  24426. getHeaderCellStyle,
  24427. getHeaderCellClass,
  24428. getHeaderRowClass,
  24429. getHeaderRowStyle,
  24430. handleHeaderClick,
  24431. handleHeaderContextMenu,
  24432. handleMouseDown,
  24433. handleMouseMove,
  24434. handleSortClick,
  24435. handleMouseOut,
  24436. store,
  24437. $parent
  24438. } = this;
  24439. let rowSpan = 1;
  24440. return h$1("thead", {
  24441. class: { [ns.is("group")]: isGroup }
  24442. }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
  24443. class: getHeaderRowClass(rowIndex),
  24444. key: rowIndex,
  24445. style: getHeaderRowStyle(rowIndex)
  24446. }, subColumns.map((column, cellIndex) => {
  24447. if (column.rowSpan > rowSpan) {
  24448. rowSpan = column.rowSpan;
  24449. }
  24450. return h$1("th", {
  24451. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  24452. colspan: column.colSpan,
  24453. key: `${column.id}-thead`,
  24454. rowspan: column.rowSpan,
  24455. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  24456. onClick: ($event) => handleHeaderClick($event, column),
  24457. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  24458. onMousedown: ($event) => handleMouseDown($event, column),
  24459. onMousemove: ($event) => handleMouseMove($event, column),
  24460. onMouseout: handleMouseOut
  24461. }, [
  24462. h$1("div", {
  24463. class: [
  24464. "cell",
  24465. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : "",
  24466. column.labelClassName
  24467. ]
  24468. }, [
  24469. column.renderHeader ? column.renderHeader({
  24470. column,
  24471. $index: cellIndex,
  24472. store,
  24473. _self: $parent
  24474. }) : column.label,
  24475. column.sortable && h$1("span", {
  24476. onClick: ($event) => handleSortClick($event, column),
  24477. class: "caret-wrapper"
  24478. }, [
  24479. h$1("i", {
  24480. onClick: ($event) => handleSortClick($event, column, "ascending"),
  24481. class: "sort-caret ascending"
  24482. }),
  24483. h$1("i", {
  24484. onClick: ($event) => handleSortClick($event, column, "descending"),
  24485. class: "sort-caret descending"
  24486. })
  24487. ]),
  24488. column.filterable && h$1(FilterPanel, {
  24489. store,
  24490. placement: column.filterPlacement || "bottom-start",
  24491. column,
  24492. upDataColumn: (key, value) => {
  24493. column[key] = value;
  24494. }
  24495. })
  24496. ])
  24497. ]);
  24498. }))));
  24499. }
  24500. });
  24501. function useEvents(props) {
  24502. const parent = inject(TABLE_INJECTION_KEY);
  24503. const tooltipContent = ref("");
  24504. const tooltipTrigger = ref(h$1("div"));
  24505. const handleEvent = (event, row, name) => {
  24506. var _a2;
  24507. const table = parent;
  24508. const cell = getCell(event);
  24509. let column;
  24510. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  24511. if (cell) {
  24512. column = getColumnByCell({
  24513. columns: props.store.states.columns.value
  24514. }, cell, namespace);
  24515. if (column) {
  24516. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  24517. }
  24518. }
  24519. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  24520. };
  24521. const handleDoubleClick = (event, row) => {
  24522. handleEvent(event, row, "dblclick");
  24523. };
  24524. const handleClick = (event, row) => {
  24525. props.store.commit("setCurrentRow", row);
  24526. handleEvent(event, row, "click");
  24527. };
  24528. const handleContextMenu = (event, row) => {
  24529. handleEvent(event, row, "contextmenu");
  24530. };
  24531. const handleMouseEnter = debounce$1((index) => {
  24532. props.store.commit("setHoverRow", index);
  24533. }, 30);
  24534. const handleMouseLeave = debounce$1(() => {
  24535. props.store.commit("setHoverRow", null);
  24536. }, 30);
  24537. const handleCellMouseEnter = (event, row) => {
  24538. var _a2;
  24539. const table = parent;
  24540. const cell = getCell(event);
  24541. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  24542. if (cell) {
  24543. const column = getColumnByCell({
  24544. columns: props.store.states.columns.value
  24545. }, cell, namespace);
  24546. const hoverState = table.hoverState = { cell, column, row };
  24547. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  24548. }
  24549. const cellChild = event.target.querySelector(".cell");
  24550. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  24551. return;
  24552. }
  24553. const range3 = document.createRange();
  24554. range3.setStart(cellChild, 0);
  24555. range3.setEnd(cellChild, cellChild.childNodes.length);
  24556. const rangeWidth = range3.getBoundingClientRect().width;
  24557. const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0);
  24558. if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
  24559. createTablePopper(cell, cell.innerText || cell.textContent, {
  24560. placement: "top",
  24561. strategy: "fixed"
  24562. }, row.tooltipEffect);
  24563. }
  24564. };
  24565. const handleCellMouseLeave = (event) => {
  24566. const cell = getCell(event);
  24567. if (!cell)
  24568. return;
  24569. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  24570. 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);
  24571. };
  24572. return {
  24573. handleDoubleClick,
  24574. handleClick,
  24575. handleContextMenu,
  24576. handleMouseEnter,
  24577. handleMouseLeave,
  24578. handleCellMouseEnter,
  24579. handleCellMouseLeave,
  24580. tooltipContent,
  24581. tooltipTrigger
  24582. };
  24583. }
  24584. function useStyles(props) {
  24585. const parent = inject(TABLE_INJECTION_KEY);
  24586. const ns = useNamespace("table");
  24587. const getRowStyle = (row, rowIndex) => {
  24588. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  24589. if (typeof rowStyle === "function") {
  24590. return rowStyle.call(null, {
  24591. row,
  24592. rowIndex
  24593. });
  24594. }
  24595. return rowStyle || null;
  24596. };
  24597. const getRowClass = (row, rowIndex) => {
  24598. const classes = [ns.e("row")];
  24599. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  24600. classes.push("current-row");
  24601. }
  24602. if (props.stripe && rowIndex % 2 === 1) {
  24603. classes.push(ns.em("row", "striped"));
  24604. }
  24605. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  24606. if (typeof rowClassName === "string") {
  24607. classes.push(rowClassName);
  24608. } else if (typeof rowClassName === "function") {
  24609. classes.push(rowClassName.call(null, {
  24610. row,
  24611. rowIndex
  24612. }));
  24613. }
  24614. return classes;
  24615. };
  24616. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  24617. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  24618. let cellStyles = cellStyle != null ? cellStyle : {};
  24619. if (typeof cellStyle === "function") {
  24620. cellStyles = cellStyle.call(null, {
  24621. rowIndex,
  24622. columnIndex,
  24623. row,
  24624. column
  24625. });
  24626. }
  24627. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  24628. ensurePosition(fixedStyle, "left");
  24629. ensurePosition(fixedStyle, "right");
  24630. return Object.assign({}, cellStyles, fixedStyle);
  24631. };
  24632. const getCellClass = (rowIndex, columnIndex, row, column) => {
  24633. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store);
  24634. const classes = [column.id, column.align, column.className, ...fixedClasses];
  24635. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  24636. if (typeof cellClassName === "string") {
  24637. classes.push(cellClassName);
  24638. } else if (typeof cellClassName === "function") {
  24639. classes.push(cellClassName.call(null, {
  24640. rowIndex,
  24641. columnIndex,
  24642. row,
  24643. column
  24644. }));
  24645. }
  24646. classes.push(ns.e("cell"));
  24647. return classes.filter((className) => Boolean(className)).join(" ");
  24648. };
  24649. const getSpan = (row, column, rowIndex, columnIndex) => {
  24650. let rowspan = 1;
  24651. let colspan = 1;
  24652. const fn2 = parent == null ? void 0 : parent.props.spanMethod;
  24653. if (typeof fn2 === "function") {
  24654. const result = fn2({
  24655. row,
  24656. column,
  24657. rowIndex,
  24658. columnIndex
  24659. });
  24660. if (Array.isArray(result)) {
  24661. rowspan = result[0];
  24662. colspan = result[1];
  24663. } else if (typeof result === "object") {
  24664. rowspan = result.rowspan;
  24665. colspan = result.colspan;
  24666. }
  24667. }
  24668. return { rowspan, colspan };
  24669. };
  24670. const getColspanRealWidth = (columns, colspan, index) => {
  24671. if (colspan < 1) {
  24672. return columns[index].realWidth;
  24673. }
  24674. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  24675. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  24676. };
  24677. return {
  24678. getRowStyle,
  24679. getRowClass,
  24680. getCellStyle,
  24681. getCellClass,
  24682. getSpan,
  24683. getColspanRealWidth
  24684. };
  24685. }
  24686. function useRender$1(props) {
  24687. const parent = inject(TABLE_INJECTION_KEY);
  24688. const {
  24689. handleDoubleClick,
  24690. handleClick,
  24691. handleContextMenu,
  24692. handleMouseEnter,
  24693. handleMouseLeave,
  24694. handleCellMouseEnter,
  24695. handleCellMouseLeave,
  24696. tooltipContent,
  24697. tooltipTrigger
  24698. } = useEvents(props);
  24699. const {
  24700. getRowStyle,
  24701. getRowClass,
  24702. getCellStyle,
  24703. getCellClass,
  24704. getSpan,
  24705. getColspanRealWidth
  24706. } = useStyles(props);
  24707. const firstDefaultColumnIndex = computed(() => {
  24708. return props.store.states.columns.value.findIndex(({ type: type4 }) => type4 === "default");
  24709. });
  24710. const getKeyOfRow = (row, index) => {
  24711. const rowKey = parent.props.rowKey;
  24712. if (rowKey) {
  24713. return getRowIdentity(row, rowKey);
  24714. }
  24715. return index;
  24716. };
  24717. const rowRender = (row, $index, treeRowData, expanded = false) => {
  24718. const { tooltipEffect, store } = props;
  24719. const { indent, columns } = store.states;
  24720. const rowClasses = getRowClass(row, $index);
  24721. let display = true;
  24722. if (treeRowData) {
  24723. rowClasses.push(`el-table__row--level-${treeRowData.level}`);
  24724. display = treeRowData.display;
  24725. }
  24726. const displayStyle = display ? null : {
  24727. display: "none"
  24728. };
  24729. return h$1("tr", {
  24730. style: [displayStyle, getRowStyle(row, $index)],
  24731. class: rowClasses,
  24732. key: getKeyOfRow(row, $index),
  24733. onDblclick: ($event) => handleDoubleClick($event, row),
  24734. onClick: ($event) => handleClick($event, row),
  24735. onContextmenu: ($event) => handleContextMenu($event, row),
  24736. onMouseenter: () => handleMouseEnter($index),
  24737. onMouseleave: handleMouseLeave
  24738. }, columns.value.map((column, cellIndex) => {
  24739. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  24740. if (!rowspan || !colspan) {
  24741. return null;
  24742. }
  24743. const columnData = __spreadValues({}, column);
  24744. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  24745. const data2 = {
  24746. store: props.store,
  24747. _self: props.context || parent,
  24748. column: columnData,
  24749. row,
  24750. $index,
  24751. cellIndex,
  24752. expanded
  24753. };
  24754. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  24755. data2.treeNode = {
  24756. indent: treeRowData.level * indent.value,
  24757. level: treeRowData.level
  24758. };
  24759. if (typeof treeRowData.expanded === "boolean") {
  24760. data2.treeNode.expanded = treeRowData.expanded;
  24761. if ("loading" in treeRowData) {
  24762. data2.treeNode.loading = treeRowData.loading;
  24763. }
  24764. if ("noLazyChildren" in treeRowData) {
  24765. data2.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  24766. }
  24767. }
  24768. }
  24769. const baseKey = `${$index},${cellIndex}`;
  24770. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  24771. const tdChildren = cellChildren(cellIndex, column, data2);
  24772. return h$1("td", {
  24773. style: getCellStyle($index, cellIndex, row, column),
  24774. class: getCellClass($index, cellIndex, row, column),
  24775. key: `${patchKey}${baseKey}`,
  24776. rowspan,
  24777. colspan,
  24778. onMouseenter: ($event) => handleCellMouseEnter($event, __spreadProps(__spreadValues({}, row), { tooltipEffect })),
  24779. onMouseleave: handleCellMouseLeave
  24780. }, [tdChildren]);
  24781. }));
  24782. };
  24783. const cellChildren = (cellIndex, column, data2) => {
  24784. return column.renderCell(data2);
  24785. };
  24786. const wrappedRowRender = (row, $index) => {
  24787. const store = props.store;
  24788. const { isRowExpanded, assertRowKey } = store;
  24789. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  24790. const columns = store.states.columns.value;
  24791. const hasExpandColumn = columns.some(({ type: type4 }) => type4 === "expand");
  24792. if (hasExpandColumn) {
  24793. const expanded = isRowExpanded(row);
  24794. const tr = rowRender(row, $index, void 0, expanded);
  24795. const renderExpanded = parent.renderExpanded;
  24796. if (expanded) {
  24797. if (!renderExpanded) {
  24798. console.error("[Element Error]renderExpanded is required.");
  24799. return tr;
  24800. }
  24801. return [
  24802. [
  24803. tr,
  24804. h$1("tr", {
  24805. key: `expanded-row__${tr.key}`
  24806. }, [
  24807. h$1("td", {
  24808. colspan: columns.length,
  24809. class: "el-table__cell el-table__expanded-cell"
  24810. }, [renderExpanded({ row, $index, store, expanded })])
  24811. ])
  24812. ]
  24813. ];
  24814. } else {
  24815. return [[tr]];
  24816. }
  24817. } else if (Object.keys(treeData.value).length) {
  24818. assertRowKey();
  24819. const key = getRowIdentity(row, rowKey.value);
  24820. let cur = treeData.value[key];
  24821. let treeRowData = null;
  24822. if (cur) {
  24823. treeRowData = {
  24824. expanded: cur.expanded,
  24825. level: cur.level,
  24826. display: true
  24827. };
  24828. if (typeof cur.lazy === "boolean") {
  24829. if (typeof cur.loaded === "boolean" && cur.loaded) {
  24830. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  24831. }
  24832. treeRowData.loading = cur.loading;
  24833. }
  24834. }
  24835. const tmp = [rowRender(row, $index, treeRowData)];
  24836. if (cur) {
  24837. let i = 0;
  24838. const traverse = (children, parent2) => {
  24839. if (!(children && children.length && parent2))
  24840. return;
  24841. children.forEach((node) => {
  24842. const innerTreeRowData = {
  24843. display: parent2.display && parent2.expanded,
  24844. level: parent2.level + 1,
  24845. expanded: false,
  24846. noLazyChildren: false,
  24847. loading: false
  24848. };
  24849. const childKey = getRowIdentity(node, rowKey.value);
  24850. if (childKey === void 0 || childKey === null) {
  24851. throw new Error("For nested data item, row-key is required.");
  24852. }
  24853. cur = __spreadValues({}, treeData.value[childKey]);
  24854. if (cur) {
  24855. innerTreeRowData.expanded = cur.expanded;
  24856. cur.level = cur.level || innerTreeRowData.level;
  24857. cur.display = !!(cur.expanded && innerTreeRowData.display);
  24858. if (typeof cur.lazy === "boolean") {
  24859. if (typeof cur.loaded === "boolean" && cur.loaded) {
  24860. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  24861. }
  24862. innerTreeRowData.loading = cur.loading;
  24863. }
  24864. }
  24865. i++;
  24866. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  24867. if (cur) {
  24868. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  24869. traverse(nodes2, cur);
  24870. }
  24871. });
  24872. };
  24873. cur.display = true;
  24874. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  24875. traverse(nodes, cur);
  24876. }
  24877. return tmp;
  24878. } else {
  24879. return rowRender(row, $index, void 0);
  24880. }
  24881. };
  24882. return {
  24883. wrappedRowRender,
  24884. tooltipContent,
  24885. tooltipTrigger
  24886. };
  24887. }
  24888. const defaultProps$2 = {
  24889. store: {
  24890. required: true,
  24891. type: Object
  24892. },
  24893. stripe: Boolean,
  24894. tooltipEffect: String,
  24895. context: {
  24896. default: () => ({}),
  24897. type: Object
  24898. },
  24899. rowClassName: [String, Function],
  24900. rowStyle: [Object, Function],
  24901. fixed: {
  24902. type: String,
  24903. default: ""
  24904. },
  24905. highlight: Boolean
  24906. };
  24907. var TableBody = defineComponent({
  24908. name: "ElTableBody",
  24909. props: defaultProps$2,
  24910. setup(props) {
  24911. const instance = getCurrentInstance();
  24912. const parent = inject(TABLE_INJECTION_KEY);
  24913. const ns = useNamespace("table");
  24914. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  24915. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  24916. watch(props.store.states.hoverRow, (newVal, oldVal) => {
  24917. if (!props.store.states.isComplex.value || !isClient$1)
  24918. return;
  24919. let raf = window.requestAnimationFrame;
  24920. if (!raf) {
  24921. raf = (fn2) => window.setTimeout(fn2, 16);
  24922. }
  24923. raf(() => {
  24924. var _a2;
  24925. const rows = (_a2 = instance == null ? void 0 : instance.vnode.el) == null ? void 0 : _a2.querySelectorAll(`.${ns.e("row")}`);
  24926. const oldRow = rows[oldVal];
  24927. const newRow = rows[newVal];
  24928. if (oldRow) {
  24929. removeClass(oldRow, "hover-row");
  24930. }
  24931. if (newRow) {
  24932. addClass(newRow, "hover-row");
  24933. }
  24934. });
  24935. });
  24936. onUnmounted(() => {
  24937. var _a2;
  24938. (_a2 = removePopper) == null ? void 0 : _a2();
  24939. });
  24940. onUpdated(() => {
  24941. var _a2;
  24942. (_a2 = removePopper) == null ? void 0 : _a2();
  24943. });
  24944. return {
  24945. ns,
  24946. onColumnsChange,
  24947. onScrollableChange,
  24948. wrappedRowRender,
  24949. tooltipContent,
  24950. tooltipTrigger
  24951. };
  24952. },
  24953. render() {
  24954. const { wrappedRowRender, store } = this;
  24955. const data2 = store.states.data.value || [];
  24956. return h$1("tbody", {}, [
  24957. data2.reduce((acc, row) => {
  24958. return acc.concat(wrappedRowRender(row, acc.length));
  24959. }, [])
  24960. ]);
  24961. }
  24962. });
  24963. function hColgroup(props) {
  24964. const isAuto = props.tableLayout === "auto";
  24965. let columns = props.columns || [];
  24966. if (isAuto) {
  24967. if (columns.every((column) => column.width === void 0)) {
  24968. columns = [];
  24969. }
  24970. }
  24971. const getPropsData = (column) => {
  24972. const propsData = {
  24973. key: `${props.tableLayout}_${column.id}`,
  24974. style: {},
  24975. name: void 0
  24976. };
  24977. if (isAuto) {
  24978. propsData.style = {
  24979. width: `${column.width}px`
  24980. };
  24981. } else {
  24982. propsData.name = column.id;
  24983. }
  24984. return propsData;
  24985. };
  24986. return h$1("colgroup", {}, columns.map((column) => h$1("col", getPropsData(column))));
  24987. }
  24988. hColgroup.props = ["columns", "tableLayout"];
  24989. function useMapState() {
  24990. const table = inject(TABLE_INJECTION_KEY);
  24991. const store = table == null ? void 0 : table.store;
  24992. const leftFixedLeafCount = computed(() => {
  24993. return store.states.fixedLeafColumnsLength.value;
  24994. });
  24995. const rightFixedLeafCount = computed(() => {
  24996. return store.states.rightFixedColumns.value.length;
  24997. });
  24998. const columnsCount = computed(() => {
  24999. return store.states.columns.value.length;
  25000. });
  25001. const leftFixedCount = computed(() => {
  25002. return store.states.fixedColumns.value.length;
  25003. });
  25004. const rightFixedCount = computed(() => {
  25005. return store.states.rightFixedColumns.value.length;
  25006. });
  25007. return {
  25008. leftFixedLeafCount,
  25009. rightFixedLeafCount,
  25010. columnsCount,
  25011. leftFixedCount,
  25012. rightFixedCount,
  25013. columns: store.states.columns
  25014. };
  25015. }
  25016. function useStyle$1(props) {
  25017. const { columns } = useMapState();
  25018. const ns = useNamespace("table");
  25019. const getCellClasses = (columns2, cellIndex) => {
  25020. const column = columns2[cellIndex];
  25021. const classes = [
  25022. ns.e("cell"),
  25023. column.id,
  25024. column.align,
  25025. column.labelClassName,
  25026. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  25027. ];
  25028. if (column.className) {
  25029. classes.push(column.className);
  25030. }
  25031. if (!column.children) {
  25032. classes.push(ns.is("leaf"));
  25033. }
  25034. return classes;
  25035. };
  25036. const getCellStyles = (column, cellIndex) => {
  25037. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  25038. ensurePosition(fixedStyle, "left");
  25039. ensurePosition(fixedStyle, "right");
  25040. return fixedStyle;
  25041. };
  25042. return {
  25043. getCellClasses,
  25044. getCellStyles,
  25045. columns
  25046. };
  25047. }
  25048. var TableFooter = defineComponent({
  25049. name: "ElTableFooter",
  25050. props: {
  25051. fixed: {
  25052. type: String,
  25053. default: ""
  25054. },
  25055. store: {
  25056. required: true,
  25057. type: Object
  25058. },
  25059. summaryMethod: Function,
  25060. sumText: String,
  25061. border: Boolean,
  25062. defaultSort: {
  25063. type: Object,
  25064. default: () => {
  25065. return {
  25066. prop: "",
  25067. order: ""
  25068. };
  25069. }
  25070. }
  25071. },
  25072. setup(props) {
  25073. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  25074. const ns = useNamespace("table");
  25075. return {
  25076. ns,
  25077. getCellClasses,
  25078. getCellStyles,
  25079. columns
  25080. };
  25081. },
  25082. render() {
  25083. const {
  25084. columns,
  25085. getCellStyles,
  25086. getCellClasses,
  25087. summaryMethod,
  25088. sumText,
  25089. ns
  25090. } = this;
  25091. const data2 = this.store.states.data.value;
  25092. let sums = [];
  25093. if (summaryMethod) {
  25094. sums = summaryMethod({
  25095. columns,
  25096. data: data2
  25097. });
  25098. } else {
  25099. columns.forEach((column, index) => {
  25100. if (index === 0) {
  25101. sums[index] = sumText;
  25102. return;
  25103. }
  25104. const values = data2.map((item) => Number(item[column.property]));
  25105. const precisions = [];
  25106. let notNumber = true;
  25107. values.forEach((value) => {
  25108. if (!Number.isNaN(+value)) {
  25109. notNumber = false;
  25110. const decimal = `${value}`.split(".")[1];
  25111. precisions.push(decimal ? decimal.length : 0);
  25112. }
  25113. });
  25114. const precision = Math.max.apply(null, precisions);
  25115. if (!notNumber) {
  25116. sums[index] = values.reduce((prev, curr) => {
  25117. const value = Number(curr);
  25118. if (!Number.isNaN(+value)) {
  25119. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  25120. } else {
  25121. return prev;
  25122. }
  25123. }, 0);
  25124. } else {
  25125. sums[index] = "";
  25126. }
  25127. });
  25128. }
  25129. return h$1("table", {
  25130. class: ns.e("footer"),
  25131. cellspacing: "0",
  25132. cellpadding: "0",
  25133. border: "0"
  25134. }, [
  25135. hColgroup({
  25136. columns
  25137. }),
  25138. h$1("tbody", [
  25139. h$1("tr", {}, [
  25140. ...columns.map((column, cellIndex) => h$1("td", {
  25141. key: cellIndex,
  25142. colspan: column.colSpan,
  25143. rowspan: column.rowSpan,
  25144. class: getCellClasses(columns, cellIndex),
  25145. style: getCellStyles(column, cellIndex)
  25146. }, [
  25147. h$1("div", {
  25148. class: ["cell", column.labelClassName]
  25149. }, [sums[cellIndex]])
  25150. ]))
  25151. ])
  25152. ])
  25153. ]);
  25154. }
  25155. });
  25156. function useUtils(store) {
  25157. const setCurrentRow = (row) => {
  25158. store.commit("setCurrentRow", row);
  25159. };
  25160. const getSelectionRows = () => {
  25161. return store.getSelectionRows();
  25162. };
  25163. const toggleRowSelection = (row, selected) => {
  25164. store.toggleRowSelection(row, selected, false);
  25165. store.updateAllSelected();
  25166. };
  25167. const clearSelection = () => {
  25168. store.clearSelection();
  25169. };
  25170. const clearFilter = (columnKeys) => {
  25171. store.clearFilter(columnKeys);
  25172. };
  25173. const toggleAllSelection = () => {
  25174. store.commit("toggleAllSelection");
  25175. };
  25176. const toggleRowExpansion = (row, expanded) => {
  25177. store.toggleRowExpansionAdapter(row, expanded);
  25178. };
  25179. const clearSort = () => {
  25180. store.clearSort();
  25181. };
  25182. const sort = (prop, order2) => {
  25183. store.commit("sort", { prop, order: order2 });
  25184. };
  25185. return {
  25186. setCurrentRow,
  25187. getSelectionRows,
  25188. toggleRowSelection,
  25189. clearSelection,
  25190. clearFilter,
  25191. toggleAllSelection,
  25192. toggleRowExpansion,
  25193. clearSort,
  25194. sort
  25195. };
  25196. }
  25197. function useStyle(props, layout, store, table) {
  25198. const isHidden = ref(false);
  25199. const renderExpanded = ref(null);
  25200. const resizeProxyVisible = ref(false);
  25201. const setDragVisible = (visible) => {
  25202. resizeProxyVisible.value = visible;
  25203. };
  25204. const resizeState = ref({
  25205. width: null,
  25206. height: null
  25207. });
  25208. const isGroup = ref(false);
  25209. const scrollbarViewStyle = {
  25210. display: "inline-block",
  25211. verticalAlign: "middle"
  25212. };
  25213. const tableWidth = ref();
  25214. watchEffect(() => {
  25215. layout.setHeight(props.height);
  25216. });
  25217. watchEffect(() => {
  25218. layout.setMaxHeight(props.maxHeight);
  25219. });
  25220. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  25221. if (!unref(rowKey))
  25222. return;
  25223. store.setCurrentRowKey(`${currentRowKey}`);
  25224. }, {
  25225. immediate: true
  25226. });
  25227. watch(() => props.data, (data2) => {
  25228. table.store.commit("setData", data2);
  25229. }, {
  25230. immediate: true,
  25231. deep: true
  25232. });
  25233. watchEffect(() => {
  25234. if (props.expandRowKeys) {
  25235. store.setExpandRowKeysAdapter(props.expandRowKeys);
  25236. }
  25237. });
  25238. const handleMouseLeave = () => {
  25239. table.store.commit("setHoverRow", null);
  25240. if (table.hoverState)
  25241. table.hoverState = null;
  25242. };
  25243. const handleHeaderFooterMousewheel = (event, data2) => {
  25244. const { pixelX, pixelY } = data2;
  25245. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  25246. table.refs.bodyWrapper.scrollLeft += data2.pixelX / 5;
  25247. }
  25248. };
  25249. const shouldUpdateHeight = computed(() => {
  25250. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  25251. });
  25252. const tableBodyStyles = computed(() => {
  25253. return {
  25254. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  25255. };
  25256. });
  25257. const doLayout = () => {
  25258. if (shouldUpdateHeight.value) {
  25259. layout.updateElsHeight();
  25260. }
  25261. layout.updateColumnsWidth();
  25262. requestAnimationFrame(syncPostion);
  25263. };
  25264. onMounted(async () => {
  25265. await nextTick();
  25266. store.updateColumns();
  25267. bindEvents();
  25268. requestAnimationFrame(doLayout);
  25269. resizeState.value = {
  25270. width: tableWidth.value = table.vnode.el.offsetWidth,
  25271. height: table.vnode.el.offsetHeight
  25272. };
  25273. store.states.columns.value.forEach((column) => {
  25274. if (column.filteredValue && column.filteredValue.length) {
  25275. table.store.commit("filterChange", {
  25276. column,
  25277. values: column.filteredValue,
  25278. silent: true
  25279. });
  25280. }
  25281. });
  25282. table.$ready = true;
  25283. });
  25284. const setScrollClassByEl = (el, className) => {
  25285. if (!el)
  25286. return;
  25287. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  25288. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  25289. el.className = classList.join(" ");
  25290. };
  25291. const setScrollClass = (className) => {
  25292. const { tableWrapper } = table.refs;
  25293. setScrollClassByEl(tableWrapper, className);
  25294. };
  25295. const hasScrollClass = (className) => {
  25296. const { tableWrapper } = table.refs;
  25297. if (tableWrapper && tableWrapper.classList.contains(className)) {
  25298. return true;
  25299. }
  25300. return false;
  25301. };
  25302. const syncPostion = function() {
  25303. if (!table.refs.scrollBarRef)
  25304. return;
  25305. if (!layout.scrollX.value) {
  25306. const scrollingNoneClass = "is-scrolling-none";
  25307. if (!hasScrollClass(scrollingNoneClass)) {
  25308. setScrollClass(scrollingNoneClass);
  25309. }
  25310. return;
  25311. }
  25312. const scrollContainer = table.refs.scrollBarRef.wrap$;
  25313. if (!scrollContainer)
  25314. return;
  25315. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  25316. const { headerWrapper, footerWrapper } = table.refs;
  25317. if (headerWrapper)
  25318. headerWrapper.scrollLeft = scrollLeft;
  25319. if (footerWrapper)
  25320. footerWrapper.scrollLeft = scrollLeft;
  25321. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  25322. if (scrollLeft >= maxScrollLeftPosition) {
  25323. setScrollClass("is-scrolling-right");
  25324. } else if (scrollLeft === 0) {
  25325. setScrollClass("is-scrolling-left");
  25326. } else {
  25327. setScrollClass("is-scrolling-middle");
  25328. }
  25329. };
  25330. const bindEvents = () => {
  25331. var _a2;
  25332. if (!table.refs.scrollBarRef)
  25333. return;
  25334. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.addEventListener("scroll", syncPostion, {
  25335. passive: true
  25336. });
  25337. if (props.fit) {
  25338. addResizeListener(table.vnode.el, resizeListener);
  25339. } else {
  25340. on(window, "resize", doLayout);
  25341. }
  25342. };
  25343. onBeforeUnmount(() => {
  25344. unbindEvents();
  25345. });
  25346. const unbindEvents = () => {
  25347. var _a2;
  25348. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.removeEventListener("scroll", syncPostion, true);
  25349. if (props.fit) {
  25350. removeResizeListener(table.vnode.el, resizeListener);
  25351. } else {
  25352. off(window, "resize", doLayout);
  25353. }
  25354. };
  25355. const resizeListener = () => {
  25356. if (!table.$ready)
  25357. return;
  25358. let shouldUpdateLayout = false;
  25359. const el = table.vnode.el;
  25360. const { width: oldWidth, height: oldHeight } = resizeState.value;
  25361. const width = tableWidth.value = el.offsetWidth;
  25362. if (oldWidth !== width) {
  25363. shouldUpdateLayout = true;
  25364. }
  25365. const height2 = el.offsetHeight;
  25366. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height2) {
  25367. shouldUpdateLayout = true;
  25368. }
  25369. if (shouldUpdateLayout) {
  25370. resizeState.value = {
  25371. width,
  25372. height: height2
  25373. };
  25374. doLayout();
  25375. }
  25376. };
  25377. const tableSize = useSize();
  25378. const bodyWidth = computed(() => {
  25379. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  25380. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  25381. });
  25382. const tableLayout = computed(() => {
  25383. if (props.maxHeight)
  25384. return "fixed";
  25385. return props.tableLayout;
  25386. });
  25387. function calcMaxHeight(maxHeight, footerHeight, headerHeight) {
  25388. const parsedMaxHeight = parseHeight(maxHeight);
  25389. const tableHeaderHeight = props.showHeader ? headerHeight : 0;
  25390. if (parsedMaxHeight === null)
  25391. return;
  25392. if (isString(parsedMaxHeight)) {
  25393. return `calc(${parsedMaxHeight} - ${footerHeight}px - ${tableHeaderHeight}px)`;
  25394. }
  25395. return parsedMaxHeight - footerHeight - tableHeaderHeight;
  25396. }
  25397. const height = computed(() => {
  25398. const headerHeight = layout.headerHeight.value || 0;
  25399. const bodyHeight2 = layout.bodyHeight.value;
  25400. const footerHeight = layout.footerHeight.value || 0;
  25401. if (props.height) {
  25402. return bodyHeight2 ? bodyHeight2 : void 0;
  25403. } else if (props.maxHeight) {
  25404. return calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  25405. }
  25406. return void 0;
  25407. });
  25408. const bodyHeight = computed(() => {
  25409. const headerHeight = layout.headerHeight.value || 0;
  25410. const bodyHeight2 = layout.bodyHeight.value;
  25411. const footerHeight = layout.footerHeight.value || 0;
  25412. if (props.height) {
  25413. return {
  25414. height: bodyHeight2 ? `${bodyHeight2}px` : ""
  25415. };
  25416. } else if (props.maxHeight) {
  25417. const maxHeight = calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  25418. if (maxHeight !== null) {
  25419. return {
  25420. "max-height": `${maxHeight}${isNumber(maxHeight) ? "px" : ""}`
  25421. };
  25422. }
  25423. }
  25424. return {};
  25425. });
  25426. const emptyBlockStyle = computed(() => {
  25427. if (props.data && props.data.length)
  25428. return null;
  25429. let height2 = "100%";
  25430. if (layout.appendHeight.value) {
  25431. height2 = `calc(100% - ${layout.appendHeight.value}px)`;
  25432. }
  25433. return {
  25434. width: tableWidth.value ? `${tableWidth.value}px` : "",
  25435. height: height2
  25436. };
  25437. });
  25438. const handleFixedMousewheel = (event, data2) => {
  25439. const bodyWrapper = table.refs.bodyWrapper;
  25440. if (Math.abs(data2.spinY) > 0) {
  25441. const currentScrollTop = bodyWrapper.scrollTop;
  25442. if (data2.pixelY < 0 && currentScrollTop !== 0) {
  25443. event.preventDefault();
  25444. }
  25445. if (data2.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  25446. event.preventDefault();
  25447. }
  25448. bodyWrapper.scrollTop += Math.ceil(data2.pixelY / 5);
  25449. } else {
  25450. bodyWrapper.scrollLeft += Math.ceil(data2.pixelX / 5);
  25451. }
  25452. };
  25453. const fixedHeight = computed(() => {
  25454. if (props.maxHeight) {
  25455. if (props.showSummary) {
  25456. return {
  25457. bottom: 0
  25458. };
  25459. }
  25460. return {
  25461. bottom: layout.scrollX.value && props.data.length ? `${layout.gutterWidth}px` : ""
  25462. };
  25463. } else {
  25464. if (props.showSummary) {
  25465. return {
  25466. height: layout.tableHeight.value ? `${layout.tableHeight.value}px` : ""
  25467. };
  25468. }
  25469. return {
  25470. height: layout.viewportHeight.value ? `${layout.viewportHeight.value}px` : ""
  25471. };
  25472. }
  25473. });
  25474. const fixedBodyHeight = computed(() => {
  25475. if (props.height) {
  25476. return {
  25477. height: layout.fixedBodyHeight.value ? `${layout.fixedBodyHeight.value}px` : ""
  25478. };
  25479. } else if (props.maxHeight) {
  25480. let maxHeight = parseHeight(props.maxHeight);
  25481. if (typeof maxHeight === "number") {
  25482. maxHeight = layout.scrollX.value ? maxHeight - layout.gutterWidth : maxHeight;
  25483. if (props.showHeader) {
  25484. maxHeight -= layout.headerHeight.value;
  25485. }
  25486. maxHeight -= layout.footerHeight.value;
  25487. return {
  25488. "max-height": `${maxHeight}px`
  25489. };
  25490. }
  25491. }
  25492. return {};
  25493. });
  25494. return {
  25495. isHidden,
  25496. renderExpanded,
  25497. setDragVisible,
  25498. isGroup,
  25499. handleMouseLeave,
  25500. handleHeaderFooterMousewheel,
  25501. tableSize,
  25502. bodyHeight,
  25503. height,
  25504. emptyBlockStyle,
  25505. handleFixedMousewheel,
  25506. fixedHeight,
  25507. fixedBodyHeight,
  25508. resizeProxyVisible,
  25509. bodyWidth,
  25510. resizeState,
  25511. doLayout,
  25512. tableBodyStyles,
  25513. tableLayout,
  25514. scrollbarViewStyle
  25515. };
  25516. }
  25517. var defaultProps$1 = {
  25518. data: {
  25519. type: Array,
  25520. default: () => {
  25521. return [];
  25522. }
  25523. },
  25524. size: String,
  25525. width: [String, Number],
  25526. height: [String, Number],
  25527. maxHeight: [String, Number],
  25528. fit: {
  25529. type: Boolean,
  25530. default: true
  25531. },
  25532. stripe: Boolean,
  25533. border: Boolean,
  25534. rowKey: [String, Function],
  25535. showHeader: {
  25536. type: Boolean,
  25537. default: true
  25538. },
  25539. showSummary: Boolean,
  25540. sumText: String,
  25541. summaryMethod: Function,
  25542. rowClassName: [String, Function],
  25543. rowStyle: [Object, Function],
  25544. cellClassName: [String, Function],
  25545. cellStyle: [Object, Function],
  25546. headerRowClassName: [String, Function],
  25547. headerRowStyle: [Object, Function],
  25548. headerCellClassName: [String, Function],
  25549. headerCellStyle: [Object, Function],
  25550. highlightCurrentRow: Boolean,
  25551. currentRowKey: [String, Number],
  25552. emptyText: String,
  25553. expandRowKeys: Array,
  25554. defaultExpandAll: Boolean,
  25555. defaultSort: Object,
  25556. tooltipEffect: String,
  25557. spanMethod: Function,
  25558. selectOnIndeterminate: {
  25559. type: Boolean,
  25560. default: true
  25561. },
  25562. indent: {
  25563. type: Number,
  25564. default: 16
  25565. },
  25566. treeProps: {
  25567. type: Object,
  25568. default: () => {
  25569. return {
  25570. hasChildren: "hasChildren",
  25571. children: "children"
  25572. };
  25573. }
  25574. },
  25575. lazy: Boolean,
  25576. load: Function,
  25577. style: {
  25578. type: Object,
  25579. default: () => ({})
  25580. },
  25581. className: {
  25582. type: String,
  25583. default: ""
  25584. },
  25585. tableLayout: {
  25586. type: String,
  25587. default: "fixed"
  25588. },
  25589. scrollbarAlwaysOn: {
  25590. type: Boolean,
  25591. default: false
  25592. }
  25593. };
  25594. const useScrollbar = () => {
  25595. const scrollBarRef = ref();
  25596. const scrollTo = (options, yCoord) => {
  25597. const scrollbar = scrollBarRef.value;
  25598. if (scrollbar) {
  25599. scrollbar.scrollTo(options, yCoord);
  25600. }
  25601. };
  25602. const setScrollPosition = (position, offset2) => {
  25603. const scrollbar = scrollBarRef.value;
  25604. if (scrollbar && isNumber(offset2) && ["Top", "Left"].includes(position)) {
  25605. scrollbar[`setScroll${position}`](offset2);
  25606. }
  25607. };
  25608. const setScrollTop = (top2) => setScrollPosition("Top", top2);
  25609. const setScrollLeft = (left2) => setScrollPosition("Left", left2);
  25610. return {
  25611. scrollBarRef,
  25612. scrollTo,
  25613. setScrollTop,
  25614. setScrollLeft
  25615. };
  25616. };
  25617. let tableIdSeed = 1;
  25618. const _sfc_main$d = defineComponent({
  25619. name: "ElTable",
  25620. directives: {
  25621. Mousewheel
  25622. },
  25623. components: {
  25624. TableHeader,
  25625. TableBody,
  25626. TableFooter,
  25627. ElScrollbar,
  25628. hColgroup
  25629. },
  25630. props: defaultProps$1,
  25631. emits: [
  25632. "select",
  25633. "select-all",
  25634. "selection-change",
  25635. "cell-mouse-enter",
  25636. "cell-mouse-leave",
  25637. "cell-contextmenu",
  25638. "cell-click",
  25639. "cell-dblclick",
  25640. "row-click",
  25641. "row-contextmenu",
  25642. "row-dblclick",
  25643. "header-click",
  25644. "header-contextmenu",
  25645. "sort-change",
  25646. "filter-change",
  25647. "current-change",
  25648. "header-dragend",
  25649. "expand-change"
  25650. ],
  25651. setup(props) {
  25652. const { t } = useLocale();
  25653. const ns = useNamespace("table");
  25654. const table = getCurrentInstance();
  25655. provide(TABLE_INJECTION_KEY, table);
  25656. const store = createStore(table, props);
  25657. table.store = store;
  25658. const layout = new TableLayout({
  25659. store: table.store,
  25660. table,
  25661. fit: props.fit,
  25662. showHeader: props.showHeader
  25663. });
  25664. table.layout = layout;
  25665. const isEmpty3 = computed(() => (store.states.data.value || []).length === 0);
  25666. const {
  25667. setCurrentRow,
  25668. getSelectionRows,
  25669. toggleRowSelection,
  25670. clearSelection,
  25671. clearFilter,
  25672. toggleAllSelection,
  25673. toggleRowExpansion,
  25674. clearSort,
  25675. sort
  25676. } = useUtils(store);
  25677. const {
  25678. isHidden,
  25679. renderExpanded,
  25680. setDragVisible,
  25681. isGroup,
  25682. handleMouseLeave,
  25683. handleHeaderFooterMousewheel,
  25684. tableSize,
  25685. bodyHeight,
  25686. height,
  25687. emptyBlockStyle,
  25688. handleFixedMousewheel,
  25689. fixedHeight,
  25690. fixedBodyHeight,
  25691. resizeProxyVisible,
  25692. bodyWidth,
  25693. resizeState,
  25694. doLayout,
  25695. tableBodyStyles,
  25696. tableLayout,
  25697. scrollbarViewStyle
  25698. } = useStyle(props, layout, store, table);
  25699. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar();
  25700. const debouncedUpdateLayout = debounce$1(doLayout, 50);
  25701. const tableId = `el-table_${tableIdSeed++}`;
  25702. table.tableId = tableId;
  25703. table.state = {
  25704. isGroup,
  25705. resizeState,
  25706. doLayout,
  25707. debouncedUpdateLayout
  25708. };
  25709. const computedSumText = computed(() => props.sumText || t("el.table.sumText"));
  25710. const computedEmptyText = computed(() => {
  25711. return props.emptyText || t("el.table.emptyText");
  25712. });
  25713. return {
  25714. ns,
  25715. layout,
  25716. store,
  25717. handleHeaderFooterMousewheel,
  25718. handleMouseLeave,
  25719. tableId,
  25720. tableSize,
  25721. isHidden,
  25722. isEmpty: isEmpty3,
  25723. renderExpanded,
  25724. resizeProxyVisible,
  25725. resizeState,
  25726. isGroup,
  25727. bodyWidth,
  25728. bodyHeight,
  25729. height,
  25730. tableBodyStyles,
  25731. emptyBlockStyle,
  25732. debouncedUpdateLayout,
  25733. handleFixedMousewheel,
  25734. fixedHeight,
  25735. fixedBodyHeight,
  25736. setCurrentRow,
  25737. getSelectionRows,
  25738. toggleRowSelection,
  25739. clearSelection,
  25740. clearFilter,
  25741. toggleAllSelection,
  25742. toggleRowExpansion,
  25743. clearSort,
  25744. doLayout,
  25745. sort,
  25746. t,
  25747. setDragVisible,
  25748. context: table,
  25749. computedSumText,
  25750. computedEmptyText,
  25751. tableLayout,
  25752. scrollbarViewStyle,
  25753. scrollBarRef,
  25754. scrollTo,
  25755. setScrollLeft,
  25756. setScrollTop
  25757. };
  25758. }
  25759. });
  25760. const _hoisted_1$a = ["data-prefix"];
  25761. const _hoisted_2$8 = {
  25762. ref: "hiddenColumns",
  25763. class: "hidden-columns"
  25764. };
  25765. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  25766. const _component_hColgroup = resolveComponent("hColgroup");
  25767. const _component_table_header = resolveComponent("table-header");
  25768. const _component_table_body = resolveComponent("table-body");
  25769. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  25770. const _component_table_footer = resolveComponent("table-footer");
  25771. const _directive_mousewheel = resolveDirective("mousewheel");
  25772. return openBlock(), createElementBlock("div", {
  25773. ref: "tableWrapper",
  25774. class: normalizeClass([
  25775. {
  25776. [_ctx.ns.m("fit")]: _ctx.fit,
  25777. [_ctx.ns.m("striped")]: _ctx.stripe,
  25778. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  25779. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  25780. [_ctx.ns.m("group")]: _ctx.isGroup,
  25781. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  25782. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  25783. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  25784. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  25785. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  25786. "has-footer": _ctx.showSummary
  25787. },
  25788. _ctx.ns.m(_ctx.tableSize),
  25789. _ctx.className,
  25790. _ctx.ns.b(),
  25791. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  25792. ]),
  25793. style: normalizeStyle(_ctx.style),
  25794. "data-prefix": _ctx.ns.namespace.value,
  25795. onMouseleave: _cache[0] || (_cache[0] = ($event) => _ctx.handleMouseLeave())
  25796. }, [
  25797. createElementVNode("div", {
  25798. class: normalizeClass(_ctx.ns.e("inner-wrapper"))
  25799. }, [
  25800. createElementVNode("div", _hoisted_2$8, [
  25801. renderSlot(_ctx.$slots, "default")
  25802. ], 512),
  25803. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  25804. key: 0,
  25805. ref: "headerWrapper",
  25806. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  25807. }, [
  25808. createElementVNode("table", {
  25809. ref: "tableHeader",
  25810. class: normalizeClass(_ctx.ns.e("header")),
  25811. style: normalizeStyle(_ctx.tableBodyStyles),
  25812. border: "0",
  25813. cellpadding: "0",
  25814. cellspacing: "0"
  25815. }, [
  25816. createVNode(_component_hColgroup, {
  25817. columns: _ctx.store.states.columns.value,
  25818. "table-layout": _ctx.tableLayout
  25819. }, null, 8, ["columns", "table-layout"]),
  25820. createVNode(_component_table_header, {
  25821. ref: "tableHeaderRef",
  25822. border: _ctx.border,
  25823. "default-sort": _ctx.defaultSort,
  25824. store: _ctx.store,
  25825. onSetDragVisible: _ctx.setDragVisible
  25826. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  25827. ], 6)
  25828. ], 2)), [
  25829. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  25830. ]) : createCommentVNode("v-if", true),
  25831. createElementVNode("div", {
  25832. ref: "bodyWrapper",
  25833. style: normalizeStyle(_ctx.bodyHeight),
  25834. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  25835. }, [
  25836. createVNode(_component_el_scrollbar, {
  25837. ref: "scrollBarRef",
  25838. height: _ctx.maxHeight ? void 0 : _ctx.height,
  25839. "max-height": _ctx.maxHeight ? _ctx.height : void 0,
  25840. "view-style": _ctx.scrollbarViewStyle,
  25841. always: _ctx.scrollbarAlwaysOn
  25842. }, {
  25843. default: withCtx(() => [
  25844. createElementVNode("table", {
  25845. ref: "tableBody",
  25846. class: normalizeClass(_ctx.ns.e("body")),
  25847. cellspacing: "0",
  25848. cellpadding: "0",
  25849. border: "0",
  25850. style: normalizeStyle({
  25851. width: _ctx.bodyWidth,
  25852. tableLayout: _ctx.tableLayout
  25853. })
  25854. }, [
  25855. createVNode(_component_hColgroup, {
  25856. columns: _ctx.store.states.columns.value,
  25857. "table-layout": _ctx.tableLayout
  25858. }, null, 8, ["columns", "table-layout"]),
  25859. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  25860. key: 0,
  25861. border: _ctx.border,
  25862. "default-sort": _ctx.defaultSort,
  25863. store: _ctx.store,
  25864. onSetDragVisible: _ctx.setDragVisible
  25865. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : createCommentVNode("v-if", true),
  25866. createVNode(_component_table_body, {
  25867. context: _ctx.context,
  25868. highlight: _ctx.highlightCurrentRow,
  25869. "row-class-name": _ctx.rowClassName,
  25870. "tooltip-effect": _ctx.tooltipEffect,
  25871. "row-style": _ctx.rowStyle,
  25872. store: _ctx.store,
  25873. stripe: _ctx.stripe
  25874. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "row-style", "store", "stripe"])
  25875. ], 6),
  25876. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  25877. key: 0,
  25878. ref: "emptyBlock",
  25879. style: normalizeStyle(_ctx.emptyBlockStyle),
  25880. class: normalizeClass(_ctx.ns.e("empty-block"))
  25881. }, [
  25882. createElementVNode("span", {
  25883. class: normalizeClass(_ctx.ns.e("empty-text"))
  25884. }, [
  25885. renderSlot(_ctx.$slots, "empty", {}, () => [
  25886. createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
  25887. ])
  25888. ], 2)
  25889. ], 6)) : createCommentVNode("v-if", true),
  25890. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  25891. key: 1,
  25892. ref: "appendWrapper",
  25893. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  25894. }, [
  25895. renderSlot(_ctx.$slots, "append")
  25896. ], 2)) : createCommentVNode("v-if", true)
  25897. ]),
  25898. _: 3
  25899. }, 8, ["height", "max-height", "view-style", "always"])
  25900. ], 6),
  25901. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  25902. key: 1,
  25903. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  25904. }, null, 2)) : createCommentVNode("v-if", true)
  25905. ], 2),
  25906. _ctx.showSummary ? withDirectives((openBlock(), createElementBlock("div", {
  25907. key: 0,
  25908. ref: "footerWrapper",
  25909. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  25910. }, [
  25911. createVNode(_component_table_footer, {
  25912. border: _ctx.border,
  25913. "default-sort": _ctx.defaultSort,
  25914. store: _ctx.store,
  25915. style: normalizeStyle(_ctx.tableBodyStyles),
  25916. "sum-text": _ctx.computedSumText,
  25917. "summary-method": _ctx.summaryMethod
  25918. }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"])
  25919. ], 2)), [
  25920. [vShow, !_ctx.isEmpty],
  25921. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  25922. ]) : createCommentVNode("v-if", true),
  25923. withDirectives(createElementVNode("div", {
  25924. ref: "resizeProxy",
  25925. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  25926. }, null, 2), [
  25927. [vShow, _ctx.resizeProxyVisible]
  25928. ])
  25929. ], 46, _hoisted_1$a);
  25930. }
  25931. 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"]]);
  25932. const defaultClassNames = {
  25933. selection: "table-column--selection",
  25934. expand: "table__expand-column"
  25935. };
  25936. const cellStarts = {
  25937. default: {
  25938. order: ""
  25939. },
  25940. selection: {
  25941. width: 48,
  25942. minWidth: 48,
  25943. realWidth: 48,
  25944. order: ""
  25945. },
  25946. expand: {
  25947. width: 48,
  25948. minWidth: 48,
  25949. realWidth: 48,
  25950. order: ""
  25951. },
  25952. index: {
  25953. width: 48,
  25954. minWidth: 48,
  25955. realWidth: 48,
  25956. order: ""
  25957. }
  25958. };
  25959. const getDefaultClassName = (type4) => {
  25960. return defaultClassNames[type4] || "";
  25961. };
  25962. const cellForced = {
  25963. selection: {
  25964. renderHeader({ store }) {
  25965. function isDisabled() {
  25966. return store.states.data.value && store.states.data.value.length === 0;
  25967. }
  25968. return h$1(ElCheckbox, {
  25969. disabled: isDisabled(),
  25970. size: store.states.tableSize.value,
  25971. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  25972. "onUpdate:modelValue": store.toggleAllSelection,
  25973. modelValue: store.states.isAllSelected.value
  25974. });
  25975. },
  25976. renderCell({
  25977. row,
  25978. column,
  25979. store,
  25980. $index
  25981. }) {
  25982. return h$1(ElCheckbox, {
  25983. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  25984. size: store.states.tableSize.value,
  25985. onChange: () => {
  25986. store.commit("rowSelectedChanged", row);
  25987. },
  25988. onClick: (event) => event.stopPropagation(),
  25989. modelValue: store.isSelected(row)
  25990. });
  25991. },
  25992. sortable: false,
  25993. resizable: false
  25994. },
  25995. index: {
  25996. renderHeader({ column }) {
  25997. return column.label || "#";
  25998. },
  25999. renderCell({
  26000. column,
  26001. $index
  26002. }) {
  26003. let i = $index + 1;
  26004. const index = column.index;
  26005. if (typeof index === "number") {
  26006. i = $index + index;
  26007. } else if (typeof index === "function") {
  26008. i = index($index);
  26009. }
  26010. return h$1("div", {}, [i]);
  26011. },
  26012. sortable: false
  26013. },
  26014. expand: {
  26015. renderHeader({ column }) {
  26016. return column.label || "";
  26017. },
  26018. renderCell({
  26019. row,
  26020. store,
  26021. expanded
  26022. }) {
  26023. const { ns } = store;
  26024. const classes = [ns.e("expand-icon")];
  26025. if (expanded) {
  26026. classes.push(ns.em("expand-icon", "expanded"));
  26027. }
  26028. const callback = function(e) {
  26029. e.stopPropagation();
  26030. store.toggleRowExpansion(row);
  26031. };
  26032. return h$1("div", {
  26033. class: classes,
  26034. onClick: callback
  26035. }, {
  26036. default: () => {
  26037. return [
  26038. h$1(ElIcon, null, {
  26039. default: () => {
  26040. return [h$1(arrowRight)];
  26041. }
  26042. })
  26043. ];
  26044. }
  26045. });
  26046. },
  26047. sortable: false,
  26048. resizable: false
  26049. }
  26050. };
  26051. function defaultRenderCell({
  26052. row,
  26053. column,
  26054. $index
  26055. }) {
  26056. var _a2;
  26057. const property = column.property;
  26058. const value = property && getProp(row, property).value;
  26059. if (column && column.formatter) {
  26060. return column.formatter(row, column, value, $index);
  26061. }
  26062. return ((_a2 = value == null ? void 0 : value.toString) == null ? void 0 : _a2.call(value)) || "";
  26063. }
  26064. function treeCellPrefix({
  26065. row,
  26066. treeNode,
  26067. store
  26068. }, createPlacehoder = false) {
  26069. const { ns } = store;
  26070. if (!treeNode) {
  26071. if (createPlacehoder) {
  26072. return [
  26073. h$1("span", {
  26074. class: ns.e("placeholder")
  26075. })
  26076. ];
  26077. }
  26078. return null;
  26079. }
  26080. const ele = [];
  26081. const callback = function(e) {
  26082. e.stopPropagation();
  26083. store.loadOrToggle(row);
  26084. };
  26085. if (treeNode.indent) {
  26086. ele.push(h$1("span", {
  26087. class: ns.e("indent"),
  26088. style: { "padding-left": `${treeNode.indent}px` }
  26089. }));
  26090. }
  26091. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  26092. const expandClasses = [
  26093. ns.e("expand-icon"),
  26094. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  26095. ];
  26096. let icon = arrowRight;
  26097. if (treeNode.loading) {
  26098. icon = loading;
  26099. }
  26100. ele.push(h$1("div", {
  26101. class: expandClasses,
  26102. onClick: callback
  26103. }, {
  26104. default: () => {
  26105. return [
  26106. h$1(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  26107. default: () => [h$1(icon)]
  26108. })
  26109. ];
  26110. }
  26111. }));
  26112. } else {
  26113. ele.push(h$1("span", {
  26114. class: ns.e("placeholder")
  26115. }));
  26116. }
  26117. return ele;
  26118. }
  26119. function getAllAliases(props, aliases) {
  26120. return props.reduce((prev, cur) => {
  26121. prev[cur] = cur;
  26122. return prev;
  26123. }, aliases);
  26124. }
  26125. function useWatcher(owner, props_) {
  26126. const instance = getCurrentInstance();
  26127. const registerComplexWatchers = () => {
  26128. const props = ["fixed"];
  26129. const aliases = {
  26130. realWidth: "width",
  26131. realMinWidth: "minWidth"
  26132. };
  26133. const allAliases = getAllAliases(props, aliases);
  26134. Object.keys(allAliases).forEach((key) => {
  26135. const columnKey = aliases[key];
  26136. if (hasOwn(props_, columnKey)) {
  26137. watch(() => props_[columnKey], (newVal) => {
  26138. let value = newVal;
  26139. if (columnKey === "width" && key === "realWidth") {
  26140. value = parseWidth(newVal);
  26141. }
  26142. if (columnKey === "minWidth" && key === "realMinWidth") {
  26143. value = parseMinWidth(newVal);
  26144. }
  26145. instance.columnConfig.value[columnKey] = value;
  26146. instance.columnConfig.value[key] = value;
  26147. const updateColumns = columnKey === "fixed";
  26148. owner.value.store.scheduleLayout(updateColumns);
  26149. });
  26150. }
  26151. });
  26152. };
  26153. const registerNormalWatchers = () => {
  26154. const props = [
  26155. "label",
  26156. "filters",
  26157. "filterMultiple",
  26158. "sortable",
  26159. "index",
  26160. "formatter",
  26161. "className",
  26162. "labelClassName",
  26163. "showOverflowTooltip"
  26164. ];
  26165. const aliases = {
  26166. property: "prop",
  26167. align: "realAlign",
  26168. headerAlign: "realHeaderAlign"
  26169. };
  26170. const allAliases = getAllAliases(props, aliases);
  26171. Object.keys(allAliases).forEach((key) => {
  26172. const columnKey = aliases[key];
  26173. if (hasOwn(props_, columnKey)) {
  26174. watch(() => props_[columnKey], (newVal) => {
  26175. instance.columnConfig.value[key] = newVal;
  26176. });
  26177. }
  26178. });
  26179. };
  26180. return {
  26181. registerComplexWatchers,
  26182. registerNormalWatchers
  26183. };
  26184. }
  26185. function useRender(props, slots, owner) {
  26186. const instance = getCurrentInstance();
  26187. const columnId = ref("");
  26188. const isSubColumn = ref(false);
  26189. const realAlign = ref();
  26190. const realHeaderAlign = ref();
  26191. const ns = useNamespace("table");
  26192. watchEffect(() => {
  26193. realAlign.value = props.align ? `is-${props.align}` : null;
  26194. realAlign.value;
  26195. });
  26196. watchEffect(() => {
  26197. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  26198. realHeaderAlign.value;
  26199. });
  26200. const columnOrTableParent = computed(() => {
  26201. let parent = instance.vnode.vParent || instance.parent;
  26202. while (parent && !parent.tableId && !parent.columnId) {
  26203. parent = parent.vnode.vParent || parent.parent;
  26204. }
  26205. return parent;
  26206. });
  26207. const hasTreeColumn = computed(() => {
  26208. const { store } = instance.parent;
  26209. if (!store)
  26210. return false;
  26211. const { treeData } = store.states;
  26212. const treeDataValue = treeData.value;
  26213. return treeDataValue && Object.keys(treeDataValue).length > 0;
  26214. });
  26215. const realWidth = ref(parseWidth(props.width));
  26216. const realMinWidth = ref(parseMinWidth(props.minWidth));
  26217. const setColumnWidth = (column) => {
  26218. if (realWidth.value)
  26219. column.width = realWidth.value;
  26220. if (realMinWidth.value) {
  26221. column.minWidth = realMinWidth.value;
  26222. }
  26223. if (!column.minWidth) {
  26224. column.minWidth = 80;
  26225. }
  26226. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  26227. return column;
  26228. };
  26229. const setColumnForcedProps = (column) => {
  26230. const type4 = column.type;
  26231. const source = cellForced[type4] || {};
  26232. Object.keys(source).forEach((prop) => {
  26233. const value = source[prop];
  26234. if (prop !== "className" && value !== void 0) {
  26235. column[prop] = value;
  26236. }
  26237. });
  26238. const className = getDefaultClassName(type4);
  26239. if (className) {
  26240. const forceClass = `${unref(ns.namespace)}-${className}`;
  26241. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  26242. }
  26243. return column;
  26244. };
  26245. const checkSubColumn = (children) => {
  26246. if (Array.isArray(children)) {
  26247. children.forEach((child) => check2(child));
  26248. } else {
  26249. check2(children);
  26250. }
  26251. function check2(item) {
  26252. var _a2;
  26253. if (((_a2 = item == null ? void 0 : item.type) == null ? void 0 : _a2.name) === "ElTableColumn") {
  26254. item.vParent = instance;
  26255. }
  26256. }
  26257. };
  26258. const setColumnRenders = (column) => {
  26259. if (props.renderHeader)
  26260. ;
  26261. else if (column.type !== "selection") {
  26262. column.renderHeader = (scope) => {
  26263. instance.columnConfig.value["label"];
  26264. const renderHeader = slots.header;
  26265. return renderHeader ? renderHeader(scope) : column.label;
  26266. };
  26267. }
  26268. let originRenderCell = column.renderCell;
  26269. const hasTreeColumnValue = hasTreeColumn.value;
  26270. if (column.type === "expand") {
  26271. column.renderCell = (data2) => h$1("div", {
  26272. class: "cell"
  26273. }, [originRenderCell(data2)]);
  26274. owner.value.renderExpanded = (data2) => {
  26275. return slots.default ? slots.default(data2) : slots.default;
  26276. };
  26277. } else {
  26278. originRenderCell = originRenderCell || defaultRenderCell;
  26279. column.renderCell = (data2) => {
  26280. let children = null;
  26281. if (slots.default) {
  26282. const vnodes = slots.default(data2);
  26283. children = vnodes.some((v2) => v2.type !== Comment) ? vnodes : originRenderCell(data2);
  26284. } else {
  26285. children = originRenderCell(data2);
  26286. }
  26287. const shouldCreatePlaceholder = hasTreeColumnValue && data2.cellIndex === 0;
  26288. const prefix = treeCellPrefix(data2, shouldCreatePlaceholder);
  26289. const props2 = {
  26290. class: "cell",
  26291. style: {}
  26292. };
  26293. if (column.showOverflowTooltip) {
  26294. props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
  26295. props2.style = {
  26296. width: `${(data2.column.realWidth || Number(data2.column.width)) - 1}px`
  26297. };
  26298. }
  26299. checkSubColumn(children);
  26300. return h$1("div", props2, [prefix, children]);
  26301. };
  26302. }
  26303. return column;
  26304. };
  26305. const getPropsData = (...propsKey) => {
  26306. return propsKey.reduce((prev, cur) => {
  26307. if (Array.isArray(cur)) {
  26308. cur.forEach((key) => {
  26309. prev[key] = props[key];
  26310. });
  26311. }
  26312. return prev;
  26313. }, {});
  26314. };
  26315. const getColumnElIndex = (children, child) => {
  26316. return Array.prototype.indexOf.call(children, child);
  26317. };
  26318. return {
  26319. columnId,
  26320. realAlign,
  26321. isSubColumn,
  26322. realHeaderAlign,
  26323. columnOrTableParent,
  26324. setColumnWidth,
  26325. setColumnForcedProps,
  26326. setColumnRenders,
  26327. getPropsData,
  26328. getColumnElIndex
  26329. };
  26330. }
  26331. var defaultProps = {
  26332. type: {
  26333. type: String,
  26334. default: "default"
  26335. },
  26336. label: String,
  26337. className: String,
  26338. labelClassName: String,
  26339. property: String,
  26340. prop: String,
  26341. width: {
  26342. type: [String, Number],
  26343. default: ""
  26344. },
  26345. minWidth: {
  26346. type: [String, Number],
  26347. default: ""
  26348. },
  26349. renderHeader: Function,
  26350. sortable: {
  26351. type: [Boolean, String],
  26352. default: false
  26353. },
  26354. sortMethod: Function,
  26355. sortBy: [String, Function, Array],
  26356. resizable: {
  26357. type: Boolean,
  26358. default: true
  26359. },
  26360. columnKey: String,
  26361. align: String,
  26362. headerAlign: String,
  26363. showTooltipWhenOverflow: Boolean,
  26364. showOverflowTooltip: Boolean,
  26365. fixed: [Boolean, String],
  26366. formatter: Function,
  26367. selectable: Function,
  26368. reserveSelection: Boolean,
  26369. filterMethod: Function,
  26370. filteredValue: Array,
  26371. filters: Array,
  26372. filterPlacement: String,
  26373. filterMultiple: {
  26374. type: Boolean,
  26375. default: true
  26376. },
  26377. index: [Number, Function],
  26378. sortOrders: {
  26379. type: Array,
  26380. default: () => {
  26381. return ["ascending", "descending", null];
  26382. },
  26383. validator: (val) => {
  26384. return val.every((order2) => ["ascending", "descending", null].includes(order2));
  26385. }
  26386. }
  26387. };
  26388. let columnIdSeed = 1;
  26389. var ElTableColumn$1 = defineComponent({
  26390. name: "ElTableColumn",
  26391. components: {
  26392. ElCheckbox
  26393. },
  26394. props: defaultProps,
  26395. setup(props, { slots }) {
  26396. const instance = getCurrentInstance();
  26397. const columnConfig = ref({});
  26398. const owner = computed(() => {
  26399. let parent2 = instance.parent;
  26400. while (parent2 && !parent2.tableId) {
  26401. parent2 = parent2.parent;
  26402. }
  26403. return parent2;
  26404. });
  26405. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  26406. const {
  26407. columnId,
  26408. isSubColumn,
  26409. realHeaderAlign,
  26410. columnOrTableParent,
  26411. setColumnWidth,
  26412. setColumnForcedProps,
  26413. setColumnRenders,
  26414. getPropsData,
  26415. getColumnElIndex,
  26416. realAlign
  26417. } = useRender(props, slots, owner);
  26418. const parent = columnOrTableParent.value;
  26419. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  26420. onBeforeMount(() => {
  26421. isSubColumn.value = owner.value !== parent;
  26422. const type4 = props.type || "default";
  26423. const sortable = props.sortable === "" ? true : props.sortable;
  26424. const defaults = __spreadProps(__spreadValues({}, cellStarts[type4]), {
  26425. id: columnId.value,
  26426. type: type4,
  26427. property: props.prop || props.property,
  26428. align: realAlign,
  26429. headerAlign: realHeaderAlign,
  26430. showOverflowTooltip: props.showOverflowTooltip || props.showTooltipWhenOverflow,
  26431. filterable: props.filters || props.filterMethod,
  26432. filteredValue: [],
  26433. filterPlacement: "",
  26434. isColumnGroup: false,
  26435. isSubColumn: false,
  26436. filterOpened: false,
  26437. sortable,
  26438. index: props.index,
  26439. rawColumnKey: instance.vnode.key
  26440. });
  26441. const basicProps = [
  26442. "columnKey",
  26443. "label",
  26444. "className",
  26445. "labelClassName",
  26446. "type",
  26447. "renderHeader",
  26448. "formatter",
  26449. "fixed",
  26450. "resizable"
  26451. ];
  26452. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  26453. const selectProps = ["selectable", "reserveSelection"];
  26454. const filterProps = [
  26455. "filterMethod",
  26456. "filters",
  26457. "filterMultiple",
  26458. "filterOpened",
  26459. "filteredValue",
  26460. "filterPlacement"
  26461. ];
  26462. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  26463. column = mergeOptions(defaults, column);
  26464. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  26465. column = chains(column);
  26466. columnConfig.value = column;
  26467. registerNormalWatchers();
  26468. registerComplexWatchers();
  26469. });
  26470. onMounted(() => {
  26471. var _a2;
  26472. const parent2 = columnOrTableParent.value;
  26473. const children = isSubColumn.value ? parent2.vnode.el.children : (_a2 = parent2.refs.hiddenColumns) == null ? void 0 : _a2.children;
  26474. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  26475. columnConfig.value.getColumnIndex = getColumnIndex;
  26476. const columnIndex = getColumnIndex();
  26477. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null);
  26478. });
  26479. onBeforeUnmount(() => {
  26480. owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null);
  26481. });
  26482. instance.columnId = columnId.value;
  26483. instance.columnConfig = columnConfig;
  26484. return;
  26485. },
  26486. render() {
  26487. var _a2, _b2, _c;
  26488. try {
  26489. const renderDefault = (_b2 = (_a2 = this.$slots).default) == null ? void 0 : _b2.call(_a2, {
  26490. row: {},
  26491. column: {},
  26492. $index: -1
  26493. });
  26494. const children = [];
  26495. if (Array.isArray(renderDefault)) {
  26496. for (const childNode of renderDefault) {
  26497. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  26498. children.push(childNode);
  26499. } else if (childNode.type === Fragment && Array.isArray(childNode.children)) {
  26500. childNode.children.forEach((vnode2) => {
  26501. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) {
  26502. children.push(vnode2);
  26503. }
  26504. });
  26505. }
  26506. }
  26507. }
  26508. const vnode = h$1("div", children);
  26509. return vnode;
  26510. } catch (e) {
  26511. return h$1("div", []);
  26512. }
  26513. }
  26514. });
  26515. const ElTable = withInstall(Table, {
  26516. TableColumn: ElTableColumn$1
  26517. });
  26518. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  26519. const SCOPE$1 = "ElUpload";
  26520. class UploadAjaxError extends Error {
  26521. constructor(message, status, method4, url2) {
  26522. super(message);
  26523. this.name = "UploadAjaxError";
  26524. this.status = status;
  26525. this.method = method4;
  26526. this.url = url2;
  26527. }
  26528. }
  26529. function getError(action, option, xhr) {
  26530. let msg;
  26531. if (xhr.response) {
  26532. msg = `${xhr.response.error || xhr.response}`;
  26533. } else if (xhr.responseText) {
  26534. msg = `${xhr.responseText}`;
  26535. } else {
  26536. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  26537. }
  26538. return new UploadAjaxError(msg, xhr.status, option.method, action);
  26539. }
  26540. function getBody(xhr) {
  26541. const text = xhr.responseText || xhr.response;
  26542. if (!text) {
  26543. return text;
  26544. }
  26545. try {
  26546. return JSON.parse(text);
  26547. } catch (e) {
  26548. return text;
  26549. }
  26550. }
  26551. const ajaxUpload = (option) => {
  26552. if (typeof XMLHttpRequest === "undefined")
  26553. throwError(SCOPE$1, "XMLHttpRequest is undefined");
  26554. const xhr = new XMLHttpRequest();
  26555. const action = option.action;
  26556. if (xhr.upload) {
  26557. xhr.upload.addEventListener("progress", (evt) => {
  26558. const progressEvt = evt;
  26559. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  26560. option.onProgress(progressEvt);
  26561. });
  26562. }
  26563. const formData = new FormData();
  26564. if (option.data) {
  26565. for (const [key, value] of Object.entries(option.data)) {
  26566. if (Array.isArray(value))
  26567. formData.append(key, ...value);
  26568. else
  26569. formData.append(key, value);
  26570. }
  26571. }
  26572. formData.append(option.filename, option.file, option.file.name);
  26573. xhr.addEventListener("error", () => {
  26574. option.onError(getError(action, option, xhr));
  26575. });
  26576. xhr.addEventListener("load", () => {
  26577. if (xhr.status < 200 || xhr.status >= 300) {
  26578. return option.onError(getError(action, option, xhr));
  26579. }
  26580. option.onSuccess(getBody(xhr));
  26581. });
  26582. xhr.open(option.method, action, true);
  26583. if (option.withCredentials && "withCredentials" in xhr) {
  26584. xhr.withCredentials = true;
  26585. }
  26586. const headers = option.headers || {};
  26587. if (headers instanceof Headers) {
  26588. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  26589. } else {
  26590. for (const [key, value] of Object.entries(headers)) {
  26591. if (isNil(value))
  26592. continue;
  26593. xhr.setRequestHeader(key, String(value));
  26594. }
  26595. }
  26596. xhr.send(formData);
  26597. return xhr;
  26598. };
  26599. const uploadListTypes = ["text", "picture", "picture-card"];
  26600. let fileId = 1;
  26601. const genFileId = () => Date.now() + fileId++;
  26602. const uploadBaseProps = buildProps({
  26603. action: {
  26604. type: String,
  26605. required: true
  26606. },
  26607. headers: {
  26608. type: definePropType(Object)
  26609. },
  26610. method: {
  26611. type: String,
  26612. default: "post"
  26613. },
  26614. data: {
  26615. type: Object,
  26616. default: () => mutable({})
  26617. },
  26618. multiple: {
  26619. type: Boolean,
  26620. default: false
  26621. },
  26622. name: {
  26623. type: String,
  26624. default: "file"
  26625. },
  26626. drag: {
  26627. type: Boolean,
  26628. default: false
  26629. },
  26630. withCredentials: Boolean,
  26631. showFileList: {
  26632. type: Boolean,
  26633. default: true
  26634. },
  26635. accept: {
  26636. type: String,
  26637. default: ""
  26638. },
  26639. type: {
  26640. type: String,
  26641. default: "select"
  26642. },
  26643. fileList: {
  26644. type: definePropType(Array),
  26645. default: () => mutable([])
  26646. },
  26647. autoUpload: {
  26648. type: Boolean,
  26649. default: true
  26650. },
  26651. listType: {
  26652. type: String,
  26653. values: uploadListTypes,
  26654. default: "text"
  26655. },
  26656. httpRequest: {
  26657. type: definePropType(Function),
  26658. default: ajaxUpload
  26659. },
  26660. disabled: Boolean,
  26661. limit: Number
  26662. });
  26663. const uploadProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  26664. beforeUpload: {
  26665. type: definePropType(Function),
  26666. default: NOOP
  26667. },
  26668. beforeRemove: {
  26669. type: definePropType(Function)
  26670. },
  26671. onRemove: {
  26672. type: definePropType(Function),
  26673. default: NOOP
  26674. },
  26675. onChange: {
  26676. type: definePropType(Function),
  26677. default: NOOP
  26678. },
  26679. onPreview: {
  26680. type: definePropType(Function),
  26681. default: NOOP
  26682. },
  26683. onSuccess: {
  26684. type: definePropType(Function),
  26685. default: NOOP
  26686. },
  26687. onProgress: {
  26688. type: definePropType(Function),
  26689. default: NOOP
  26690. },
  26691. onError: {
  26692. type: definePropType(Function),
  26693. default: NOOP
  26694. },
  26695. onExceed: {
  26696. type: definePropType(Function),
  26697. default: NOOP
  26698. }
  26699. }));
  26700. const uploadListProps = buildProps({
  26701. files: {
  26702. type: definePropType(Array),
  26703. default: () => mutable([])
  26704. },
  26705. disabled: {
  26706. type: Boolean,
  26707. default: false
  26708. },
  26709. handlePreview: {
  26710. type: definePropType(Function),
  26711. default: NOOP
  26712. },
  26713. listType: {
  26714. type: String,
  26715. values: uploadListTypes,
  26716. default: "text"
  26717. }
  26718. });
  26719. const uploadListEmits = {
  26720. remove: (file) => !!file
  26721. };
  26722. const _hoisted_1$9 = ["onKeydown"];
  26723. const _hoisted_2$7 = ["src"];
  26724. const _hoisted_3$5 = ["onClick"];
  26725. const _hoisted_4$5 = ["onClick"];
  26726. const _hoisted_5$5 = ["onClick"];
  26727. const __default__$4 = {
  26728. name: "ElUploadList"
  26729. };
  26730. const _sfc_main$c = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
  26731. props: uploadListProps,
  26732. emits: uploadListEmits,
  26733. setup(__props, { emit }) {
  26734. const props = __props;
  26735. const { t } = useLocale();
  26736. const nsUpload = useNamespace("upload");
  26737. const nsIcon = useNamespace("icon");
  26738. const nsList = useNamespace("list");
  26739. const focusing = ref(false);
  26740. const handleClick = (file) => {
  26741. props.handlePreview(file);
  26742. };
  26743. const onFileClicked = (e) => {
  26744. e.target.focus();
  26745. };
  26746. const handleRemove = (file) => {
  26747. emit("remove", file);
  26748. };
  26749. return (_ctx, _cache) => {
  26750. return openBlock(), createBlock(TransitionGroup, {
  26751. tag: "ul",
  26752. class: normalizeClass([
  26753. unref(nsUpload).b("list"),
  26754. unref(nsUpload).bm("list", _ctx.listType),
  26755. unref(nsUpload).is("disabled", _ctx.disabled)
  26756. ]),
  26757. name: unref(nsList).b()
  26758. }, {
  26759. default: withCtx(() => [
  26760. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file) => {
  26761. return openBlock(), createElementBlock("li", {
  26762. key: file.uid || file.name,
  26763. class: normalizeClass([
  26764. unref(nsUpload).be("list", "item"),
  26765. unref(nsUpload).is(file.status),
  26766. { focusing: focusing.value }
  26767. ]),
  26768. tabindex: "0",
  26769. onKeydown: withKeys(($event) => !_ctx.disabled && handleRemove(file), ["delete"]),
  26770. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  26771. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  26772. onClick: onFileClicked
  26773. }, [
  26774. renderSlot(_ctx.$slots, "default", { file }, () => [
  26775. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  26776. key: 0,
  26777. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  26778. src: file.url,
  26779. alt: ""
  26780. }, null, 10, _hoisted_2$7)) : createCommentVNode("v-if", true),
  26781. _ctx.listType !== "picture" && (file.status === "uploading" || _ctx.listType !== "picture-card") ? (openBlock(), createElementBlock("div", {
  26782. key: 1,
  26783. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  26784. }, [
  26785. createElementVNode("a", {
  26786. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  26787. onClick: ($event) => handleClick(file)
  26788. }, [
  26789. createVNode(unref(ElIcon), {
  26790. class: normalizeClass(unref(nsIcon).m("document"))
  26791. }, {
  26792. default: withCtx(() => [
  26793. createVNode(unref(document$1))
  26794. ]),
  26795. _: 1
  26796. }, 8, ["class"]),
  26797. createTextVNode(" " + toDisplayString(file.name), 1)
  26798. ], 10, _hoisted_3$5),
  26799. file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  26800. key: 0,
  26801. type: _ctx.listType === "picture-card" ? "circle" : "line",
  26802. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  26803. percentage: Number(file.percentage),
  26804. style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  26805. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
  26806. ], 2)) : createCommentVNode("v-if", true),
  26807. createElementVNode("label", {
  26808. class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
  26809. }, [
  26810. _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  26811. key: 0,
  26812. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  26813. }, {
  26814. default: withCtx(() => [
  26815. createVNode(unref(circleCheck))
  26816. ]),
  26817. _: 1
  26818. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  26819. key: 1,
  26820. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  26821. }, {
  26822. default: withCtx(() => [
  26823. createVNode(unref(check))
  26824. ]),
  26825. _: 1
  26826. }, 8, ["class"])) : createCommentVNode("v-if", true)
  26827. ], 2),
  26828. !_ctx.disabled ? (openBlock(), createBlock(unref(ElIcon), {
  26829. key: 2,
  26830. class: normalizeClass(unref(nsIcon).m("close")),
  26831. onClick: ($event) => handleRemove(file)
  26832. }, {
  26833. default: withCtx(() => [
  26834. createVNode(unref(close))
  26835. ]),
  26836. _: 2
  26837. }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
  26838. createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  26839. createCommentVNode(" This is a bug which needs to be fixed "),
  26840. createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  26841. !_ctx.disabled ? (openBlock(), createElementBlock("i", {
  26842. key: 3,
  26843. class: normalizeClass(unref(nsIcon).m("close-tip"))
  26844. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  26845. _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  26846. key: 4,
  26847. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  26848. }, [
  26849. createElementVNode("span", {
  26850. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  26851. onClick: ($event) => _ctx.handlePreview(file)
  26852. }, [
  26853. createVNode(unref(ElIcon), {
  26854. class: normalizeClass(unref(nsIcon).m("zoom-in"))
  26855. }, {
  26856. default: withCtx(() => [
  26857. createVNode(unref(zoomIn))
  26858. ]),
  26859. _: 1
  26860. }, 8, ["class"])
  26861. ], 10, _hoisted_4$5),
  26862. !_ctx.disabled ? (openBlock(), createElementBlock("span", {
  26863. key: 0,
  26864. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  26865. onClick: ($event) => handleRemove(file)
  26866. }, [
  26867. createVNode(unref(ElIcon), {
  26868. class: normalizeClass(unref(nsIcon).m("delete"))
  26869. }, {
  26870. default: withCtx(() => [
  26871. createVNode(unref(_delete))
  26872. ]),
  26873. _: 1
  26874. }, 8, ["class"])
  26875. ], 10, _hoisted_5$5)) : createCommentVNode("v-if", true)
  26876. ], 2)) : createCommentVNode("v-if", true)
  26877. ])
  26878. ], 42, _hoisted_1$9);
  26879. }), 128)),
  26880. renderSlot(_ctx.$slots, "append")
  26881. ]),
  26882. _: 3
  26883. }, 8, ["class", "name"]);
  26884. };
  26885. }
  26886. }));
  26887. var UploadList = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);
  26888. const uploadDraggerProps = buildProps({
  26889. disabled: {
  26890. type: Boolean,
  26891. default: false
  26892. }
  26893. });
  26894. const uploadDraggerEmits = {
  26895. file: (file) => isArray(file)
  26896. };
  26897. const _hoisted_1$8 = ["onDrop", "onDragover"];
  26898. const __default__$3 = {
  26899. name: "ElUploadDrag"
  26900. };
  26901. const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
  26902. props: uploadDraggerProps,
  26903. emits: uploadDraggerEmits,
  26904. setup(__props, { emit }) {
  26905. const props = __props;
  26906. const COMPONENT_NAME2 = "ElUploadDrag";
  26907. const uploaderContext = inject(uploadContextKey);
  26908. if (!uploaderContext) {
  26909. throwError(COMPONENT_NAME2, "usage: <el-upload><el-upload-dragger /></el-upload>");
  26910. }
  26911. const ns = useNamespace("upload");
  26912. const dragover = ref(false);
  26913. const onDrop = (e) => {
  26914. if (props.disabled)
  26915. return;
  26916. dragover.value = false;
  26917. const files = Array.from(e.dataTransfer.files);
  26918. const accept = uploaderContext.accept.value;
  26919. if (!accept) {
  26920. emit("file", files);
  26921. return;
  26922. }
  26923. const filesFiltered = files.filter((file) => {
  26924. const { type: type4, name } = file;
  26925. const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
  26926. const baseType = type4.replace(/\/.*$/, "");
  26927. return accept.split(",").map((type22) => type22.trim()).filter((type22) => type22).some((acceptedType) => {
  26928. if (acceptedType.startsWith(".")) {
  26929. return extension === acceptedType;
  26930. }
  26931. if (/\/\*$/.test(acceptedType)) {
  26932. return baseType === acceptedType.replace(/\/\*$/, "");
  26933. }
  26934. if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
  26935. return type4 === acceptedType;
  26936. }
  26937. return false;
  26938. });
  26939. });
  26940. emit("file", filesFiltered);
  26941. };
  26942. const onDragover = () => {
  26943. if (!props.disabled)
  26944. dragover.value = true;
  26945. };
  26946. return (_ctx, _cache) => {
  26947. return openBlock(), createElementBlock("div", {
  26948. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  26949. onDrop: withModifiers(onDrop, ["prevent"]),
  26950. onDragover: withModifiers(onDragover, ["prevent"]),
  26951. onDragleave: _cache[0] || (_cache[0] = withModifiers(($event) => dragover.value = false, ["prevent"]))
  26952. }, [
  26953. renderSlot(_ctx.$slots, "default")
  26954. ], 42, _hoisted_1$8);
  26955. };
  26956. }
  26957. }));
  26958. var UploadDragger = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);
  26959. const uploadContentProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  26960. fileList: {
  26961. type: definePropType(Array),
  26962. default: () => mutable([])
  26963. },
  26964. beforeUpload: {
  26965. type: definePropType(Function),
  26966. default: NOOP
  26967. },
  26968. onRemove: {
  26969. type: definePropType(Function),
  26970. default: NOOP
  26971. },
  26972. onStart: {
  26973. type: definePropType(Function),
  26974. default: NOOP
  26975. },
  26976. onSuccess: {
  26977. type: definePropType(Function),
  26978. default: NOOP
  26979. },
  26980. onProgress: {
  26981. type: definePropType(Function),
  26982. default: NOOP
  26983. },
  26984. onError: {
  26985. type: definePropType(Function),
  26986. default: NOOP
  26987. },
  26988. onExceed: {
  26989. type: definePropType(Function),
  26990. default: NOOP
  26991. }
  26992. }));
  26993. const _hoisted_1$7 = ["onKeydown"];
  26994. const _hoisted_2$6 = ["name", "multiple", "accept"];
  26995. const __default__$2 = {
  26996. name: "ElUploadContent",
  26997. inheritAttrs: false
  26998. };
  26999. const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
  27000. props: uploadContentProps,
  27001. setup(__props, { expose }) {
  27002. const props = __props;
  27003. const ns = useNamespace("upload");
  27004. const requests = shallowRef({});
  27005. const inputRef = shallowRef();
  27006. const uploadFiles = (files) => {
  27007. if (files.length === 0)
  27008. return;
  27009. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  27010. if (limit && fileList.length + files.length > limit) {
  27011. onExceed(files, fileList);
  27012. return;
  27013. }
  27014. if (!multiple) {
  27015. files = files.slice(0, 1);
  27016. }
  27017. for (const file of files) {
  27018. const rawFile = file;
  27019. rawFile.uid = genFileId();
  27020. onStart(rawFile);
  27021. if (autoUpload)
  27022. upload(rawFile);
  27023. }
  27024. };
  27025. const upload = async (rawFile) => {
  27026. inputRef.value.value = "";
  27027. if (!props.beforeUpload) {
  27028. return doUpload(rawFile);
  27029. }
  27030. let hookResult;
  27031. try {
  27032. hookResult = await props.beforeUpload(rawFile);
  27033. } catch (e) {
  27034. hookResult = false;
  27035. }
  27036. if (hookResult === false) {
  27037. props.onRemove(rawFile);
  27038. return;
  27039. }
  27040. let file = rawFile;
  27041. if (hookResult instanceof Blob) {
  27042. if (hookResult instanceof File) {
  27043. file = hookResult;
  27044. } else {
  27045. file = new File([hookResult], rawFile.name, {
  27046. type: rawFile.type
  27047. });
  27048. }
  27049. for (const key of Object.keys(rawFile)) {
  27050. file[key] = rawFile[key];
  27051. }
  27052. }
  27053. doUpload(rawFile);
  27054. };
  27055. const doUpload = (rawFile) => {
  27056. const {
  27057. headers,
  27058. data: data2,
  27059. method: method4,
  27060. withCredentials,
  27061. name: filename,
  27062. action,
  27063. onProgress,
  27064. onSuccess,
  27065. onError,
  27066. httpRequest
  27067. } = props;
  27068. const { uid: uid2 } = rawFile;
  27069. const options = {
  27070. headers: headers || {},
  27071. withCredentials,
  27072. file: rawFile,
  27073. data: data2,
  27074. method: method4,
  27075. filename,
  27076. action,
  27077. onProgress: (evt) => {
  27078. onProgress(evt, rawFile);
  27079. },
  27080. onSuccess: (res) => {
  27081. onSuccess(res, rawFile);
  27082. delete requests.value[uid2];
  27083. },
  27084. onError: (err) => {
  27085. onError(err, rawFile);
  27086. delete requests.value[uid2];
  27087. }
  27088. };
  27089. const request = httpRequest(options);
  27090. requests.value[uid2] = request;
  27091. if (request instanceof Promise) {
  27092. request.then(options.onSuccess, options.onError);
  27093. }
  27094. };
  27095. const handleChange2 = (e) => {
  27096. const files = e.target.files;
  27097. if (!files)
  27098. return;
  27099. uploadFiles(Array.from(files));
  27100. };
  27101. const handleClick = () => {
  27102. if (!props.disabled) {
  27103. inputRef.value.value = "";
  27104. inputRef.value.click();
  27105. }
  27106. };
  27107. const handleKeydown = () => {
  27108. handleClick();
  27109. };
  27110. const abort = (file) => {
  27111. const _reqs = entriesOf(requests.value).filter(file ? ([uid2]) => String(file.uid) === uid2 : () => true);
  27112. _reqs.forEach(([uid2, req]) => {
  27113. if (req instanceof XMLHttpRequest)
  27114. req.abort();
  27115. delete requests.value[uid2];
  27116. });
  27117. };
  27118. expose({
  27119. abort,
  27120. upload
  27121. });
  27122. return (_ctx, _cache) => {
  27123. return openBlock(), createElementBlock("div", {
  27124. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.listType)]),
  27125. tabindex: "0",
  27126. onClick: handleClick,
  27127. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  27128. }, [
  27129. _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
  27130. key: 0,
  27131. disabled: _ctx.disabled,
  27132. onFile: uploadFiles
  27133. }, {
  27134. default: withCtx(() => [
  27135. renderSlot(_ctx.$slots, "default")
  27136. ]),
  27137. _: 3
  27138. }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
  27139. createElementVNode("input", {
  27140. ref_key: "inputRef",
  27141. ref: inputRef,
  27142. class: normalizeClass(unref(ns).e("input")),
  27143. name: _ctx.name,
  27144. multiple: _ctx.multiple,
  27145. accept: _ctx.accept,
  27146. type: "file",
  27147. onChange: handleChange2
  27148. }, null, 42, _hoisted_2$6)
  27149. ], 42, _hoisted_1$7);
  27150. };
  27151. }
  27152. }));
  27153. var UploadContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);
  27154. const SCOPE = "ElUpload";
  27155. const revokeObjectURL = (file) => {
  27156. var _a2;
  27157. if ((_a2 = file.url) == null ? void 0 : _a2.startsWith("blob:")) {
  27158. URL.revokeObjectURL(file.url);
  27159. }
  27160. };
  27161. const useHandlers = (props, uploadRef) => {
  27162. const uploadFiles = ref([]);
  27163. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  27164. function abort(file) {
  27165. var _a2;
  27166. (_a2 = uploadRef.value) == null ? void 0 : _a2.abort(file);
  27167. }
  27168. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  27169. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  27170. }
  27171. const handleError = (err, rawFile) => {
  27172. const file = getFile(rawFile);
  27173. if (!file)
  27174. return;
  27175. file.status = "fail";
  27176. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  27177. props.onError(err, file, uploadFiles.value);
  27178. props.onChange(file, uploadFiles.value);
  27179. };
  27180. const handleProgress = (evt, rawFile) => {
  27181. const file = getFile(rawFile);
  27182. if (!file)
  27183. return;
  27184. props.onProgress(evt, file, uploadFiles.value);
  27185. file.status = "uploading";
  27186. file.percentage = Math.round(evt.percent);
  27187. };
  27188. const handleSuccess = (response, rawFile) => {
  27189. const file = getFile(rawFile);
  27190. if (!file)
  27191. return;
  27192. file.status = "success";
  27193. file.response = response;
  27194. props.onSuccess(response, file, uploadFiles.value);
  27195. props.onChange(file, uploadFiles.value);
  27196. };
  27197. const handleStart = (file) => {
  27198. const uploadFile = {
  27199. name: file.name,
  27200. percentage: 0,
  27201. status: "ready",
  27202. size: file.size,
  27203. raw: file,
  27204. uid: file.uid
  27205. };
  27206. if (props.listType === "picture-card" || props.listType === "picture") {
  27207. try {
  27208. uploadFile.url = URL.createObjectURL(file);
  27209. } catch (err) {
  27210. debugWarn(SCOPE, err.message);
  27211. props.onError(err, uploadFile, uploadFiles.value);
  27212. }
  27213. }
  27214. uploadFiles.value.push(uploadFile);
  27215. props.onChange(uploadFile, uploadFiles.value);
  27216. };
  27217. const handleRemove = async (file, rawFile) => {
  27218. if (rawFile) {
  27219. useDeprecated({
  27220. scope: SCOPE,
  27221. from: "handleRemove second argument",
  27222. version: "2.2",
  27223. replacement: "first argument `file`",
  27224. ref: "https://element-plus.org/en-US/component/upload.html#methods"
  27225. }, true);
  27226. }
  27227. const _file = rawFile || file;
  27228. const uploadFile = _file instanceof File ? getFile(_file) : _file;
  27229. if (!uploadFile)
  27230. throwError(SCOPE, "file to be removed not found");
  27231. const doRemove = (file2) => {
  27232. abort(file2);
  27233. const fileList = uploadFiles.value;
  27234. fileList.splice(fileList.indexOf(file2), 1);
  27235. props.onRemove(file2, fileList);
  27236. revokeObjectURL(file2);
  27237. };
  27238. if (props.beforeRemove) {
  27239. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  27240. if (before !== false)
  27241. doRemove(uploadFile);
  27242. } else {
  27243. doRemove(uploadFile);
  27244. }
  27245. };
  27246. function submit() {
  27247. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  27248. var _a2;
  27249. return raw && ((_a2 = uploadRef.value) == null ? void 0 : _a2.upload(raw));
  27250. });
  27251. }
  27252. watch(() => props.listType, (val) => {
  27253. if (val !== "picture-card" && val !== "picture") {
  27254. return;
  27255. }
  27256. uploadFiles.value = uploadFiles.value.map((file) => {
  27257. const { raw, url: url2 } = file;
  27258. if (!url2 && raw) {
  27259. try {
  27260. file.url = URL.createObjectURL(raw);
  27261. } catch (err) {
  27262. props.onError(err, file, uploadFiles.value);
  27263. }
  27264. }
  27265. return file;
  27266. });
  27267. });
  27268. watch(() => props.fileList, (fileList) => {
  27269. for (const file of fileList) {
  27270. file.uid || (file.uid = genFileId());
  27271. file.status || (file.status = "success");
  27272. }
  27273. uploadFiles.value = fileList;
  27274. }, { immediate: true, deep: true });
  27275. return {
  27276. abort,
  27277. clearFiles,
  27278. handleError,
  27279. handleProgress,
  27280. handleStart,
  27281. handleSuccess,
  27282. handleRemove,
  27283. submit,
  27284. uploadFiles
  27285. };
  27286. };
  27287. const __default__$1 = {
  27288. name: "ElUpload"
  27289. };
  27290. const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
  27291. props: uploadProps,
  27292. setup(__props, { expose }) {
  27293. const props = __props;
  27294. const slots = useSlots();
  27295. const disabled = useDisabled$1();
  27296. const uploadRef = shallowRef();
  27297. const {
  27298. abort,
  27299. submit,
  27300. clearFiles,
  27301. uploadFiles,
  27302. handleStart,
  27303. handleError,
  27304. handleRemove,
  27305. handleSuccess,
  27306. handleProgress
  27307. } = useHandlers(props, uploadRef);
  27308. const isPictureCard = computed(() => props.listType === "picture-card");
  27309. const uploadContentProps2 = computed(() => __spreadProps(__spreadValues({}, props), {
  27310. onStart: handleStart,
  27311. onProgress: handleProgress,
  27312. onSuccess: handleSuccess,
  27313. onError: handleError,
  27314. onRemove: handleRemove
  27315. }));
  27316. onBeforeUnmount(() => {
  27317. uploadFiles.value.forEach(({ url: url2 }) => {
  27318. if (url2 == null ? void 0 : url2.startsWith("blob:"))
  27319. URL.revokeObjectURL(url2);
  27320. });
  27321. });
  27322. provide(uploadContextKey, {
  27323. accept: toRef(props, "accept")
  27324. });
  27325. expose({
  27326. abort,
  27327. submit,
  27328. clearFiles,
  27329. handleStart,
  27330. handleRemove
  27331. });
  27332. return (_ctx, _cache) => {
  27333. return openBlock(), createElementBlock("div", null, [
  27334. unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  27335. key: 0,
  27336. disabled: unref(disabled),
  27337. "list-type": _ctx.listType,
  27338. files: unref(uploadFiles),
  27339. "handle-preview": _ctx.onPreview,
  27340. onRemove: unref(handleRemove)
  27341. }, createSlots({
  27342. append: withCtx(() => [
  27343. _ctx.listType === "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  27344. key: 0,
  27345. ref_key: "uploadRef",
  27346. ref: uploadRef
  27347. }, unref(uploadContentProps2)), {
  27348. default: withCtx(() => [
  27349. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  27350. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  27351. ]),
  27352. _: 3
  27353. }, 16)) : createCommentVNode("v-if", true)
  27354. ]),
  27355. _: 2
  27356. }, [
  27357. _ctx.$slots.file ? {
  27358. name: "default",
  27359. fn: withCtx(({ file }) => [
  27360. renderSlot(_ctx.$slots, "file", { file })
  27361. ])
  27362. } : void 0
  27363. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
  27364. _ctx.listType !== "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  27365. key: 1,
  27366. ref_key: "uploadRef",
  27367. ref: uploadRef
  27368. }, unref(uploadContentProps2)), {
  27369. default: withCtx(() => [
  27370. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  27371. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  27372. ]),
  27373. _: 3
  27374. }, 16)) : createCommentVNode("v-if", true),
  27375. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  27376. renderSlot(_ctx.$slots, "tip"),
  27377. !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  27378. key: 3,
  27379. disabled: unref(disabled),
  27380. "list-type": _ctx.listType,
  27381. files: unref(uploadFiles),
  27382. "handle-preview": _ctx.onPreview,
  27383. onRemove: unref(handleRemove)
  27384. }, createSlots({ _: 2 }, [
  27385. _ctx.$slots.file ? {
  27386. name: "default",
  27387. fn: withCtx(({ file }) => [
  27388. renderSlot(_ctx.$slots, "file", { file })
  27389. ])
  27390. } : void 0
  27391. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
  27392. ]);
  27393. };
  27394. }
  27395. }));
  27396. var Upload = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);
  27397. const ElUpload = withInstall(Upload);
  27398. var base = "";
  27399. var elDialog = "";
  27400. var elOverlay = "";
  27401. var elButton = "";
  27402. var elForm = "";
  27403. var elFormItem = "";
  27404. var elCascader = "";
  27405. var elInput = "";
  27406. var elPopper = "";
  27407. var elTag = "";
  27408. var elCascaderPanel = "";
  27409. var elCheckbox = "";
  27410. var elRadio = "";
  27411. var elScrollbar = "";
  27412. var elUpload = "";
  27413. var elProgress = "";
  27414. var elImage = "";
  27415. var elImageViewer = "";
  27416. var elSlider = "";
  27417. var elInputNumber = "";
  27418. var elTooltip = "";
  27419. var elSwitch = "";
  27420. var elOption = "";
  27421. var elOptionGroup = "";
  27422. var elSelect = "";
  27423. var elRate = "";
  27424. var elDatePicker = "";
  27425. var elConfigProvider = "";
  27426. var elTimePicker = "";
  27427. var elCheckboxGroup = "";
  27428. var elRadioGroup = "";
  27429. var elDivider = "";
  27430. var elTable = "";
  27431. var elTableColumn = "";
  27432. var zhCn = {
  27433. name: "zh-cn",
  27434. el: {
  27435. colorpicker: {
  27436. confirm: "\u786E\u5B9A",
  27437. clear: "\u6E05\u7A7A"
  27438. },
  27439. datepicker: {
  27440. now: "\u6B64\u523B",
  27441. today: "\u4ECA\u5929",
  27442. cancel: "\u53D6\u6D88",
  27443. clear: "\u6E05\u7A7A",
  27444. confirm: "\u786E\u5B9A",
  27445. selectDate: "\u9009\u62E9\u65E5\u671F",
  27446. selectTime: "\u9009\u62E9\u65F6\u95F4",
  27447. startDate: "\u5F00\u59CB\u65E5\u671F",
  27448. startTime: "\u5F00\u59CB\u65F6\u95F4",
  27449. endDate: "\u7ED3\u675F\u65E5\u671F",
  27450. endTime: "\u7ED3\u675F\u65F6\u95F4",
  27451. prevYear: "\u524D\u4E00\u5E74",
  27452. nextYear: "\u540E\u4E00\u5E74",
  27453. prevMonth: "\u4E0A\u4E2A\u6708",
  27454. nextMonth: "\u4E0B\u4E2A\u6708",
  27455. year: "\u5E74",
  27456. month1: "1 \u6708",
  27457. month2: "2 \u6708",
  27458. month3: "3 \u6708",
  27459. month4: "4 \u6708",
  27460. month5: "5 \u6708",
  27461. month6: "6 \u6708",
  27462. month7: "7 \u6708",
  27463. month8: "8 \u6708",
  27464. month9: "9 \u6708",
  27465. month10: "10 \u6708",
  27466. month11: "11 \u6708",
  27467. month12: "12 \u6708",
  27468. weeks: {
  27469. sun: "\u65E5",
  27470. mon: "\u4E00",
  27471. tue: "\u4E8C",
  27472. wed: "\u4E09",
  27473. thu: "\u56DB",
  27474. fri: "\u4E94",
  27475. sat: "\u516D"
  27476. },
  27477. months: {
  27478. jan: "\u4E00\u6708",
  27479. feb: "\u4E8C\u6708",
  27480. mar: "\u4E09\u6708",
  27481. apr: "\u56DB\u6708",
  27482. may: "\u4E94\u6708",
  27483. jun: "\u516D\u6708",
  27484. jul: "\u4E03\u6708",
  27485. aug: "\u516B\u6708",
  27486. sep: "\u4E5D\u6708",
  27487. oct: "\u5341\u6708",
  27488. nov: "\u5341\u4E00\u6708",
  27489. dec: "\u5341\u4E8C\u6708"
  27490. }
  27491. },
  27492. select: {
  27493. loading: "\u52A0\u8F7D\u4E2D",
  27494. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27495. noData: "\u65E0\u6570\u636E",
  27496. placeholder: "\u8BF7\u9009\u62E9"
  27497. },
  27498. cascader: {
  27499. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27500. loading: "\u52A0\u8F7D\u4E2D",
  27501. placeholder: "\u8BF7\u9009\u62E9",
  27502. noData: "\u6682\u65E0\u6570\u636E"
  27503. },
  27504. pagination: {
  27505. goto: "\u524D\u5F80",
  27506. pagesize: "\u6761/\u9875",
  27507. total: "\u5171 {total} \u6761",
  27508. pageClassifier: "\u9875",
  27509. deprecationWarning: "\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"
  27510. },
  27511. messagebox: {
  27512. title: "\u63D0\u793A",
  27513. confirm: "\u786E\u5B9A",
  27514. cancel: "\u53D6\u6D88",
  27515. error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
  27516. },
  27517. upload: {
  27518. deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
  27519. delete: "\u5220\u9664",
  27520. preview: "\u67E5\u770B\u56FE\u7247",
  27521. continue: "\u7EE7\u7EED\u4E0A\u4F20"
  27522. },
  27523. table: {
  27524. emptyText: "\u6682\u65E0\u6570\u636E",
  27525. confirmFilter: "\u7B5B\u9009",
  27526. resetFilter: "\u91CD\u7F6E",
  27527. clearFilter: "\u5168\u90E8",
  27528. sumText: "\u5408\u8BA1"
  27529. },
  27530. tree: {
  27531. emptyText: "\u6682\u65E0\u6570\u636E"
  27532. },
  27533. transfer: {
  27534. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  27535. noData: "\u65E0\u6570\u636E",
  27536. titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
  27537. filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
  27538. noCheckedFormat: "\u5171 {total} \u9879",
  27539. hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
  27540. },
  27541. image: {
  27542. error: "\u52A0\u8F7D\u5931\u8D25"
  27543. },
  27544. pageHeader: {
  27545. title: "\u8FD4\u56DE"
  27546. },
  27547. popconfirm: {
  27548. confirmButtonText: "\u786E\u5B9A",
  27549. cancelButtonText: "\u53D6\u6D88"
  27550. }
  27551. }
  27552. };
  27553. var GenerateFormItem_vue_vue_type_style_index_0_scoped_true_lang = "";
  27554. var _export_sfc = (sfc, props) => {
  27555. const target = sfc.__vccOpts || sfc;
  27556. for (const [key, val] of props) {
  27557. target[key] = val;
  27558. }
  27559. return target;
  27560. };
  27561. const _withScopeId = (n) => (pushScopeId("data-v-1a926725"), n = n(), popScopeId(), n);
  27562. const _hoisted_1$6 = { key: 12 };
  27563. const _hoisted_2$5 = {
  27564. key: 1,
  27565. class: "custom:insert"
  27566. };
  27567. const _hoisted_3$4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("i", { class: "custom:img-upload mr-2" }, null, -1));
  27568. const _hoisted_4$4 = /* @__PURE__ */ createTextVNode("\u70B9\u51FB\u4E0A\u4F20 ");
  27569. const _hoisted_5$4 = ["href"];
  27570. const _hoisted_6$4 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  27571. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  27572. props: {
  27573. config: null,
  27574. element: null,
  27575. model: null,
  27576. updatedModel: null,
  27577. disabled: { type: Boolean },
  27578. request: null
  27579. },
  27580. setup(__props) {
  27581. const props = __props;
  27582. const originData = props.model[props.element.model];
  27583. const data2 = computed({
  27584. get: () => props.model[props.element.model],
  27585. set: (val) => {
  27586. props.model[props.element.model] = val;
  27587. if (JSON.stringify(originData) === JSON.stringify(val)) {
  27588. Reflect.deleteProperty(props.updatedModel, props.element.model);
  27589. } else {
  27590. props.updatedModel[props.element.model] = val;
  27591. }
  27592. }
  27593. });
  27594. const handleUploadSuccess = (_res, _file, fileList) => {
  27595. data2.value = fileList;
  27596. };
  27597. async function download(defaultValue, label) {
  27598. const a2 = document.createElement("a");
  27599. if (!props.request)
  27600. return;
  27601. a2.href = await props.request({
  27602. url: `/sys/common/static/${defaultValue}`,
  27603. responseType: "blob"
  27604. }).then((i) => {
  27605. if (i.size === 0)
  27606. return "";
  27607. return URL.createObjectURL(i);
  27608. });
  27609. a2.download = `${label}.${defaultValue.split(".")[1]}`;
  27610. a2.click();
  27611. }
  27612. return (_ctx, _cache) => {
  27613. const _component_GenerateFormItem = resolveComponent("GenerateFormItem", true);
  27614. const _component_el_table_column = ElTableColumn;
  27615. const _component_el_table = ElTable;
  27616. const _component_el_divider = ElDivider;
  27617. const _component_el_input = ElInput;
  27618. const _component_el_input_number = ElInputNumber;
  27619. const _component_el_radio = ElRadio;
  27620. const _component_el_radio_group = ElRadioGroup;
  27621. const _component_el_checkbox = ElCheckbox;
  27622. const _component_el_checkbox_group = ElCheckboxGroup$1;
  27623. const _component_el_time_picker = ElTimePicker;
  27624. const _component_el_config_provider = ElConfigProvider;
  27625. const _component_el_date_picker = ElDatePicker;
  27626. const _component_el_rate = ElRate;
  27627. const _component_el_option = ElOption;
  27628. const _component_el_select = ElSelect;
  27629. const _component_el_switch = ElSwitch;
  27630. const _component_el_slider = ElSlider;
  27631. const _component_el_image = ElImage;
  27632. const _component_el_button = ElButton;
  27633. const _component_el_upload = ElUpload;
  27634. const _component_el_cascader = ElCascader;
  27635. const _component_el_form_item = ElFormItem;
  27636. return __props.element.type === "grid" ? (openBlock(), createElementBlock("div", {
  27637. key: 0,
  27638. grid: "~ cols-24",
  27639. style: normalizeStyle(`gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};`)
  27640. }, [
  27641. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (col, colIndex) => {
  27642. return openBlock(), createElementBlock("div", {
  27643. key: colIndex,
  27644. style: normalizeStyle(`grid-column: span ${col.span}`)
  27645. }, [
  27646. (openBlock(true), createElementBlock(Fragment, null, renderList(col.list, (colItem) => {
  27647. return openBlock(), createBlock(_component_GenerateFormItem, {
  27648. key: colItem.key,
  27649. request: __props.request,
  27650. model: __props.model,
  27651. "updated-model": __props.updatedModel,
  27652. element: colItem,
  27653. config: __props.config,
  27654. disabled: __props.disabled
  27655. }, null, 8, ["request", "model", "updated-model", "element", "config", "disabled"]);
  27656. }), 128))
  27657. ], 4);
  27658. }), 128))
  27659. ], 4)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  27660. key: 1,
  27661. border: "",
  27662. class: "mb-4.5",
  27663. data: __props.element.options.defaultValue
  27664. }, {
  27665. default: withCtx(() => [
  27666. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  27667. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  27668. key: i.prop,
  27669. align: __props.element.options.align
  27670. }, i), null, 16, ["align"]);
  27671. }), 128))
  27672. ]),
  27673. _: 1
  27674. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  27675. key: 2,
  27676. data: __props.element.options.defaultValue,
  27677. "content-position": "left"
  27678. }, {
  27679. default: withCtx(() => [
  27680. createTextVNode(toDisplayString(__props.element.label), 1)
  27681. ]),
  27682. _: 1
  27683. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  27684. key: __props.element.key,
  27685. label: __props.element.label,
  27686. prop: __props.element.model,
  27687. style: normalizeStyle(__props.element.type === "download" ? "display:inline-flex;margin-right:40px" : ""),
  27688. "label-width": __props.element.labelWidth
  27689. }, createSlots({
  27690. default: withCtx(() => [
  27691. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  27692. key: 0,
  27693. modelValue: unref(data2),
  27694. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(data2) ? data2.value = $event : null),
  27695. style: normalizeStyle({ width: __props.element.options.width }),
  27696. placeholder: __props.element.options.placeholder,
  27697. maxlength: parseInt(__props.element.options.maxlength),
  27698. clearable: __props.element.options.clearable,
  27699. readonly: __props.element.options.readonly,
  27700. disabled: __props.disabled || __props.element.options.disabled
  27701. }, createSlots({ _: 2 }, [
  27702. __props.element.options.prefix ? {
  27703. name: "prefix",
  27704. fn: withCtx(() => [
  27705. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  27706. ])
  27707. } : void 0,
  27708. __props.element.options.suffix ? {
  27709. name: "suffix",
  27710. fn: withCtx(() => [
  27711. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  27712. ])
  27713. } : void 0,
  27714. __props.element.options.prepend ? {
  27715. name: "prepend",
  27716. fn: withCtx(() => [
  27717. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  27718. ])
  27719. } : void 0,
  27720. __props.element.options.append ? {
  27721. name: "append",
  27722. fn: withCtx(() => [
  27723. createTextVNode(toDisplayString(__props.element.options.append), 1)
  27724. ])
  27725. } : void 0
  27726. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  27727. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  27728. key: 1,
  27729. modelValue: unref(data2),
  27730. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(data2) ? data2.value = $event : null),
  27731. style: normalizeStyle({ width: __props.element.options.width }),
  27732. placeholder: __props.element.options.placeholder,
  27733. maxlength: parseInt(__props.element.options.maxlength),
  27734. clearable: __props.element.options.clearable,
  27735. disabled: __props.disabled || __props.element.options.disabled,
  27736. readonly: __props.element.options.readonly,
  27737. "show-password": __props.element.options.showPassword
  27738. }, createSlots({ _: 2 }, [
  27739. __props.element.options.prefix ? {
  27740. name: "prefix",
  27741. fn: withCtx(() => [
  27742. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  27743. ])
  27744. } : void 0,
  27745. __props.element.options.suffix ? {
  27746. name: "suffix",
  27747. fn: withCtx(() => [
  27748. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  27749. ])
  27750. } : void 0,
  27751. __props.element.options.prepend ? {
  27752. name: "prepend",
  27753. fn: withCtx(() => [
  27754. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  27755. ])
  27756. } : void 0,
  27757. __props.element.options.append ? {
  27758. name: "append",
  27759. fn: withCtx(() => [
  27760. createTextVNode(toDisplayString(__props.element.options.append), 1)
  27761. ])
  27762. } : void 0
  27763. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "disabled", "readonly", "show-password"])) : createCommentVNode("", true),
  27764. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  27765. key: 2,
  27766. modelValue: unref(data2),
  27767. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(data2) ? data2.value = $event : null),
  27768. type: "textarea",
  27769. resize: "none",
  27770. rows: __props.element.options.rows,
  27771. style: normalizeStyle({ width: __props.element.options.width }),
  27772. placeholder: __props.element.options.placeholder,
  27773. maxlength: parseInt(__props.element.options.maxlength),
  27774. "show-word-limit": __props.element.options.showWordLimit,
  27775. autosize: __props.element.options.autosize,
  27776. clearable: __props.element.options.clearable,
  27777. readonly: __props.element.options.readonly,
  27778. disabled: __props.disabled || __props.element.options.disabled
  27779. }, null, 8, ["modelValue", "rows", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  27780. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  27781. key: 3,
  27782. modelValue: unref(data2),
  27783. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(data2) ? data2.value = $event : null),
  27784. style: normalizeStyle({ width: __props.element.options.width }),
  27785. max: __props.element.options.max,
  27786. min: __props.element.options.min,
  27787. disabled: __props.disabled || __props.element.options.disabled
  27788. }, null, 8, ["modelValue", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  27789. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  27790. key: 4,
  27791. modelValue: unref(data2),
  27792. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(data2) ? data2.value = $event : null),
  27793. style: normalizeStyle({ width: __props.element.options.width }),
  27794. disabled: __props.disabled || __props.element.options.disabled
  27795. }, {
  27796. default: withCtx(() => [
  27797. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  27798. return openBlock(), createBlock(_component_el_radio, {
  27799. key: item.value,
  27800. label: item.value,
  27801. style: normalizeStyle({
  27802. display: __props.element.options.inline ? "inline-block" : "block"
  27803. })
  27804. }, {
  27805. default: withCtx(() => [
  27806. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  27807. ]),
  27808. _: 2
  27809. }, 1032, ["label", "style"]);
  27810. }), 128))
  27811. ]),
  27812. _: 1
  27813. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  27814. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  27815. key: 5,
  27816. modelValue: unref(data2),
  27817. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(data2) ? data2.value = $event : null),
  27818. style: normalizeStyle({ width: __props.element.options.width }),
  27819. disabled: __props.disabled || __props.element.options.disabled
  27820. }, {
  27821. default: withCtx(() => [
  27822. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  27823. return openBlock(), createBlock(_component_el_checkbox, {
  27824. key: item.value,
  27825. label: item.value,
  27826. style: normalizeStyle({
  27827. display: __props.element.options.inline ? "inline-block" : "block"
  27828. })
  27829. }, {
  27830. default: withCtx(() => [
  27831. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  27832. ]),
  27833. _: 2
  27834. }, 1032, ["label", "style"]);
  27835. }), 128))
  27836. ]),
  27837. _: 1
  27838. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  27839. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_config_provider, {
  27840. key: 6,
  27841. locale: unref(zhCn)
  27842. }, {
  27843. default: withCtx(() => [
  27844. createVNode(_component_el_time_picker, {
  27845. modelValue: unref(data2),
  27846. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(data2) ? data2.value = $event : null),
  27847. placeholder: __props.element.options.placeholder,
  27848. readonly: __props.element.options.readonly,
  27849. editable: __props.element.options.editable,
  27850. clearable: __props.element.options.clearable,
  27851. format: __props.element.options.format,
  27852. disabled: __props.disabled || __props.element.options.disabled,
  27853. style: normalizeStyle({ width: __props.element.options.width })
  27854. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
  27855. ]),
  27856. _: 1
  27857. }, 8, ["locale"])) : createCommentVNode("", true),
  27858. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_config_provider, {
  27859. key: 7,
  27860. locale: unref(zhCn)
  27861. }, {
  27862. default: withCtx(() => [
  27863. createVNode(_component_el_date_picker, {
  27864. modelValue: unref(data2),
  27865. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(data2) ? data2.value = $event : null),
  27866. placeholder: __props.element.options.placeholder,
  27867. readonly: __props.element.options.readonly,
  27868. editable: __props.element.options.editable,
  27869. clearable: __props.element.options.clearable,
  27870. format: __props.element.options.format,
  27871. disabled: __props.disabled || __props.element.options.disabled,
  27872. style: normalizeStyle({ width: __props.element.options.width })
  27873. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
  27874. ]),
  27875. _: 1
  27876. }, 8, ["locale"])) : createCommentVNode("", true),
  27877. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  27878. key: 8,
  27879. modelValue: unref(data2),
  27880. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(data2) ? data2.value = $event : null),
  27881. max: __props.element.options.max,
  27882. "allow-half": __props.element.options.allowHalf,
  27883. disabled: __props.disabled || __props.element.options.disabled
  27884. }, null, 8, ["modelValue", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  27885. __props.element.type === "select" ? (openBlock(), createBlock(_component_el_select, {
  27886. key: 9,
  27887. modelValue: unref(data2),
  27888. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(data2) ? data2.value = $event : null),
  27889. multiple: __props.element.options.multiple,
  27890. placeholder: __props.element.options.placeholder,
  27891. clearable: __props.element.options.clearable,
  27892. filterable: __props.element.options.filterable,
  27893. disabled: __props.disabled || __props.element.options.disabled,
  27894. style: normalizeStyle({ width: __props.element.options.width })
  27895. }, {
  27896. default: withCtx(() => [
  27897. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  27898. return openBlock(), createBlock(_component_el_option, {
  27899. key: item.value,
  27900. value: item.value,
  27901. label: __props.element.options.showLabel ? item.label : item.value
  27902. }, null, 8, ["value", "label"]);
  27903. }), 128))
  27904. ]),
  27905. _: 1
  27906. }, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"])) : createCommentVNode("", true),
  27907. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  27908. key: 10,
  27909. modelValue: unref(data2),
  27910. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => isRef(data2) ? data2.value = $event : null),
  27911. "active-text": __props.element.options.activeText,
  27912. "inactive-text": __props.element.options.inactiveText,
  27913. disabled: __props.disabled || __props.element.options.disabled
  27914. }, null, 8, ["modelValue", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  27915. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  27916. key: 11,
  27917. modelValue: unref(data2),
  27918. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(data2) ? data2.value = $event : null),
  27919. min: __props.element.options.min,
  27920. max: __props.element.options.max,
  27921. step: __props.element.options.step,
  27922. range: __props.element.options.range,
  27923. disabled: __props.disabled || __props.element.options.disabled,
  27924. style: normalizeStyle({ width: __props.element.options.width })
  27925. }, null, 8, ["modelValue", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  27926. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$6, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  27927. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  27928. key: 13,
  27929. name: __props.element.options.file,
  27930. action: __props.element.options.action,
  27931. accept: __props.element.options.accept,
  27932. "list-type": __props.element.options.listType,
  27933. multiple: __props.element.options.multiple,
  27934. limit: __props.element.options.limit,
  27935. disabled: __props.disabled || __props.element.options.disabled,
  27936. "on-success": handleUploadSuccess
  27937. }, {
  27938. default: withCtx(() => {
  27939. var _a2;
  27940. return [
  27941. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  27942. ((_a2 = __props.element.options.defaultValue) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(_component_el_image, {
  27943. key: 0,
  27944. style: { "width": "100%", "height": "100%" },
  27945. "preview-src-list": [
  27946. "/api/sys/common/static/" + __props.element.options.defaultValue
  27947. ],
  27948. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  27949. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$5))
  27950. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  27951. default: withCtx(() => [
  27952. _hoisted_3$4,
  27953. _hoisted_4$4
  27954. ]),
  27955. _: 1
  27956. }))
  27957. ];
  27958. }),
  27959. _: 1
  27960. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  27961. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  27962. key: 14,
  27963. style: { "margin-top": "-4px" },
  27964. type: "text",
  27965. onClick: _cache[12] || (_cache[12] = ($event) => download(__props.element.options.defaultValue, __props.element.label))
  27966. }, {
  27967. default: withCtx(() => [
  27968. _hoisted_6$4
  27969. ]),
  27970. _: 1
  27971. })) : createCommentVNode("", true),
  27972. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  27973. key: 15,
  27974. modelValue: unref(data2),
  27975. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => isRef(data2) ? data2.value = $event : null),
  27976. options: __props.element.options.remoteOptions,
  27977. placeholder: __props.element.options.placeholder,
  27978. filterable: __props.element.options.filterable,
  27979. clearable: __props.element.options.clearable,
  27980. disabled: __props.disabled || __props.element.options.disabled,
  27981. style: normalizeStyle({ width: __props.element.options.width })
  27982. }, null, 8, ["modelValue", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  27983. ]),
  27984. _: 2
  27985. }, [
  27986. __props.element.type === "download" ? {
  27987. name: "label",
  27988. fn: withCtx(({ label }) => [
  27989. createElementVNode("a", {
  27990. href: `/api/sys/common/static/${__props.element.options.defaultValue}?inline=1`,
  27991. style: { "color": "#606266" },
  27992. target: "_blank"
  27993. }, toDisplayString(label), 9, _hoisted_5$4)
  27994. ])
  27995. } : void 0
  27996. ]), 1032, ["label", "prop", "style", "label-width"])) : createCommentVNode("", true);
  27997. };
  27998. }
  27999. });
  28000. var GenerateFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-1a926725"]]);
  28001. const _sfc_main$7 = defineComponent({
  28002. name: "FormGenerate",
  28003. components: {
  28004. GenerateFormItem
  28005. },
  28006. props: {
  28007. data: {
  28008. type: Object,
  28009. default: getWidgetForm()
  28010. },
  28011. value: {
  28012. type: Object
  28013. },
  28014. disabled: {
  28015. type: Boolean,
  28016. default: false
  28017. },
  28018. request: {
  28019. type: Function
  28020. }
  28021. },
  28022. setup(props) {
  28023. var _a2;
  28024. const state = reactive({
  28025. generateForm: null,
  28026. model: {},
  28027. updatedModel: {},
  28028. rules: {},
  28029. widgetForm: (_a2 = props.data && JSON.parse(JSON.stringify(props.data))) != null ? _a2 : getWidgetForm()
  28030. });
  28031. const generateModel = (list) => {
  28032. for (let index = 0; index < list.length; index++) {
  28033. const model = list[index].model;
  28034. if (!model)
  28035. return;
  28036. if (list[index].type === "grid") {
  28037. list[index].columns.forEach((col) => generateModel(col.list));
  28038. } else {
  28039. if (props.value && Object.keys(props.value).includes(model))
  28040. state.model[model] = props.value[model];
  28041. else
  28042. state.model[model] = list[index].options.defaultValue;
  28043. state.rules[model] = list[index].options.rules;
  28044. }
  28045. }
  28046. };
  28047. const generateOptions = (list) => {
  28048. list.forEach(async (item) => {
  28049. if (item.type === "grid") {
  28050. item.columns.forEach((col) => generateOptions(col.list));
  28051. } else {
  28052. if (item.options.remote && item.options.remoteFunc) {
  28053. if (props.request) {
  28054. const { data: data2 } = await props.request({
  28055. url: item.options.remoteFunc
  28056. });
  28057. item.options.remoteOptions = data2.map((i) => ({
  28058. label: i[item.options.props.label],
  28059. value: i[item.options.props.value],
  28060. children: i[item.options.props.children]
  28061. }));
  28062. return;
  28063. }
  28064. const token = sessionStorage.getItem("token");
  28065. fetch(item.options.remoteFunc, {
  28066. headers: {
  28067. "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
  28068. "Token": token
  28069. }
  28070. }).then((resp) => resp.json()).then((json) => {
  28071. const res = json.data;
  28072. if (res instanceof Array) {
  28073. item.options.remoteOptions = res.map((data2) => ({
  28074. label: data2[item.options.props.label],
  28075. value: data2[item.options.props.value],
  28076. children: data2[item.options.props.children]
  28077. }));
  28078. }
  28079. });
  28080. }
  28081. }
  28082. });
  28083. };
  28084. watch(() => props.data, (val) => {
  28085. var _a3;
  28086. state.widgetForm = (_a3 = val && JSON.parse(JSON.stringify(val))) != null ? _a3 : getWidgetForm();
  28087. state.model = {};
  28088. state.rules = {};
  28089. generateModel(state.widgetForm.list);
  28090. generateOptions(state.widgetForm.list);
  28091. }, { deep: true, immediate: true });
  28092. const getData = () => {
  28093. return new Promise((resolve, reject) => {
  28094. state.generateForm.validate().then((validate) => {
  28095. if (validate)
  28096. resolve(state.updatedModel);
  28097. else
  28098. ElMessage.error("\u9A8C\u8BC1\u5931\u8D25");
  28099. }).catch((error) => {
  28100. reject(error);
  28101. });
  28102. });
  28103. };
  28104. const reset = () => {
  28105. state.generateForm.resetFields();
  28106. };
  28107. return __spreadProps(__spreadValues({}, toRefs(state)), {
  28108. getData,
  28109. reset
  28110. });
  28111. }
  28112. });
  28113. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  28114. const _component_GenerateFormItem = resolveComponent("GenerateFormItem");
  28115. const _component_el_form = ElForm;
  28116. return openBlock(), createBlock(_component_el_form, {
  28117. ref: "generateForm",
  28118. "label-suffix": ":",
  28119. model: _ctx.model,
  28120. rules: _ctx.rules,
  28121. size: _ctx.widgetForm.config.size,
  28122. "label-position": _ctx.widgetForm.config.labelPosition,
  28123. "label-width": `${_ctx.widgetForm.config.labelWidth}px`,
  28124. "hide-required-asterisk": _ctx.widgetForm.config.hideRequiredAsterisk
  28125. }, {
  28126. default: withCtx(() => [
  28127. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.widgetForm.list, (element, index) => {
  28128. return openBlock(), createBlock(_component_GenerateFormItem, {
  28129. key: element.key,
  28130. model: _ctx.model,
  28131. "updated-model": _ctx.updatedModel,
  28132. element: _ctx.widgetForm.list[index],
  28133. config: _ctx.data.config,
  28134. disabled: _ctx.disabled,
  28135. request: _ctx.request
  28136. }, null, 8, ["model", "updated-model", "element", "config", "disabled", "request"]);
  28137. }), 128))
  28138. ]),
  28139. _: 1
  28140. }, 8, ["model", "rules", "size", "label-position", "label-width", "hide-required-asterisk"]);
  28141. }
  28142. var GenerateForm = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$1]]);
  28143. const isClient = typeof window !== "undefined";
  28144. isClient ? window : void 0;
  28145. isClient ? window.document : void 0;
  28146. isClient ? window.navigator : void 0;
  28147. isClient ? window.location : void 0;
  28148. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  28149. const globalKey = "__vueuse_ssr_handlers__";
  28150. _global[globalKey] = _global[globalKey] || {};
  28151. _global[globalKey];
  28152. var _a, _b;
  28153. 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);
  28154. function useVModel(props, key, emit, options = {}) {
  28155. var _a2;
  28156. const {
  28157. passive: passive2 = false,
  28158. eventName,
  28159. deep = false
  28160. } = options;
  28161. const vm = getCurrentInstance();
  28162. const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a2 = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a2.bind(vm));
  28163. let event = eventName;
  28164. if (!key) {
  28165. {
  28166. key = "modelValue";
  28167. }
  28168. }
  28169. event = eventName || event || `update:${key}`;
  28170. if (passive2) {
  28171. const proxy = ref(props[key]);
  28172. watch(() => props[key], (v2) => proxy.value = v2);
  28173. watch(proxy, (v2) => {
  28174. if (v2 !== props[key] || deep)
  28175. _emit(event, v2);
  28176. }, {
  28177. deep
  28178. });
  28179. return proxy;
  28180. } else {
  28181. return computed({
  28182. get() {
  28183. return props[key];
  28184. },
  28185. set(value) {
  28186. _emit(event, value);
  28187. }
  28188. });
  28189. }
  28190. }
  28191. const _hoisted_1$5 = { class: "px-3 py-2 text-sm text-gray-700" };
  28192. const _hoisted_2$4 = {
  28193. key: 0,
  28194. 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"
  28195. };
  28196. let listIndex = 1;
  28197. function setListIndex(list) {
  28198. if (list.list.length > 0) {
  28199. const array4 = list.list.map((item) => item.model);
  28200. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  28201. const match = item.match(/plate(\d+)/);
  28202. return match ? match[1] : null;
  28203. });
  28204. listIndex = findMissingPositive(plateNumbers);
  28205. }
  28206. }
  28207. function cloneWidget(params) {
  28208. const key = Math.random().toString(36).substring(2, 9);
  28209. params = cloneDeep(__spreadProps(__spreadValues({}, params), {
  28210. key,
  28211. model: `plate${listIndex}`
  28212. }));
  28213. if (params.type === "grid") {
  28214. params.columns.forEach((i) => {
  28215. i.list = i.list.map(cloneWidget);
  28216. });
  28217. }
  28218. return params;
  28219. }
  28220. function findMissingPositive(nums) {
  28221. let numbers = nums.map(Number);
  28222. numbers.sort((a2, b2) => a2 - b2);
  28223. let missing = 1;
  28224. for (let i = 0; i < numbers.length; i++) {
  28225. if (numbers[i] === missing) {
  28226. missing++;
  28227. }
  28228. }
  28229. return missing;
  28230. }
  28231. const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  28232. props: {
  28233. fields: null,
  28234. title: null,
  28235. list: null,
  28236. allList: null
  28237. },
  28238. setup(__props) {
  28239. const props = __props;
  28240. let moveFlag = ref(false);
  28241. const moveStart = () => {
  28242. const array4 = props.allList.list.map((item) => item.model);
  28243. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  28244. const match = item.match(/plate(\d+)/);
  28245. return match ? match[1] : null;
  28246. });
  28247. const flag = plateNumbers.length < 5;
  28248. if (!flag && !moveFlag.value) {
  28249. moveFlag.value = true;
  28250. ElMessage.warning("\u6700\u591A\u6DFB\u52A0\u4E94\u4E2A");
  28251. return false;
  28252. }
  28253. return flag;
  28254. };
  28255. const stopMove = () => {
  28256. moveFlag.value = false;
  28257. };
  28258. return (_ctx, _cache) => {
  28259. return openBlock(), createElementBlock(Fragment, null, [
  28260. createElementVNode("div", _hoisted_1$5, toDisplayString(__props.title), 1),
  28261. createVNode(unref(Draggable), {
  28262. tag: "ul",
  28263. class: "m-0 p-3 pt-0 grid grid-cols-2 gap-1",
  28264. "item-key": "type",
  28265. group: { name: "form-design", pull: "clone", put: false },
  28266. clone: cloneWidget,
  28267. sort: false,
  28268. list: __props.list,
  28269. allList: __props.allList,
  28270. move: moveStart,
  28271. choose: setListIndex(__props.allList),
  28272. onAdd: _cache[0] || (_cache[0] = ($event) => stopMove())
  28273. }, {
  28274. item: withCtx(({ element }) => [
  28275. __props.fields.includes(element.type) ? (openBlock(), createElementBlock("li", _hoisted_2$4, [
  28276. createElementVNode("i", {
  28277. class: normalizeClass(["custom:" + element.type, "ml-2 mr-1"])
  28278. }, null, 2),
  28279. createElementVNode("span", null, toDisplayString(element.label), 1)
  28280. ])) : createCommentVNode("", true)
  28281. ]),
  28282. _: 1
  28283. }, 8, ["list", "allList", "choose"])
  28284. ], 64);
  28285. };
  28286. }
  28287. });
  28288. const _hoisted_1$4 = { key: 12 };
  28289. const _hoisted_2$3 = {
  28290. key: 1,
  28291. class: "custom:insert"
  28292. };
  28293. const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("i", {
  28294. "icon-class": "custom:img-upload",
  28295. style: { "margin-right": "10px" }
  28296. }, null, -1);
  28297. const _hoisted_4$3 = /* @__PURE__ */ createTextVNode(" \u70B9\u51FB\u4E0A\u4F20 ");
  28298. const _hoisted_5$3 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  28299. const _hoisted_6$3 = /* @__PURE__ */ createElementVNode("i", {
  28300. class: "eva:move-outline",
  28301. "text-lg": ""
  28302. }, null, -1);
  28303. const _hoisted_7$2 = [
  28304. _hoisted_6$3
  28305. ];
  28306. const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  28307. props: {
  28308. list: null,
  28309. element: null,
  28310. index: null,
  28311. selectWidget: null
  28312. },
  28313. emits: ["itemClick", "delete", "update:selectWidget"],
  28314. setup(__props) {
  28315. const props = createPropsRestProxy(__props, ["element", "index", "list"]);
  28316. let selectWidget = useVModel(props, "selectWidget");
  28317. const handleDeleteClick = () => {
  28318. __props.list.splice(__props.index, 1);
  28319. selectWidget.value = __props.list[__props.list.length === __props.index ? __props.index - 1 : __props.index];
  28320. };
  28321. return (_ctx, _cache) => {
  28322. var _a2, _b2;
  28323. const _component_WidgetFormItem = resolveComponent("WidgetFormItem", true);
  28324. const _component_el_table_column = ElTableColumn;
  28325. const _component_el_table = ElTable;
  28326. const _component_el_divider = ElDivider;
  28327. const _component_el_input = ElInput;
  28328. const _component_el_input_number = ElInputNumber;
  28329. const _component_el_radio = ElRadio;
  28330. const _component_el_radio_group = ElRadioGroup;
  28331. const _component_el_checkbox = ElCheckbox;
  28332. const _component_el_checkbox_group = ElCheckboxGroup$1;
  28333. const _component_el_time_picker = ElTimePicker;
  28334. const _component_el_date_picker = ElDatePicker;
  28335. const _component_el_rate = ElRate;
  28336. const _component_el_option = ElOption;
  28337. const _component_el_select = ElSelect;
  28338. const _component_el_switch = ElSwitch;
  28339. const _component_el_slider = ElSlider;
  28340. const _component_el_image = ElImage;
  28341. const _component_el_button = ElButton;
  28342. const _component_el_upload = ElUpload;
  28343. const _component_el_cascader = ElCascader;
  28344. const _component_el_form_item = ElFormItem;
  28345. return openBlock(), createElementBlock("div", {
  28346. class: normalizeClass(["widget-view", { active: ((_a2 = selectWidget.value) == null ? void 0 : _a2.key) === __props.element.key, col: __props.element.type === "grid" }]),
  28347. style: normalizeStyle(__props.element.type === "grid" ? `gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};` : ""),
  28348. onClick: _cache[3] || (_cache[3] = withModifiers(($event) => selectWidget.value = __props.element, ["stop"]))
  28349. }, [
  28350. __props.element.type === "grid" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.element.columns, (col, key) => {
  28351. return openBlock(), createBlock(unref(Draggable), {
  28352. key,
  28353. class: "bg-white min-h-12 border border-dashed border-gray-300",
  28354. style: normalizeStyle(`grid-column: span ${col.span}`),
  28355. "item-key": "key",
  28356. handle: "[cursor-move]",
  28357. animation: 200,
  28358. group: "form-design",
  28359. "no-transition-on-drag": true,
  28360. list: col.list,
  28361. onAdd: ($event) => selectWidget.value = col.list[$event.newIndex]
  28362. }, {
  28363. item: withCtx(({ element: colElement, index: colIndex }) => [
  28364. createVNode(_component_WidgetFormItem, {
  28365. selectWidget: selectWidget.value,
  28366. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => selectWidget.value = $event),
  28367. element: colElement,
  28368. list: col.list,
  28369. index: colIndex
  28370. }, null, 8, ["selectWidget", "element", "list", "index"])
  28371. ]),
  28372. _: 2
  28373. }, 1032, ["style", "list", "onAdd"]);
  28374. }), 128)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  28375. key: 1,
  28376. class: "w-0 flex-1",
  28377. border: "",
  28378. data: __props.element.options.defaultValue
  28379. }, {
  28380. default: withCtx(() => [
  28381. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  28382. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  28383. key: i.prop,
  28384. "header-align": __props.element.options.align,
  28385. align: __props.element.options.align
  28386. }, i), null, 16, ["header-align", "align"]);
  28387. }), 128))
  28388. ]),
  28389. _: 1
  28390. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  28391. key: 2,
  28392. class: "pb-0",
  28393. data: __props.element.options.defaultValue,
  28394. "content-position": "left"
  28395. }, {
  28396. default: withCtx(() => [
  28397. createTextVNode(toDisplayString(__props.element.label), 1)
  28398. ]),
  28399. _: 1
  28400. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  28401. key: __props.element.key,
  28402. label: __props.element.label,
  28403. "label-width": __props.element.labelWidth,
  28404. rules: __props.element.options.rules
  28405. }, {
  28406. default: withCtx(() => [
  28407. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  28408. key: 0,
  28409. readonly: "",
  28410. "model-value": __props.element.options.defaultValue,
  28411. style: normalizeStyle({ width: __props.element.options.width }),
  28412. placeholder: __props.element.options.placeholder,
  28413. maxlength: parseInt(__props.element.options.maxlength),
  28414. clearable: __props.element.options.clearable,
  28415. disabled: __props.element.options.disabled
  28416. }, createSlots({ _: 2 }, [
  28417. __props.element.options.prefix ? {
  28418. name: "prefix",
  28419. fn: withCtx(() => [
  28420. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28421. ])
  28422. } : void 0,
  28423. __props.element.options.suffix ? {
  28424. name: "suffix",
  28425. fn: withCtx(() => [
  28426. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28427. ])
  28428. } : void 0,
  28429. __props.element.options.prepend ? {
  28430. name: "prepend",
  28431. fn: withCtx(() => [
  28432. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28433. ])
  28434. } : void 0,
  28435. __props.element.options.append ? {
  28436. name: "append",
  28437. fn: withCtx(() => [
  28438. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28439. ])
  28440. } : void 0
  28441. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled"])) : createCommentVNode("", true),
  28442. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  28443. key: 1,
  28444. readonly: "",
  28445. "model-value": __props.element.options.defaultValue,
  28446. style: normalizeStyle({ width: __props.element.options.width }),
  28447. placeholder: __props.element.options.placeholder,
  28448. maxlength: parseInt(__props.element.options.maxlength),
  28449. clearable: __props.element.options.clearable,
  28450. disabled: __props.element.options.disabled,
  28451. "show-password": __props.element.options.showPassword
  28452. }, createSlots({ _: 2 }, [
  28453. __props.element.options.prefix ? {
  28454. name: "prefix",
  28455. fn: withCtx(() => [
  28456. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  28457. ])
  28458. } : void 0,
  28459. __props.element.options.suffix ? {
  28460. name: "suffix",
  28461. fn: withCtx(() => [
  28462. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  28463. ])
  28464. } : void 0,
  28465. __props.element.options.prepend ? {
  28466. name: "prepend",
  28467. fn: withCtx(() => [
  28468. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  28469. ])
  28470. } : void 0,
  28471. __props.element.options.append ? {
  28472. name: "append",
  28473. fn: withCtx(() => [
  28474. createTextVNode(toDisplayString(__props.element.options.append), 1)
  28475. ])
  28476. } : void 0
  28477. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled", "show-password"])) : createCommentVNode("", true),
  28478. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  28479. key: 2,
  28480. type: "textarea",
  28481. resize: "none",
  28482. readonly: "",
  28483. rows: __props.element.options.rows,
  28484. "model-value": __props.element.options.defaultValue,
  28485. style: normalizeStyle({ width: __props.element.options.width }),
  28486. placeholder: __props.element.options.placeholder,
  28487. maxlength: parseInt(__props.element.options.maxlength),
  28488. "show-word-limit": __props.element.options.showWordLimit,
  28489. autosize: __props.element.options.autosize,
  28490. clearable: __props.element.options.clearable,
  28491. disabled: __props.element.options.disabled
  28492. }, null, 8, ["rows", "model-value", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "disabled"])) : createCommentVNode("", true),
  28493. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  28494. key: 3,
  28495. "model-value": __props.element.options.defaultValue,
  28496. style: normalizeStyle({ width: __props.element.options.width }),
  28497. max: __props.element.options.max,
  28498. min: __props.element.options.min,
  28499. disabled: __props.element.options.disabled
  28500. }, null, 8, ["model-value", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  28501. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  28502. key: 4,
  28503. "model-value": __props.element.options.defaultValue,
  28504. style: normalizeStyle({ width: __props.element.options.width }),
  28505. disabled: __props.element.options.disabled
  28506. }, {
  28507. default: withCtx(() => [
  28508. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28509. return openBlock(), createBlock(_component_el_radio, {
  28510. key: item.value,
  28511. label: item.value,
  28512. style: normalizeStyle({
  28513. display: __props.element.options.inline ? "inline-block" : "block"
  28514. })
  28515. }, {
  28516. default: withCtx(() => [
  28517. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28518. ]),
  28519. _: 2
  28520. }, 1032, ["label", "style"]);
  28521. }), 128))
  28522. ]),
  28523. _: 1
  28524. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  28525. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  28526. key: 5,
  28527. "model-value": __props.element.options.defaultValue,
  28528. style: normalizeStyle({ width: __props.element.options.width }),
  28529. disabled: __props.element.options.disabled
  28530. }, {
  28531. default: withCtx(() => [
  28532. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28533. return openBlock(), createBlock(_component_el_checkbox, {
  28534. key: item.value,
  28535. label: item.value,
  28536. style: normalizeStyle({
  28537. display: __props.element.options.inline ? "inline-block" : "block"
  28538. })
  28539. }, {
  28540. default: withCtx(() => [
  28541. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  28542. ]),
  28543. _: 2
  28544. }, 1032, ["label", "style"]);
  28545. }), 128))
  28546. ]),
  28547. _: 1
  28548. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  28549. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_time_picker, {
  28550. key: 6,
  28551. "model-value": __props.element.options.defaultValue,
  28552. placeholder: __props.element.options.placeholder,
  28553. readonly: __props.element.options.readonly,
  28554. editable: __props.element.options.editable,
  28555. clearable: __props.element.options.clearable,
  28556. format: __props.element.options.format,
  28557. disabled: __props.element.options.disabled,
  28558. style: normalizeStyle({ width: __props.element.options.width })
  28559. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  28560. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_date_picker, {
  28561. key: 7,
  28562. "model-value": __props.element.options.defaultValue,
  28563. placeholder: __props.element.options.placeholder,
  28564. readonly: __props.element.options.readonly,
  28565. editable: __props.element.options.editable,
  28566. clearable: __props.element.options.clearable,
  28567. format: __props.element.options.format,
  28568. disabled: __props.element.options.disabled,
  28569. style: normalizeStyle({ width: __props.element.options.width })
  28570. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  28571. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  28572. key: 8,
  28573. "model-value": __props.element.options.defaultValue,
  28574. max: __props.element.options.max,
  28575. "allow-half": __props.element.options.allowHalf,
  28576. disabled: __props.element.options.disabled
  28577. }, null, 8, ["model-value", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  28578. __props.element.type === "select" ? (openBlock(), createBlock(_component_el_select, {
  28579. key: 9,
  28580. "model-value": __props.element.options.defaultValue,
  28581. multiple: __props.element.options.multiple,
  28582. placeholder: __props.element.options.placeholder,
  28583. clearable: __props.element.options.clearable,
  28584. filterable: __props.element.options.filterable,
  28585. disabled: __props.element.options.disabled,
  28586. style: normalizeStyle({ width: __props.element.options.width })
  28587. }, {
  28588. default: withCtx(() => [
  28589. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  28590. return openBlock(), createBlock(_component_el_option, {
  28591. key: item.value,
  28592. value: item.value,
  28593. label: __props.element.options.showLabel ? item.label : item.value
  28594. }, null, 8, ["value", "label"]);
  28595. }), 128))
  28596. ]),
  28597. _: 1
  28598. }, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"])) : createCommentVNode("", true),
  28599. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  28600. key: 10,
  28601. "model-value": __props.element.options.defaultValue,
  28602. "active-text": __props.element.options.activeText,
  28603. "inactive-text": __props.element.options.inactiveText,
  28604. disabled: __props.element.options.disabled
  28605. }, null, 8, ["model-value", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  28606. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  28607. key: 11,
  28608. "model-value": __props.element.options.defaultValue,
  28609. min: __props.element.options.min,
  28610. max: __props.element.options.max,
  28611. step: __props.element.options.step,
  28612. range: __props.element.options.range,
  28613. disabled: __props.element.options.disabled,
  28614. style: normalizeStyle({ width: __props.element.options.width })
  28615. }, null, 8, ["model-value", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  28616. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$4, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  28617. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  28618. key: 13,
  28619. name: __props.element.options.file,
  28620. action: __props.element.options.action,
  28621. accept: __props.element.options.accept,
  28622. "list-type": __props.element.options.listType,
  28623. multiple: __props.element.options.multiple,
  28624. limit: __props.element.options.limit,
  28625. disabled: __props.element.options.disabled
  28626. }, {
  28627. default: withCtx(() => {
  28628. var _a3;
  28629. return [
  28630. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  28631. ((_a3 = __props.element.options.defaultValue) == null ? void 0 : _a3.length) ? (openBlock(), createBlock(_component_el_image, {
  28632. key: 0,
  28633. style: { "width": "100%", "height": "100%" },
  28634. "preview-src-list": [
  28635. "/api/sys/common/static/" + __props.element.options.defaultValue
  28636. ],
  28637. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  28638. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$3))
  28639. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  28640. default: withCtx(() => [
  28641. _hoisted_3$3,
  28642. _hoisted_4$3
  28643. ]),
  28644. _: 1
  28645. }))
  28646. ];
  28647. }),
  28648. _: 1
  28649. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  28650. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  28651. key: 14,
  28652. type: "text",
  28653. style: { "margin-top": "-4px" }
  28654. }, {
  28655. default: withCtx(() => [
  28656. _hoisted_5$3
  28657. ]),
  28658. _: 1
  28659. })) : createCommentVNode("", true),
  28660. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  28661. key: 15,
  28662. "model-value": __props.element.options.defaultValue,
  28663. options: __props.element.options.remoteOptions,
  28664. placeholder: __props.element.options.placeholder,
  28665. filterable: __props.element.options.filterable,
  28666. clearable: __props.element.options.clearable,
  28667. disabled: __props.element.options.disabled,
  28668. style: normalizeStyle({ width: __props.element.options.width })
  28669. }, null, 8, ["model-value", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  28670. ]),
  28671. _: 1
  28672. }, 8, ["label", "label-width", "rules"])) : createCommentVNode("", true),
  28673. ((_b2 = selectWidget.value) == null ? void 0 : _b2.key) === __props.element.key ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  28674. createElementVNode("div", {
  28675. absolute: "",
  28676. "z-10": "",
  28677. "left-0": "",
  28678. top: "-.5",
  28679. "bg-blue-500": "",
  28680. "text-white": "",
  28681. p: ".5 l-0 t-0",
  28682. "cursor-move": "",
  28683. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  28684. }, _hoisted_7$2, 2),
  28685. createElementVNode("div", {
  28686. absolute: "",
  28687. "z-10": "",
  28688. "right-0": "",
  28689. bottom: "-0.5",
  28690. "bg-blue-500": "",
  28691. flex: "",
  28692. "gap-1": "",
  28693. p: "1 r-.5",
  28694. "text-white": "",
  28695. "cursor-pointer": "",
  28696. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  28697. }, [
  28698. createCommentVNode("", true),
  28699. !__props.element.allDisable ? (openBlock(), createElementBlock("i", {
  28700. key: 1,
  28701. class: "fa6-regular:trash-can",
  28702. onClick: _cache[2] || (_cache[2] = withModifiers(($event) => handleDeleteClick(), ["stop"]))
  28703. })) : createCommentVNode("", true)
  28704. ], 2)
  28705. ], 64)) : createCommentVNode("", true)
  28706. ], 6);
  28707. };
  28708. }
  28709. });
  28710. var WidgetForm_vue_vue_type_style_index_0_lang = "";
  28711. const _hoisted_1$3 = {
  28712. key: 0,
  28713. text: "gray-400 lg",
  28714. absolute: "",
  28715. "top-50": "",
  28716. left: "1/2",
  28717. "translate-x": "-1/2"
  28718. };
  28719. const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  28720. props: {
  28721. list: null,
  28722. config: null,
  28723. selectWidget: null
  28724. },
  28725. emits: ["update:selectWidget"],
  28726. setup(__props) {
  28727. const props = __props;
  28728. const selectWidget = useVModel(props, "selectWidget");
  28729. return (_ctx, _cache) => {
  28730. const _component_el_form = ElForm;
  28731. return openBlock(), createBlock(_component_el_form, mergeProps({
  28732. "label-suffix": ":",
  28733. "bg-gray-50": "",
  28734. relative: "",
  28735. flex: "~ 1"
  28736. }, __props.config, { class: "layoutForm" }), {
  28737. default: withCtx(() => {
  28738. var _a2;
  28739. return [
  28740. !((_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),
  28741. createVNode(unref(Draggable), {
  28742. class: "flex-1 m-2 bg-white shadow p-1",
  28743. "item-key": "key",
  28744. handle: "[cursor-move]",
  28745. animation: 200,
  28746. group: "form-design",
  28747. list: __props.list,
  28748. onAdd: _cache[1] || (_cache[1] = ($event) => selectWidget.value = __props.list[$event.newIndex])
  28749. }, {
  28750. item: withCtx(({ element, index }) => [
  28751. createVNode(_sfc_main$5, {
  28752. selectWidget: unref(selectWidget),
  28753. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => isRef(selectWidget) ? selectWidget.value = $event : null),
  28754. element,
  28755. index,
  28756. list: __props.list
  28757. }, null, 8, ["selectWidget", "element", "index", "list"])
  28758. ]),
  28759. _: 1
  28760. }, 8, ["list"])
  28761. ];
  28762. }),
  28763. _: 1
  28764. }, 16);
  28765. };
  28766. }
  28767. });
  28768. var elSpace = "";
  28769. var elRadioButton = "";
  28770. var WidgetConfig_vue_vue_type_style_index_0_lang = "";
  28771. const _sfc_main$3 = defineComponent({
  28772. name: "ElWidgetConfig",
  28773. components: {
  28774. Draggable
  28775. },
  28776. props: {
  28777. select: {
  28778. type: Object
  28779. }
  28780. },
  28781. emits: ["update:select"],
  28782. setup(props, context) {
  28783. const data2 = ref(props.select);
  28784. watch(() => props.select, (val) => data2.value = val);
  28785. watch(data2, (val) => context.emit("update:select", val), { deep: true });
  28786. const hasKey = (key) => Object.keys(data2.value.options).includes(key);
  28787. const handleInsertColumn = () => {
  28788. data2.value.columns.push({
  28789. span: 0,
  28790. list: []
  28791. });
  28792. };
  28793. const handleInsertOption = () => {
  28794. const index = data2.value.options.options.length + 1;
  28795. data2.value.options.options.push({
  28796. label: `Option ${index}`,
  28797. value: `Option ${index}`
  28798. });
  28799. };
  28800. const handleOptionsRemove = (index) => {
  28801. if (data2.value.type === "grid")
  28802. data2.value.columns.splice(index, 1);
  28803. else
  28804. data2.value.options.options.splice(index, 1);
  28805. };
  28806. const handleSliderModeChange = (checked) => {
  28807. checked ? data2.value.options.defaultValue = [10, 90] : data2.value.options.defaultValue = 0;
  28808. };
  28809. const handleSelectModeChange = (val) => {
  28810. if (data2.value.type === "img-upload")
  28811. return;
  28812. if (val) {
  28813. if (data2.value.options.defaultValue) {
  28814. if (!(data2.value.options.defaultValue instanceof Array))
  28815. data2.value.options.defaultValue = [data2.value.options.defaultValue];
  28816. } else {
  28817. data2.value.options.defaultValue = [];
  28818. }
  28819. } else {
  28820. data2.value.options.defaultValue.length ? data2.value.options.defaultValue = data2.value.options.defaultValue[0] : data2.value.options.defaultValue = null;
  28821. }
  28822. };
  28823. return {
  28824. data: data2,
  28825. hasKey,
  28826. handleInsertColumn,
  28827. handleInsertOption,
  28828. handleOptionsRemove,
  28829. handleSliderModeChange,
  28830. handleSelectModeChange
  28831. };
  28832. }
  28833. });
  28834. const _hoisted_1$2 = /* @__PURE__ */ createTextVNode(" \u884C\u5185 ");
  28835. const _hoisted_2$2 = /* @__PURE__ */ createTextVNode(" \u5757\u7EA7 ");
  28836. const _hoisted_3$2 = /* @__PURE__ */ createTextVNode(" \u9759\u6001\u6570\u636E ");
  28837. const _hoisted_4$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u6570\u636E ");
  28838. const _hoisted_5$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  28839. const _hoisted_6$2 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  28840. const _hoisted_7$1 = /* @__PURE__ */ createTextVNode(" \u503C ");
  28841. const _hoisted_8$1 = { class: "flex items-center" };
  28842. const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("i", {
  28843. style: { "margin": "0 5px", "cursor": "move" },
  28844. class: "drag-item custom:item"
  28845. }, null, -1);
  28846. const _hoisted_10$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28847. const _hoisted_11$1 = { class: "flex items-center justify-center gap-2 mb-2" };
  28848. const _hoisted_12$1 = /* @__PURE__ */ createTextVNode(/* @__PURE__ */ toDisplayString(""));
  28849. const _hoisted_13$1 = /* @__PURE__ */ createElementVNode("i", { class: "cursor-move text-sm custom:item" }, null, -1);
  28850. const _hoisted_14$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28851. const _hoisted_15 = { style: { "margin-top": "5px" } };
  28852. const _hoisted_16 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u9009\u9879 ");
  28853. const _hoisted_17 = /* @__PURE__ */ createTextVNode(" text ");
  28854. const _hoisted_18 = /* @__PURE__ */ createTextVNode(" picture ");
  28855. const _hoisted_19 = /* @__PURE__ */ createTextVNode(" picture-card ");
  28856. const _hoisted_20 = /* @__PURE__ */ createTextVNode(" POST ");
  28857. const _hoisted_21 = /* @__PURE__ */ createTextVNode(" PUT ");
  28858. const _hoisted_22 = /* @__PURE__ */ createTextVNode(" GET ");
  28859. const _hoisted_23 = /* @__PURE__ */ createTextVNode(" DELETE ");
  28860. const _hoisted_24 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  28861. const _hoisted_25 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  28862. const _hoisted_26 = /* @__PURE__ */ createTextVNode(" \u503C ");
  28863. const _hoisted_27 = /* @__PURE__ */ createTextVNode(" \u5B50\u9009\u9879 ");
  28864. const _hoisted_28 = { style: { "display": "flex", "gap": "5px", "margin-bottom": "5px" } };
  28865. const _hoisted_29 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  28866. const _hoisted_30 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28867. const _hoisted_31 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  28868. const _hoisted_32 = /* @__PURE__ */ createTextVNode(" \u5C45\u5DE6\u5BF9\u9F50 ");
  28869. const _hoisted_33 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  28870. const _hoisted_34 = /* @__PURE__ */ createTextVNode(" \u5DE8\u53F3\u5BF9\u9F50 ");
  28871. const _hoisted_35 = { style: { "margin-bottom": "5px" } };
  28872. const _hoisted_36 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  28873. const _hoisted_37 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  28874. const _hoisted_38 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  28875. const _hoisted_39 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  28876. const _hoisted_40 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  28877. const _hoisted_41 = /* @__PURE__ */ createTextVNode(" \u5E95\u90E8\u5BF9\u9F50 ");
  28878. const _hoisted_42 = /* @__PURE__ */ createTextVNode(" \u5FC5\u586B ");
  28879. const _hoisted_43 = /* @__PURE__ */ createTextVNode(" \u53EA\u8BFB ");
  28880. const _hoisted_44 = /* @__PURE__ */ createTextVNode(" \u7981\u7528 ");
  28881. const _hoisted_45 = /* @__PURE__ */ createTextVNode(" \u6E05\u9664 ");
  28882. 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);
  28883. const _hoisted_47 = /* @__PURE__ */ createTextVNode(" Blur ");
  28884. const _hoisted_48 = /* @__PURE__ */ createTextVNode(" Change ");
  28885. const _hoisted_49 = /* @__PURE__ */ createTextVNode(" \u5B57\u7B26\u4E32 ");
  28886. const _hoisted_50 = /* @__PURE__ */ createTextVNode(" \u6570\u5B57 ");
  28887. const _hoisted_51 = /* @__PURE__ */ createTextVNode(" \u5E03\u5C14\u503C ");
  28888. const _hoisted_52 = /* @__PURE__ */ createTextVNode(" \u65B9\u6CD5 ");
  28889. const _hoisted_53 = /* @__PURE__ */ createTextVNode(" \u6B63\u5219\u8868\u8FBE\u5F0F ");
  28890. const _hoisted_54 = /* @__PURE__ */ createTextVNode(" \u6574\u6570 ");
  28891. const _hoisted_55 = /* @__PURE__ */ createTextVNode(" \u6D6E\u70B9\u6570 ");
  28892. const _hoisted_56 = /* @__PURE__ */ createTextVNode(" \u6570\u7EC4 ");
  28893. const _hoisted_57 = /* @__PURE__ */ createTextVNode(" \u5BF9\u8C61 ");
  28894. const _hoisted_58 = /* @__PURE__ */ createTextVNode(" \u679A\u4E3E ");
  28895. const _hoisted_59 = /* @__PURE__ */ createTextVNode(" \u65E5\u671F ");
  28896. const _hoisted_60 = /* @__PURE__ */ createTextVNode(" URL\u5730\u5740 ");
  28897. const _hoisted_61 = /* @__PURE__ */ createTextVNode(" \u5341\u516D\u8FDB\u5236 ");
  28898. const _hoisted_62 = /* @__PURE__ */ createTextVNode(" \u90AE\u7BB1\u5730\u5740 ");
  28899. const _hoisted_63 = /* @__PURE__ */ createTextVNode(" \u4EFB\u610F\u7C7B\u578B ");
  28900. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  28901. const _component_el_input = ElInput;
  28902. const _component_el_form_item = ElFormItem;
  28903. const _component_el_rate = ElRate;
  28904. const _component_el_switch = ElSwitch;
  28905. const _component_el_input_number = ElInputNumber;
  28906. const _component_el_radio_button = ElRadioButton;
  28907. const _component_el_radio_group = ElRadioGroup;
  28908. const _component_el_space = ElSpace;
  28909. const _component_el_radio = ElRadio;
  28910. const _component_el_button = ElButton;
  28911. const _component_Draggable = resolveComponent("Draggable");
  28912. const _component_el_checkbox = ElCheckbox;
  28913. const _component_el_checkbox_group = ElCheckboxGroup$1;
  28914. const _component_el_time_picker = ElTimePicker;
  28915. const _component_el_date_picker = ElDatePicker;
  28916. const _component_el_option = ElOption;
  28917. const _component_el_select = ElSelect;
  28918. const _component_el_form = ElForm;
  28919. return _ctx.data ? (openBlock(), createBlock(_component_el_form, {
  28920. key: _ctx.data.key,
  28921. "label-position": "top",
  28922. "p-2": "",
  28923. "flex-1": "",
  28924. "overflow-auto": ""
  28925. }, {
  28926. default: withCtx(() => [
  28927. !["grid"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  28928. key: 0,
  28929. label: "\u5B57\u6BB5\u6807\u8BC6"
  28930. }, {
  28931. default: withCtx(() => [
  28932. createVNode(_component_el_input, {
  28933. modelValue: _ctx.data.model,
  28934. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data.model = $event),
  28935. disabled: true
  28936. }, null, 8, ["modelValue"])
  28937. ]),
  28938. _: 1
  28939. })) : createCommentVNode("", true),
  28940. !["grid", "table"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  28941. key: 1,
  28942. label: "\u6807\u9898"
  28943. }, {
  28944. default: withCtx(() => [
  28945. createVNode(_component_el_input, {
  28946. modelValue: _ctx.data.label,
  28947. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data.label = $event),
  28948. disabled: _ctx.data.allDisable
  28949. }, null, 8, ["modelValue", "disabled"])
  28950. ]),
  28951. _: 1
  28952. })) : createCommentVNode("", true),
  28953. _ctx.hasKey("width") ? (openBlock(), createBlock(_component_el_form_item, {
  28954. key: 2,
  28955. label: "\u5BBD\u5EA6"
  28956. }, {
  28957. default: withCtx(() => [
  28958. createVNode(_component_el_input, {
  28959. modelValue: _ctx.data.options.width,
  28960. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.data.options.width = $event)
  28961. }, null, 8, ["modelValue"])
  28962. ]),
  28963. _: 1
  28964. })) : createCommentVNode("", true),
  28965. _ctx.hasKey("placeholder") ? (openBlock(), createBlock(_component_el_form_item, {
  28966. key: 3,
  28967. label: "\u5360\u4F4D\u5185\u5BB9"
  28968. }, {
  28969. default: withCtx(() => [
  28970. createVNode(_component_el_input, {
  28971. modelValue: _ctx.data.options.placeholder,
  28972. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.data.options.placeholder = $event),
  28973. disabled: _ctx.data.allDisable
  28974. }, null, 8, ["modelValue", "disabled"])
  28975. ]),
  28976. _: 1
  28977. })) : createCommentVNode("", true),
  28978. _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, {
  28979. key: 4,
  28980. label: "\u9ED8\u8BA4\u5185\u5BB9"
  28981. }, {
  28982. default: withCtx(() => [
  28983. _ctx.data.type === "input" || _ctx.data.type === "password" || _ctx.data.type === "text" ? (openBlock(), createBlock(_component_el_input, {
  28984. key: 0,
  28985. modelValue: _ctx.data.options.defaultValue,
  28986. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.data.options.defaultValue = $event)
  28987. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  28988. _ctx.data.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  28989. key: 1,
  28990. modelValue: _ctx.data.options.defaultValue,
  28991. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => _ctx.data.options.defaultValue = $event),
  28992. type: "textarea"
  28993. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  28994. _ctx.data.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  28995. key: 2,
  28996. modelValue: _ctx.data.options.defaultValue,
  28997. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.data.options.defaultValue = $event),
  28998. max: _ctx.data.options.max,
  28999. "allow-half": _ctx.data.options.allowHalf
  29000. }, null, 8, ["modelValue", "max", "allow-half"])) : createCommentVNode("", true),
  29001. _ctx.data.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  29002. key: 3,
  29003. modelValue: _ctx.data.options.defaultValue,
  29004. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.data.options.defaultValue = $event)
  29005. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29006. _ctx.data.type === "slider" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  29007. !_ctx.data.options.range ? (openBlock(), createBlock(_component_el_input_number, {
  29008. key: 0,
  29009. modelValue: _ctx.data.options.defaultValue,
  29010. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => _ctx.data.options.defaultValue = $event),
  29011. modelModifiers: { number: true }
  29012. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  29013. _ctx.data.options.range ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29014. createVNode(_component_el_input_number, {
  29015. modelValue: _ctx.data.options.defaultValue[0],
  29016. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => _ctx.data.options.defaultValue[0] = $event),
  29017. modelModifiers: { number: true },
  29018. max: _ctx.data.options.max
  29019. }, null, 8, ["modelValue", "max"]),
  29020. createVNode(_component_el_input_number, {
  29021. modelValue: _ctx.data.options.defaultValue[1],
  29022. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => _ctx.data.options.defaultValue[1] = $event),
  29023. modelModifiers: { number: true },
  29024. max: _ctx.data.options.max
  29025. }, null, 8, ["modelValue", "max"])
  29026. ], 64)) : createCommentVNode("", true)
  29027. ], 64)) : createCommentVNode("", true)
  29028. ]),
  29029. _: 1
  29030. })) : createCommentVNode("", true),
  29031. _ctx.hasKey("maxlength") ? (openBlock(), createBlock(_component_el_form_item, {
  29032. key: 5,
  29033. label: "\u6700\u5927\u957F\u5EA6"
  29034. }, {
  29035. default: withCtx(() => [
  29036. createVNode(_component_el_input, {
  29037. modelValue: _ctx.data.options.maxlength,
  29038. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => _ctx.data.options.maxlength = $event),
  29039. modelModifiers: { number: true },
  29040. disabled: _ctx.data.allDisable
  29041. }, null, 8, ["modelValue", "disabled"])
  29042. ]),
  29043. _: 1
  29044. })) : createCommentVNode("", true),
  29045. _ctx.hasKey("max") ? (openBlock(), createBlock(_component_el_form_item, {
  29046. key: 6,
  29047. label: "\u6700\u5927\u503C"
  29048. }, {
  29049. default: withCtx(() => [
  29050. createVNode(_component_el_input_number, {
  29051. modelValue: _ctx.data.options.max,
  29052. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => _ctx.data.options.max = $event),
  29053. modelModifiers: { number: true },
  29054. disabled: _ctx.data.allDisable
  29055. }, null, 8, ["modelValue", "disabled"])
  29056. ]),
  29057. _: 1
  29058. })) : createCommentVNode("", true),
  29059. _ctx.hasKey("min") ? (openBlock(), createBlock(_component_el_form_item, {
  29060. key: 7,
  29061. label: "\u6700\u5C0F\u503C"
  29062. }, {
  29063. default: withCtx(() => [
  29064. createVNode(_component_el_input_number, {
  29065. modelValue: _ctx.data.options.min,
  29066. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => _ctx.data.options.min = $event),
  29067. modelModifiers: { number: true },
  29068. disabled: _ctx.data.allDisable
  29069. }, null, 8, ["modelValue", "disabled"])
  29070. ]),
  29071. _: 1
  29072. })) : createCommentVNode("", true),
  29073. _ctx.hasKey("step") ? (openBlock(), createBlock(_component_el_form_item, {
  29074. key: 8,
  29075. label: "\u6B65\u957F"
  29076. }, {
  29077. default: withCtx(() => [
  29078. createVNode(_component_el_input_number, {
  29079. modelValue: _ctx.data.options.step,
  29080. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => _ctx.data.options.step = $event),
  29081. modelModifiers: { number: true },
  29082. min: 0,
  29083. disabled: _ctx.data.allDisable
  29084. }, null, 8, ["modelValue", "disabled"])
  29085. ]),
  29086. _: 1
  29087. })) : createCommentVNode("", true),
  29088. _ctx.hasKey("prefix") ? (openBlock(), createBlock(_component_el_form_item, {
  29089. key: 9,
  29090. label: "\u524D\u7F00"
  29091. }, {
  29092. default: withCtx(() => [
  29093. createVNode(_component_el_input, {
  29094. modelValue: _ctx.data.options.prefix,
  29095. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.data.options.prefix = $event),
  29096. disabled: _ctx.data.allDisable
  29097. }, null, 8, ["modelValue", "disabled"])
  29098. ]),
  29099. _: 1
  29100. })) : createCommentVNode("", true),
  29101. _ctx.hasKey("suffix") ? (openBlock(), createBlock(_component_el_form_item, {
  29102. key: 10,
  29103. label: "\u540E\u7F00"
  29104. }, {
  29105. default: withCtx(() => [
  29106. createVNode(_component_el_input, {
  29107. modelValue: _ctx.data.options.suffix,
  29108. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.data.options.suffix = $event),
  29109. disabled: _ctx.data.allDisable
  29110. }, null, 8, ["modelValue", "disabled"])
  29111. ]),
  29112. _: 1
  29113. })) : createCommentVNode("", true),
  29114. _ctx.hasKey("prepend") ? (openBlock(), createBlock(_component_el_form_item, {
  29115. key: 11,
  29116. label: "\u524D\u7F6E\u6807\u7B7E"
  29117. }, {
  29118. default: withCtx(() => [
  29119. createVNode(_component_el_input, {
  29120. modelValue: _ctx.data.options.prepend,
  29121. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => _ctx.data.options.prepend = $event),
  29122. disabled: _ctx.data.allDisable
  29123. }, null, 8, ["modelValue", "disabled"])
  29124. ]),
  29125. _: 1
  29126. })) : createCommentVNode("", true),
  29127. _ctx.hasKey("append") ? (openBlock(), createBlock(_component_el_form_item, {
  29128. key: 12,
  29129. label: "\u540E\u7F6E\u6807\u7B7E"
  29130. }, {
  29131. default: withCtx(() => [
  29132. createVNode(_component_el_input, {
  29133. modelValue: _ctx.data.options.append,
  29134. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => _ctx.data.options.append = $event),
  29135. disabled: _ctx.data.allDisable
  29136. }, null, 8, ["modelValue", "disabled"])
  29137. ]),
  29138. _: 1
  29139. })) : createCommentVNode("", true),
  29140. _ctx.hasKey("activeText") ? (openBlock(), createBlock(_component_el_form_item, {
  29141. key: 13,
  29142. label: "\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  29143. }, {
  29144. default: withCtx(() => [
  29145. createVNode(_component_el_input, {
  29146. modelValue: _ctx.data.options.activeText,
  29147. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => _ctx.data.options.activeText = $event)
  29148. }, null, 8, ["modelValue"])
  29149. ]),
  29150. _: 1
  29151. })) : createCommentVNode("", true),
  29152. _ctx.hasKey("inactiveText") ? (openBlock(), createBlock(_component_el_form_item, {
  29153. key: 14,
  29154. label: "\u975E\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  29155. }, {
  29156. default: withCtx(() => [
  29157. createVNode(_component_el_input, {
  29158. modelValue: _ctx.data.options.inactiveText,
  29159. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => _ctx.data.options.inactiveText = $event)
  29160. }, null, 8, ["modelValue"])
  29161. ]),
  29162. _: 1
  29163. })) : createCommentVNode("", true),
  29164. _ctx.hasKey("editable") ? (openBlock(), createBlock(_component_el_form_item, {
  29165. key: 15,
  29166. label: "\u6587\u672C\u6846\u53EF\u8F93\u5165"
  29167. }, {
  29168. default: withCtx(() => [
  29169. createVNode(_component_el_switch, {
  29170. modelValue: _ctx.data.options.editable,
  29171. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => _ctx.data.options.editable = $event)
  29172. }, null, 8, ["modelValue"])
  29173. ]),
  29174. _: 1
  29175. })) : createCommentVNode("", true),
  29176. _ctx.hasKey("range") ? (openBlock(), createBlock(_component_el_form_item, {
  29177. key: 16,
  29178. label: "\u8303\u56F4\u9009\u62E9"
  29179. }, {
  29180. default: withCtx(() => [
  29181. createVNode(_component_el_switch, {
  29182. modelValue: _ctx.data.options.range,
  29183. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => _ctx.data.options.range = $event),
  29184. onChange: _ctx.handleSliderModeChange
  29185. }, null, 8, ["modelValue", "onChange"])
  29186. ]),
  29187. _: 1
  29188. })) : createCommentVNode("", true),
  29189. _ctx.hasKey("showPassword") ? (openBlock(), createBlock(_component_el_form_item, {
  29190. key: 17,
  29191. label: "\u662F\u5426\u663E\u793A\u5207\u6362\u6309\u94AE"
  29192. }, {
  29193. default: withCtx(() => [
  29194. createVNode(_component_el_switch, {
  29195. modelValue: _ctx.data.options.showPassword,
  29196. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => _ctx.data.options.showPassword = $event)
  29197. }, null, 8, ["modelValue"])
  29198. ]),
  29199. _: 1
  29200. })) : createCommentVNode("", true),
  29201. _ctx.hasKey("showWordLimit") ? (openBlock(), createBlock(_component_el_form_item, {
  29202. key: 18,
  29203. label: "\u662F\u5426\u663E\u793A\u5B57\u6570"
  29204. }, {
  29205. default: withCtx(() => [
  29206. createVNode(_component_el_switch, {
  29207. modelValue: _ctx.data.options.showWordLimit,
  29208. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => _ctx.data.options.showWordLimit = $event)
  29209. }, null, 8, ["modelValue"])
  29210. ]),
  29211. _: 1
  29212. })) : createCommentVNode("", true),
  29213. _ctx.hasKey("autosize") ? (openBlock(), createBlock(_component_el_form_item, {
  29214. key: 19,
  29215. label: "\u662F\u5426\u81EA\u9002\u5E94\u5185\u5BB9\u9AD8\u5EA6"
  29216. }, {
  29217. default: withCtx(() => [
  29218. createVNode(_component_el_switch, {
  29219. modelValue: _ctx.data.options.autosize,
  29220. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => _ctx.data.options.autosize = $event)
  29221. }, null, 8, ["modelValue"])
  29222. ]),
  29223. _: 1
  29224. })) : createCommentVNode("", true),
  29225. _ctx.hasKey("rows") && !_ctx.data.options.autosize ? (openBlock(), createBlock(_component_el_form_item, {
  29226. key: 20,
  29227. label: "\u884C\u6570"
  29228. }, {
  29229. default: withCtx(() => [
  29230. createVNode(_component_el_input_number, {
  29231. modelValue: _ctx.data.options.rows,
  29232. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => _ctx.data.options.rows = $event),
  29233. min: 0
  29234. }, null, 8, ["modelValue"])
  29235. ]),
  29236. _: 1
  29237. })) : createCommentVNode("", true),
  29238. _ctx.hasKey("allowHalf") ? (openBlock(), createBlock(_component_el_form_item, {
  29239. key: 21,
  29240. label: "\u662F\u5426\u5141\u8BB8\u534A\u9009"
  29241. }, {
  29242. default: withCtx(() => [
  29243. createVNode(_component_el_switch, {
  29244. modelValue: _ctx.data.options.allowHalf,
  29245. "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => _ctx.data.options.allowHalf = $event)
  29246. }, null, 8, ["modelValue"])
  29247. ]),
  29248. _: 1
  29249. })) : createCommentVNode("", true),
  29250. _ctx.hasKey("inline") ? (openBlock(), createBlock(_component_el_form_item, {
  29251. key: 22,
  29252. label: "\u5E03\u5C40\u65B9\u5F0F"
  29253. }, {
  29254. default: withCtx(() => [
  29255. createVNode(_component_el_radio_group, {
  29256. modelValue: _ctx.data.options.inline,
  29257. "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => _ctx.data.options.inline = $event)
  29258. }, {
  29259. default: withCtx(() => [
  29260. createVNode(_component_el_radio_button, { label: true }, {
  29261. default: withCtx(() => [
  29262. _hoisted_1$2
  29263. ]),
  29264. _: 1
  29265. }),
  29266. createVNode(_component_el_radio_button, { label: false }, {
  29267. default: withCtx(() => [
  29268. _hoisted_2$2
  29269. ]),
  29270. _: 1
  29271. })
  29272. ]),
  29273. _: 1
  29274. }, 8, ["modelValue"])
  29275. ]),
  29276. _: 1
  29277. })) : createCommentVNode("", true),
  29278. _ctx.hasKey("multiple") ? (openBlock(), createBlock(_component_el_form_item, {
  29279. key: 23,
  29280. label: "\u662F\u5426\u591A\u9009"
  29281. }, {
  29282. default: withCtx(() => [
  29283. createVNode(_component_el_switch, {
  29284. modelValue: _ctx.data.options.multiple,
  29285. "onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => _ctx.data.options.multiple = $event),
  29286. onChange: _ctx.handleSelectModeChange,
  29287. disabled: _ctx.data.allDisable
  29288. }, null, 8, ["modelValue", "onChange", "disabled"])
  29289. ]),
  29290. _: 1
  29291. })) : createCommentVNode("", true),
  29292. _ctx.hasKey("filterable") ? (openBlock(), createBlock(_component_el_form_item, {
  29293. key: 24,
  29294. label: "\u662F\u5426\u53EF\u641C\u7D22"
  29295. }, {
  29296. default: withCtx(() => [
  29297. createVNode(_component_el_switch, {
  29298. modelValue: _ctx.data.options.filterable,
  29299. "onUpdate:modelValue": _cache[30] || (_cache[30] = ($event) => _ctx.data.options.filterable = $event),
  29300. disabled: _ctx.data.allDisable
  29301. }, null, 8, ["modelValue", "disabled"])
  29302. ]),
  29303. _: 1
  29304. })) : createCommentVNode("", true),
  29305. _ctx.hasKey("showLabel") ? (openBlock(), createBlock(_component_el_form_item, {
  29306. key: 25,
  29307. label: "\u662F\u5426\u663E\u793A\u6807\u7B7E"
  29308. }, {
  29309. default: withCtx(() => [
  29310. createVNode(_component_el_switch, {
  29311. modelValue: _ctx.data.options.showLabel,
  29312. "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => _ctx.data.options.showLabel = $event)
  29313. }, null, 8, ["modelValue"])
  29314. ]),
  29315. _: 1
  29316. })) : createCommentVNode("", true),
  29317. _ctx.hasKey("options") ? (openBlock(), createBlock(_component_el_form_item, {
  29318. key: 26,
  29319. label: "\u9009\u9879"
  29320. }, {
  29321. default: withCtx(() => [
  29322. createVNode(_component_el_radio_group, {
  29323. modelValue: _ctx.data.options.remote,
  29324. "onUpdate:modelValue": _cache[32] || (_cache[32] = ($event) => _ctx.data.options.remote = $event)
  29325. }, {
  29326. default: withCtx(() => [
  29327. createVNode(_component_el_radio_button, { label: false }, {
  29328. default: withCtx(() => [
  29329. _hoisted_3$2
  29330. ]),
  29331. _: 1
  29332. }),
  29333. createVNode(_component_el_radio_button, { label: true }, {
  29334. default: withCtx(() => [
  29335. _hoisted_4$2
  29336. ]),
  29337. _: 1
  29338. })
  29339. ]),
  29340. _: 1
  29341. }, 8, ["modelValue"]),
  29342. _ctx.data.options.remote ? (openBlock(), createBlock(_component_el_space, {
  29343. key: 0,
  29344. alignment: "start",
  29345. direction: "vertical",
  29346. style: { "margin-top": "10px" }
  29347. }, {
  29348. default: withCtx(() => [
  29349. createVNode(_component_el_input, {
  29350. modelValue: _ctx.data.options.remoteFunc,
  29351. "onUpdate:modelValue": _cache[33] || (_cache[33] = ($event) => _ctx.data.options.remoteFunc = $event)
  29352. }, {
  29353. prepend: withCtx(() => [
  29354. _hoisted_5$2
  29355. ]),
  29356. _: 1
  29357. }, 8, ["modelValue"]),
  29358. createVNode(_component_el_input, {
  29359. modelValue: _ctx.data.options.props.label,
  29360. "onUpdate:modelValue": _cache[34] || (_cache[34] = ($event) => _ctx.data.options.props.label = $event)
  29361. }, {
  29362. prepend: withCtx(() => [
  29363. _hoisted_6$2
  29364. ]),
  29365. _: 1
  29366. }, 8, ["modelValue"]),
  29367. createVNode(_component_el_input, {
  29368. modelValue: _ctx.data.options.props.value,
  29369. "onUpdate:modelValue": _cache[35] || (_cache[35] = ($event) => _ctx.data.options.props.value = $event)
  29370. }, {
  29371. prepend: withCtx(() => [
  29372. _hoisted_7$1
  29373. ]),
  29374. _: 1
  29375. }, 8, ["modelValue"])
  29376. ]),
  29377. _: 1
  29378. })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29379. _ctx.data.type === "radio" || _ctx.data.type === "select" && !_ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_radio_group, {
  29380. key: 0,
  29381. modelValue: _ctx.data.options.defaultValue,
  29382. "onUpdate:modelValue": _cache[36] || (_cache[36] = ($event) => _ctx.data.options.defaultValue = $event),
  29383. style: { "margin-top": "8px" }
  29384. }, {
  29385. default: withCtx(() => [
  29386. createVNode(_component_Draggable, {
  29387. "item-key": "index",
  29388. "ghost-class": "ghost",
  29389. handle: ".drag-item",
  29390. group: { name: "options" },
  29391. list: _ctx.data.options.options
  29392. }, {
  29393. item: withCtx(({ element, index }) => [
  29394. createElementVNode("div", _hoisted_8$1, [
  29395. createVNode(_component_el_radio, {
  29396. label: element.value,
  29397. style: { "margin-right": "0", "margin-bottom": "0" }
  29398. }, {
  29399. default: withCtx(() => [
  29400. createVNode(_component_el_input, {
  29401. modelValue: element.value,
  29402. "onUpdate:modelValue": ($event) => element.value = $event,
  29403. style: normalizeStyle({
  29404. width: _ctx.data.options.showLabel ? "90px" : "180px"
  29405. })
  29406. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  29407. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  29408. key: 0,
  29409. modelValue: element.label,
  29410. "onUpdate:modelValue": ($event) => element.label = $event,
  29411. class: "ml-1",
  29412. style: {
  29413. width: "90px"
  29414. }
  29415. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true)
  29416. ]),
  29417. _: 2
  29418. }, 1032, ["label"]),
  29419. _hoisted_9$1,
  29420. createVNode(_component_el_button, {
  29421. type: "primary",
  29422. circle: "",
  29423. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29424. }, {
  29425. default: withCtx(() => [
  29426. _hoisted_10$1
  29427. ]),
  29428. _: 2
  29429. }, 1032, ["onClick"])
  29430. ])
  29431. ]),
  29432. _: 1
  29433. }, 8, ["list"])
  29434. ]),
  29435. _: 1
  29436. }, 8, ["modelValue"])) : createCommentVNode("", true),
  29437. _ctx.data.type === "checkbox" || _ctx.data.type === "select" && _ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_checkbox_group, {
  29438. key: 1,
  29439. modelValue: _ctx.data.options.defaultValue,
  29440. "onUpdate:modelValue": _cache[37] || (_cache[37] = ($event) => _ctx.data.options.defaultValue = $event),
  29441. style: { "margin-top": "8px" }
  29442. }, {
  29443. default: withCtx(() => [
  29444. createVNode(_component_Draggable, {
  29445. "item-key": "index",
  29446. "ghost-class": "ghost",
  29447. handle: "[cursor-move]",
  29448. group: { name: "options" },
  29449. list: _ctx.data.options.options
  29450. }, {
  29451. item: withCtx(({ element, index }) => [
  29452. createElementVNode("div", _hoisted_11$1, [
  29453. createVNode(_component_el_checkbox, {
  29454. label: element.value
  29455. }, {
  29456. default: withCtx(() => [
  29457. _hoisted_12$1
  29458. ]),
  29459. _: 2
  29460. }, 1032, ["label"]),
  29461. createVNode(_component_el_input, {
  29462. modelValue: element.value,
  29463. "onUpdate:modelValue": ($event) => element.value = $event,
  29464. style: normalizeStyle({
  29465. width: _ctx.data.options.showLabel ? "90px" : "180px"
  29466. })
  29467. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  29468. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  29469. key: 0,
  29470. modelValue: element.label,
  29471. "onUpdate:modelValue": ($event) => element.label = $event,
  29472. style: { width: "90px" }
  29473. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true),
  29474. _hoisted_13$1,
  29475. createVNode(_component_el_button, {
  29476. type: "primary",
  29477. circle: "",
  29478. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29479. }, {
  29480. default: withCtx(() => [
  29481. _hoisted_14$1
  29482. ]),
  29483. _: 2
  29484. }, 1032, ["onClick"])
  29485. ])
  29486. ]),
  29487. _: 1
  29488. }, 8, ["list"])
  29489. ]),
  29490. _: 1
  29491. }, 8, ["modelValue"])) : createCommentVNode("", true),
  29492. createElementVNode("div", _hoisted_15, [
  29493. createVNode(_component_el_button, {
  29494. type: "text",
  29495. onClick: _ctx.handleInsertOption
  29496. }, {
  29497. default: withCtx(() => [
  29498. _hoisted_16
  29499. ]),
  29500. _: 1
  29501. }, 8, ["onClick"])
  29502. ])
  29503. ], 64))
  29504. ]),
  29505. _: 1
  29506. })) : createCommentVNode("", true),
  29507. _ctx.data.type === "time" ? (openBlock(), createBlock(_component_el_form_item, {
  29508. key: 27,
  29509. label: "\u9ED8\u8BA4\u503C"
  29510. }, {
  29511. default: withCtx(() => [
  29512. createVNode(_component_el_time_picker, {
  29513. modelValue: _ctx.data.options.defaultValue,
  29514. "onUpdate:modelValue": _cache[38] || (_cache[38] = ($event) => _ctx.data.options.defaultValue = $event),
  29515. style: { "width": "100%" },
  29516. format: _ctx.data.options.format,
  29517. placeholder: _ctx.data.options.placeholder
  29518. }, null, 8, ["modelValue", "format", "placeholder"])
  29519. ]),
  29520. _: 1
  29521. })) : createCommentVNode("", true),
  29522. _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  29523. key: 28,
  29524. label: "\u9ED8\u8BA4\u503C"
  29525. }, {
  29526. default: withCtx(() => [
  29527. createVNode(_component_el_date_picker, {
  29528. modelValue: _ctx.data.options.defaultValue,
  29529. "onUpdate:modelValue": _cache[39] || (_cache[39] = ($event) => _ctx.data.options.defaultValue = $event),
  29530. style: { "width": "100%" },
  29531. format: _ctx.data.options.format,
  29532. placeholder: _ctx.data.options.placeholder
  29533. }, null, 8, ["modelValue", "format", "placeholder"])
  29534. ]),
  29535. _: 1
  29536. })) : createCommentVNode("", true),
  29537. _ctx.data.type === "time" || _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  29538. key: 29,
  29539. label: "\u683C\u5F0F"
  29540. }, {
  29541. default: withCtx(() => [
  29542. createVNode(_component_el_input, {
  29543. modelValue: _ctx.data.options.format,
  29544. "onUpdate:modelValue": _cache[40] || (_cache[40] = ($event) => _ctx.data.options.format = $event)
  29545. }, null, 8, ["modelValue"])
  29546. ]),
  29547. _: 1
  29548. })) : createCommentVNode("", true),
  29549. _ctx.data.type === "download" ? (openBlock(), createBlock(_component_el_form_item, {
  29550. key: 30,
  29551. label: "\u5730\u5740"
  29552. }, {
  29553. default: withCtx(() => [
  29554. createVNode(_component_el_input, {
  29555. modelValue: _ctx.data.options.defaultValue,
  29556. "onUpdate:modelValue": _cache[41] || (_cache[41] = ($event) => _ctx.data.options.defaultValue = $event)
  29557. }, null, 8, ["modelValue"])
  29558. ]),
  29559. _: 1
  29560. })) : createCommentVNode("", true),
  29561. _ctx.data.type === "img-upload" ? (openBlock(), createElementBlock(Fragment, { key: 31 }, [
  29562. createVNode(_component_el_form_item, { label: "\u6A21\u5F0F" }, {
  29563. default: withCtx(() => [
  29564. createVNode(_component_el_radio_group, {
  29565. modelValue: _ctx.data.options.listType,
  29566. "onUpdate:modelValue": _cache[42] || (_cache[42] = ($event) => _ctx.data.options.listType = $event)
  29567. }, {
  29568. default: withCtx(() => [
  29569. createVNode(_component_el_radio_button, { label: "text" }, {
  29570. default: withCtx(() => [
  29571. _hoisted_17
  29572. ]),
  29573. _: 1
  29574. }),
  29575. createVNode(_component_el_radio_button, { label: "picture" }, {
  29576. default: withCtx(() => [
  29577. _hoisted_18
  29578. ]),
  29579. _: 1
  29580. }),
  29581. createVNode(_component_el_radio_button, { label: "picture-card" }, {
  29582. default: withCtx(() => [
  29583. _hoisted_19
  29584. ]),
  29585. _: 1
  29586. })
  29587. ]),
  29588. _: 1
  29589. }, 8, ["modelValue"])
  29590. ]),
  29591. _: 1
  29592. }),
  29593. createVNode(_component_el_form_item, { label: "\u6587\u4EF6\u53C2\u6570\u540D" }, {
  29594. default: withCtx(() => [
  29595. createVNode(_component_el_input, {
  29596. modelValue: _ctx.data.options.name,
  29597. "onUpdate:modelValue": _cache[43] || (_cache[43] = ($event) => _ctx.data.options.name = $event)
  29598. }, null, 8, ["modelValue"])
  29599. ]),
  29600. _: 1
  29601. }),
  29602. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u5730\u5740" }, {
  29603. default: withCtx(() => [
  29604. createVNode(_component_el_input, {
  29605. modelValue: _ctx.data.options.action,
  29606. "onUpdate:modelValue": _cache[44] || (_cache[44] = ($event) => _ctx.data.options.action = $event)
  29607. }, null, 8, ["modelValue"])
  29608. ]),
  29609. _: 1
  29610. }),
  29611. createVNode(_component_el_form_item, { label: "\u63A5\u53D7\u4E0A\u4F20\u7684\u6587\u4EF6\u7C7B\u578B(\u591A\u4E2A\u4F7F\u7528 , \u9694\u5F00)" }, {
  29612. default: withCtx(() => [
  29613. createVNode(_component_el_input, {
  29614. modelValue: _ctx.data.options.accept,
  29615. "onUpdate:modelValue": _cache[45] || (_cache[45] = ($event) => _ctx.data.options.accept = $event)
  29616. }, null, 8, ["modelValue"])
  29617. ]),
  29618. _: 1
  29619. }),
  29620. createVNode(_component_el_form_item, { label: "\u6700\u5927\u4E0A\u4F20\u6570\u91CF" }, {
  29621. default: withCtx(() => [
  29622. createVNode(_component_el_input_number, {
  29623. modelValue: _ctx.data.options.limit,
  29624. "onUpdate:modelValue": _cache[46] || (_cache[46] = ($event) => _ctx.data.options.limit = $event),
  29625. modelModifiers: { number: true },
  29626. min: 1
  29627. }, null, 8, ["modelValue"])
  29628. ]),
  29629. _: 1
  29630. }),
  29631. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u8BF7\u6C42\u65B9\u6CD5" }, {
  29632. default: withCtx(() => [
  29633. createVNode(_component_el_radio_group, {
  29634. modelValue: _ctx.data.options.method,
  29635. "onUpdate:modelValue": _cache[47] || (_cache[47] = ($event) => _ctx.data.options.method = $event)
  29636. }, {
  29637. default: withCtx(() => [
  29638. createVNode(_component_el_radio_button, { label: "post" }, {
  29639. default: withCtx(() => [
  29640. _hoisted_20
  29641. ]),
  29642. _: 1
  29643. }),
  29644. createVNode(_component_el_radio_button, { label: "put" }, {
  29645. default: withCtx(() => [
  29646. _hoisted_21
  29647. ]),
  29648. _: 1
  29649. }),
  29650. createVNode(_component_el_radio_button, { label: "get" }, {
  29651. default: withCtx(() => [
  29652. _hoisted_22
  29653. ]),
  29654. _: 1
  29655. }),
  29656. createVNode(_component_el_radio_button, { label: "delete" }, {
  29657. default: withCtx(() => [
  29658. _hoisted_23
  29659. ]),
  29660. _: 1
  29661. })
  29662. ]),
  29663. _: 1
  29664. }, 8, ["modelValue"])
  29665. ]),
  29666. _: 1
  29667. })
  29668. ], 64)) : createCommentVNode("", true),
  29669. _ctx.data.type === "cascader" ? (openBlock(), createBlock(_component_el_form_item, {
  29670. key: 32,
  29671. label: "\u8FDC\u7AEF\u6570\u636E"
  29672. }, {
  29673. default: withCtx(() => [
  29674. createVNode(_component_el_space, {
  29675. direction: "vertical",
  29676. alignment: "start"
  29677. }, {
  29678. default: withCtx(() => [
  29679. createVNode(_component_el_input, {
  29680. modelValue: _ctx.data.options.remoteFunc,
  29681. "onUpdate:modelValue": _cache[48] || (_cache[48] = ($event) => _ctx.data.options.remoteFunc = $event)
  29682. }, {
  29683. prepend: withCtx(() => [
  29684. _hoisted_24
  29685. ]),
  29686. _: 1
  29687. }, 8, ["modelValue"]),
  29688. createVNode(_component_el_input, {
  29689. modelValue: _ctx.data.options.props.label,
  29690. "onUpdate:modelValue": _cache[49] || (_cache[49] = ($event) => _ctx.data.options.props.label = $event)
  29691. }, {
  29692. prepend: withCtx(() => [
  29693. _hoisted_25
  29694. ]),
  29695. _: 1
  29696. }, 8, ["modelValue"]),
  29697. createVNode(_component_el_input, {
  29698. modelValue: _ctx.data.options.props.value,
  29699. "onUpdate:modelValue": _cache[50] || (_cache[50] = ($event) => _ctx.data.options.props.value = $event)
  29700. }, {
  29701. prepend: withCtx(() => [
  29702. _hoisted_26
  29703. ]),
  29704. _: 1
  29705. }, 8, ["modelValue"]),
  29706. createVNode(_component_el_input, {
  29707. modelValue: _ctx.data.options.props.children,
  29708. "onUpdate:modelValue": _cache[51] || (_cache[51] = ($event) => _ctx.data.options.props.children = $event)
  29709. }, {
  29710. prepend: withCtx(() => [
  29711. _hoisted_27
  29712. ]),
  29713. _: 1
  29714. }, 8, ["modelValue"])
  29715. ]),
  29716. _: 1
  29717. })
  29718. ]),
  29719. _: 1
  29720. })) : createCommentVNode("", true),
  29721. _ctx.data.type === "table" ? (openBlock(), createElementBlock(Fragment, { key: 33 }, [
  29722. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  29723. default: withCtx(() => [
  29724. createVNode(_component_Draggable, {
  29725. tag: "ul",
  29726. "item-key": "index",
  29727. "ghost-class": "ghost",
  29728. handle: ".drag-item",
  29729. group: { name: "options" },
  29730. list: _ctx.data.columns
  29731. }, {
  29732. item: withCtx(({ element, index }) => [
  29733. createElementVNode("li", _hoisted_28, [
  29734. _hoisted_29,
  29735. createVNode(_component_el_input, {
  29736. modelValue: element.label,
  29737. "onUpdate:modelValue": ($event) => element.label = $event,
  29738. placeholder: "\u663E\u793A\u540D\u79F0"
  29739. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  29740. createVNode(_component_el_input, {
  29741. modelValue: element.prop,
  29742. "onUpdate:modelValue": ($event) => element.prop = $event,
  29743. placeholder: "\u5B57\u6BB5\u5B57\u6BB5"
  29744. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  29745. createVNode(_component_el_button, {
  29746. type: "primary",
  29747. circle: "",
  29748. style: { "margin-left": "5px" },
  29749. onClick: ($event) => _ctx.data.columns.splice(index, 1)
  29750. }, {
  29751. default: withCtx(() => [
  29752. _hoisted_30
  29753. ]),
  29754. _: 2
  29755. }, 1032, ["onClick"])
  29756. ])
  29757. ]),
  29758. _: 1
  29759. }, 8, ["list"]),
  29760. createElementVNode("div", null, [
  29761. createVNode(_component_el_button, {
  29762. type: "text",
  29763. onClick: _cache[52] || (_cache[52] = ($event) => _ctx.data.columns.push({}))
  29764. }, {
  29765. default: withCtx(() => [
  29766. _hoisted_31
  29767. ]),
  29768. _: 1
  29769. })
  29770. ])
  29771. ]),
  29772. _: 1
  29773. }),
  29774. createVNode(_component_el_form_item, { label: "\u5BF9\u9F50\u65B9\u5F0F" }, {
  29775. default: withCtx(() => [
  29776. createVNode(_component_el_radio_group, {
  29777. modelValue: _ctx.data.options.align,
  29778. "onUpdate:modelValue": _cache[53] || (_cache[53] = ($event) => _ctx.data.options.align = $event)
  29779. }, {
  29780. default: withCtx(() => [
  29781. createVNode(_component_el_radio_button, { label: "left" }, {
  29782. default: withCtx(() => [
  29783. _hoisted_32
  29784. ]),
  29785. _: 1
  29786. }),
  29787. createVNode(_component_el_radio_button, { label: "center" }, {
  29788. default: withCtx(() => [
  29789. _hoisted_33
  29790. ]),
  29791. _: 1
  29792. }),
  29793. createVNode(_component_el_radio_button, { label: "right" }, {
  29794. default: withCtx(() => [
  29795. _hoisted_34
  29796. ]),
  29797. _: 1
  29798. })
  29799. ]),
  29800. _: 1
  29801. }, 8, ["modelValue"])
  29802. ]),
  29803. _: 1
  29804. })
  29805. ], 64)) : createCommentVNode("", true),
  29806. _ctx.data.type === "grid" ? (openBlock(), createElementBlock(Fragment, { key: 34 }, [
  29807. createVNode(_component_el_form_item, { label: "\u6805\u683C\u95F4\u9694" }, {
  29808. default: withCtx(() => [
  29809. createVNode(_component_el_input_number, {
  29810. modelValue: _ctx.data.options.gutter,
  29811. "onUpdate:modelValue": _cache[54] || (_cache[54] = ($event) => _ctx.data.options.gutter = $event),
  29812. modelModifiers: { number: true },
  29813. min: 0
  29814. }, null, 8, ["modelValue"])
  29815. ]),
  29816. _: 1
  29817. }),
  29818. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  29819. default: withCtx(() => [
  29820. createVNode(_component_Draggable, {
  29821. tag: "ul",
  29822. "item-key": "index",
  29823. "ghost-class": "ghost",
  29824. handle: ".drag-item",
  29825. group: { name: "options" },
  29826. list: _ctx.data.columns
  29827. }, {
  29828. item: withCtx(({ element, index }) => [
  29829. createElementVNode("li", _hoisted_35, [
  29830. _hoisted_36,
  29831. createVNode(_component_el_input_number, {
  29832. modelValue: element.span,
  29833. "onUpdate:modelValue": ($event) => element.span = $event,
  29834. modelModifiers: { number: true },
  29835. placeholder: "\u6805\u683C\u503C",
  29836. min: 0,
  29837. max: 24
  29838. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  29839. createVNode(_component_el_button, {
  29840. type: "primary",
  29841. circle: "",
  29842. style: { "margin-left": "5px" },
  29843. onClick: ($event) => _ctx.handleOptionsRemove(index)
  29844. }, {
  29845. default: withCtx(() => [
  29846. _hoisted_37
  29847. ]),
  29848. _: 2
  29849. }, 1032, ["onClick"])
  29850. ])
  29851. ]),
  29852. _: 1
  29853. }, 8, ["list"]),
  29854. createElementVNode("div", null, [
  29855. createVNode(_component_el_button, {
  29856. type: "text",
  29857. onClick: _ctx.handleInsertColumn
  29858. }, {
  29859. default: withCtx(() => [
  29860. _hoisted_38
  29861. ]),
  29862. _: 1
  29863. }, 8, ["onClick"])
  29864. ])
  29865. ]),
  29866. _: 1
  29867. }),
  29868. createVNode(_component_el_form_item, { label: "\u5782\u76F4\u5BF9\u9F50\u65B9\u5F0F" }, {
  29869. default: withCtx(() => [
  29870. createVNode(_component_el_radio_group, {
  29871. modelValue: _ctx.data.options.align,
  29872. "onUpdate:modelValue": _cache[55] || (_cache[55] = ($event) => _ctx.data.options.align = $event)
  29873. }, {
  29874. default: withCtx(() => [
  29875. createVNode(_component_el_radio_button, { label: "initial" }, {
  29876. default: withCtx(() => [
  29877. _hoisted_39
  29878. ]),
  29879. _: 1
  29880. }),
  29881. createVNode(_component_el_radio_button, { label: "center" }, {
  29882. default: withCtx(() => [
  29883. _hoisted_40
  29884. ]),
  29885. _: 1
  29886. }),
  29887. createVNode(_component_el_radio_button, { label: "flex-end" }, {
  29888. default: withCtx(() => [
  29889. _hoisted_41
  29890. ]),
  29891. _: 1
  29892. })
  29893. ]),
  29894. _: 1
  29895. }, 8, ["modelValue"])
  29896. ]),
  29897. _: 1
  29898. })
  29899. ], 64)) : createCommentVNode("", true),
  29900. _ctx.data.type !== "grid" ? (openBlock(), createElementBlock(Fragment, { key: 35 }, [
  29901. _ctx.hasKey("rules") || _ctx.hasKey("readonly") || _ctx.hasKey("disabled") || _ctx.hasKey("allowClear") ? (openBlock(), createBlock(_component_el_form_item, {
  29902. key: 0,
  29903. label: "\u64CD\u4F5C\u5C5E\u6027"
  29904. }, {
  29905. default: withCtx(() => [
  29906. _ctx.hasKey("rules") ? (openBlock(), createBlock(_component_el_checkbox, {
  29907. key: 0,
  29908. modelValue: _ctx.data.options.rules.required,
  29909. "onUpdate:modelValue": _cache[56] || (_cache[56] = ($event) => _ctx.data.options.rules.required = $event),
  29910. disabled: _ctx.data.allDisable
  29911. }, {
  29912. default: withCtx(() => [
  29913. _hoisted_42
  29914. ]),
  29915. _: 1
  29916. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  29917. _ctx.hasKey("readonly") ? (openBlock(), createBlock(_component_el_checkbox, {
  29918. key: 1,
  29919. modelValue: _ctx.data.options.readonly,
  29920. "onUpdate:modelValue": _cache[57] || (_cache[57] = ($event) => _ctx.data.options.readonly = $event),
  29921. disabled: _ctx.data.allDisable
  29922. }, {
  29923. default: withCtx(() => [
  29924. _hoisted_43
  29925. ]),
  29926. _: 1
  29927. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  29928. _ctx.hasKey("disabled") ? (openBlock(), createBlock(_component_el_checkbox, {
  29929. key: 2,
  29930. modelValue: _ctx.data.options.disabled,
  29931. "onUpdate:modelValue": _cache[58] || (_cache[58] = ($event) => _ctx.data.options.disabled = $event),
  29932. disabled: _ctx.data.allDisable
  29933. }, {
  29934. default: withCtx(() => [
  29935. _hoisted_44
  29936. ]),
  29937. _: 1
  29938. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  29939. _ctx.hasKey("clearable") ? (openBlock(), createBlock(_component_el_checkbox, {
  29940. key: 3,
  29941. modelValue: _ctx.data.options.clearable,
  29942. "onUpdate:modelValue": _cache[59] || (_cache[59] = ($event) => _ctx.data.options.clearable = $event),
  29943. disabled: _ctx.data.allDisable
  29944. }, {
  29945. default: withCtx(() => [
  29946. _hoisted_45
  29947. ]),
  29948. _: 1
  29949. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true)
  29950. ]),
  29951. _: 1
  29952. })) : createCommentVNode("", true),
  29953. _ctx.hasKey("rules") ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  29954. _hoisted_46,
  29955. createVNode(_component_el_form_item, { label: "\u89E6\u53D1\u65F6\u673A" }, {
  29956. default: withCtx(() => [
  29957. createVNode(_component_el_radio_group, {
  29958. modelValue: _ctx.data.options.rules.trigger,
  29959. "onUpdate:modelValue": _cache[60] || (_cache[60] = ($event) => _ctx.data.options.rules.trigger = $event)
  29960. }, {
  29961. default: withCtx(() => [
  29962. createVNode(_component_el_radio_button, { label: "blur" }, {
  29963. default: withCtx(() => [
  29964. _hoisted_47
  29965. ]),
  29966. _: 1
  29967. }),
  29968. createVNode(_component_el_radio_button, { label: "change" }, {
  29969. default: withCtx(() => [
  29970. _hoisted_48
  29971. ]),
  29972. _: 1
  29973. })
  29974. ]),
  29975. _: 1
  29976. }, 8, ["modelValue"])
  29977. ]),
  29978. _: 1
  29979. }),
  29980. createVNode(_component_el_form_item, { label: "\u679A\u4E3E\u7C7B\u578B" }, {
  29981. default: withCtx(() => [
  29982. createVNode(_component_el_input, {
  29983. value: _ctx.data.options.rules.enum,
  29984. "onUpdate:value": _cache[61] || (_cache[61] = ($event) => _ctx.data.options.rules.enum = $event)
  29985. }, null, 8, ["value"])
  29986. ]),
  29987. _: 1
  29988. }),
  29989. createVNode(_component_el_form_item, { label: "\u5B57\u6BB5\u957F\u5EA6" }, {
  29990. default: withCtx(() => [
  29991. createVNode(_component_el_input, {
  29992. modelValue: _ctx.data.options.rules.len,
  29993. "onUpdate:modelValue": _cache[62] || (_cache[62] = ($event) => _ctx.data.options.rules.len = $event),
  29994. modelModifiers: { number: true }
  29995. }, null, 8, ["modelValue"])
  29996. ]),
  29997. _: 1
  29998. }),
  29999. createVNode(_component_el_form_item, { label: "\u6700\u5927\u957F\u5EA6" }, {
  30000. default: withCtx(() => [
  30001. createVNode(_component_el_input, {
  30002. modelValue: _ctx.data.options.rules.max,
  30003. "onUpdate:modelValue": _cache[63] || (_cache[63] = ($event) => _ctx.data.options.rules.max = $event),
  30004. modelModifiers: { number: true }
  30005. }, null, 8, ["modelValue"])
  30006. ]),
  30007. _: 1
  30008. }),
  30009. createVNode(_component_el_form_item, { label: "\u6700\u5C0F\u957F\u5EA6" }, {
  30010. default: withCtx(() => [
  30011. createVNode(_component_el_input, {
  30012. modelValue: _ctx.data.options.rules.min,
  30013. "onUpdate:modelValue": _cache[64] || (_cache[64] = ($event) => _ctx.data.options.rules.min = $event),
  30014. modelModifiers: { number: true }
  30015. }, null, 8, ["modelValue"])
  30016. ]),
  30017. _: 1
  30018. }),
  30019. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u6587\u6848" }, {
  30020. default: withCtx(() => [
  30021. createVNode(_component_el_input, {
  30022. modelValue: _ctx.data.options.rules.message,
  30023. "onUpdate:modelValue": _cache[65] || (_cache[65] = ($event) => _ctx.data.options.rules.message = $event)
  30024. }, null, 8, ["modelValue"])
  30025. ]),
  30026. _: 1
  30027. }),
  30028. createVNode(_component_el_form_item, { label: "\u6B63\u5219\u8868\u8FBE\u5F0F" }, {
  30029. default: withCtx(() => [
  30030. createVNode(_component_el_input, {
  30031. modelValue: _ctx.data.options.rules.pattern,
  30032. "onUpdate:modelValue": _cache[66] || (_cache[66] = ($event) => _ctx.data.options.rules.pattern = $event)
  30033. }, null, 8, ["modelValue"])
  30034. ]),
  30035. _: 1
  30036. }),
  30037. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u7C7B\u578B" }, {
  30038. default: withCtx(() => [
  30039. createVNode(_component_el_select, {
  30040. modelValue: _ctx.data.options.rules.type,
  30041. "onUpdate:modelValue": _cache[67] || (_cache[67] = ($event) => _ctx.data.options.rules.type = $event)
  30042. }, {
  30043. default: withCtx(() => [
  30044. createVNode(_component_el_option, { value: "string" }, {
  30045. default: withCtx(() => [
  30046. _hoisted_49
  30047. ]),
  30048. _: 1
  30049. }),
  30050. createVNode(_component_el_option, { value: "number" }, {
  30051. default: withCtx(() => [
  30052. _hoisted_50
  30053. ]),
  30054. _: 1
  30055. }),
  30056. createVNode(_component_el_option, { value: "boolean" }, {
  30057. default: withCtx(() => [
  30058. _hoisted_51
  30059. ]),
  30060. _: 1
  30061. }),
  30062. createVNode(_component_el_option, { value: "method" }, {
  30063. default: withCtx(() => [
  30064. _hoisted_52
  30065. ]),
  30066. _: 1
  30067. }),
  30068. createVNode(_component_el_option, { value: "regexp" }, {
  30069. default: withCtx(() => [
  30070. _hoisted_53
  30071. ]),
  30072. _: 1
  30073. }),
  30074. createVNode(_component_el_option, { value: "integer" }, {
  30075. default: withCtx(() => [
  30076. _hoisted_54
  30077. ]),
  30078. _: 1
  30079. }),
  30080. createVNode(_component_el_option, { value: "float" }, {
  30081. default: withCtx(() => [
  30082. _hoisted_55
  30083. ]),
  30084. _: 1
  30085. }),
  30086. createVNode(_component_el_option, { value: "array" }, {
  30087. default: withCtx(() => [
  30088. _hoisted_56
  30089. ]),
  30090. _: 1
  30091. }),
  30092. createVNode(_component_el_option, { value: "object" }, {
  30093. default: withCtx(() => [
  30094. _hoisted_57
  30095. ]),
  30096. _: 1
  30097. }),
  30098. createVNode(_component_el_option, { value: "enum" }, {
  30099. default: withCtx(() => [
  30100. _hoisted_58
  30101. ]),
  30102. _: 1
  30103. }),
  30104. createVNode(_component_el_option, { value: "date" }, {
  30105. default: withCtx(() => [
  30106. _hoisted_59
  30107. ]),
  30108. _: 1
  30109. }),
  30110. createVNode(_component_el_option, { value: "url" }, {
  30111. default: withCtx(() => [
  30112. _hoisted_60
  30113. ]),
  30114. _: 1
  30115. }),
  30116. createVNode(_component_el_option, { value: "hex" }, {
  30117. default: withCtx(() => [
  30118. _hoisted_61
  30119. ]),
  30120. _: 1
  30121. }),
  30122. createVNode(_component_el_option, { value: "email" }, {
  30123. default: withCtx(() => [
  30124. _hoisted_62
  30125. ]),
  30126. _: 1
  30127. }),
  30128. createVNode(_component_el_option, { value: "any" }, {
  30129. default: withCtx(() => [
  30130. _hoisted_63
  30131. ]),
  30132. _: 1
  30133. })
  30134. ]),
  30135. _: 1
  30136. }, 8, ["modelValue"])
  30137. ]),
  30138. _: 1
  30139. })
  30140. ], 64)) : createCommentVNode("", true)
  30141. ], 64)) : createCommentVNode("", true)
  30142. ]),
  30143. _: 1
  30144. })) : createCommentVNode("", true);
  30145. }
  30146. var WidgetConfig = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
  30147. const _hoisted_1$1 = /* @__PURE__ */ createTextVNode(" \u5DE6\u5BF9\u9F50 ");
  30148. const _hoisted_2$1 = /* @__PURE__ */ createTextVNode(" \u53F3\u5BF9\u9F50 ");
  30149. const _hoisted_3$1 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  30150. const _hoisted_4$1 = /* @__PURE__ */ createTextVNode(" \u5927 ");
  30151. const _hoisted_5$1 = /* @__PURE__ */ createTextVNode(" \u9ED8\u8BA4 ");
  30152. const _hoisted_6$1 = /* @__PURE__ */ createTextVNode(" \u5C0F ");
  30153. const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  30154. props: {
  30155. config: null
  30156. },
  30157. setup(__props) {
  30158. return (_ctx, _cache) => {
  30159. const _component_el_radio_button = ElRadioButton;
  30160. const _component_el_radio_group = ElRadioGroup;
  30161. const _component_el_form_item = ElFormItem;
  30162. const _component_el_input_number = ElInputNumber;
  30163. const _component_el_switch = ElSwitch;
  30164. const _component_el_form = ElForm;
  30165. return openBlock(), createBlock(_component_el_form, {
  30166. "p-2": "",
  30167. "label-position": "top",
  30168. onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
  30169. }, ["prevent"]))
  30170. }, {
  30171. default: withCtx(() => [
  30172. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BF9\u9F50\u65B9\u5F0F" }, {
  30173. default: withCtx(() => [
  30174. createVNode(_component_el_radio_group, {
  30175. modelValue: __props.config.labelPosition,
  30176. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.config.labelPosition = $event)
  30177. }, {
  30178. default: withCtx(() => [
  30179. createVNode(_component_el_radio_button, { label: "left" }, {
  30180. default: withCtx(() => [
  30181. _hoisted_1$1
  30182. ]),
  30183. _: 1
  30184. }),
  30185. createVNode(_component_el_radio_button, { label: "right" }, {
  30186. default: withCtx(() => [
  30187. _hoisted_2$1
  30188. ]),
  30189. _: 1
  30190. }),
  30191. createVNode(_component_el_radio_button, { label: "top" }, {
  30192. default: withCtx(() => [
  30193. _hoisted_3$1
  30194. ]),
  30195. _: 1
  30196. })
  30197. ]),
  30198. _: 1
  30199. }, 8, ["modelValue"])
  30200. ]),
  30201. _: 1
  30202. }),
  30203. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BBD\u5EA6" }, {
  30204. default: withCtx(() => [
  30205. createVNode(_component_el_input_number, {
  30206. modelValue: __props.config.labelWidth,
  30207. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => __props.config.labelWidth = $event),
  30208. modelModifiers: { number: true },
  30209. min: 0
  30210. }, null, 8, ["modelValue"])
  30211. ]),
  30212. _: 1
  30213. }),
  30214. createVNode(_component_el_form_item, { label: "\u7EC4\u4EF6\u5C3A\u5BF8" }, {
  30215. default: withCtx(() => [
  30216. createVNode(_component_el_radio_group, {
  30217. modelValue: __props.config.size,
  30218. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => __props.config.size = $event)
  30219. }, {
  30220. default: withCtx(() => [
  30221. createVNode(_component_el_radio_button, { label: "large" }, {
  30222. default: withCtx(() => [
  30223. _hoisted_4$1
  30224. ]),
  30225. _: 1
  30226. }),
  30227. createVNode(_component_el_radio_button, { label: "default" }, {
  30228. default: withCtx(() => [
  30229. _hoisted_5$1
  30230. ]),
  30231. _: 1
  30232. }),
  30233. createVNode(_component_el_radio_button, { label: "small" }, {
  30234. default: withCtx(() => [
  30235. _hoisted_6$1
  30236. ]),
  30237. _: 1
  30238. })
  30239. ]),
  30240. _: 1
  30241. }, 8, ["modelValue"])
  30242. ]),
  30243. _: 1
  30244. }),
  30245. createVNode(_component_el_form_item, { label: "\u9690\u85CF\u5FC5\u9009\u6807\u8BB0" }, {
  30246. default: withCtx(() => [
  30247. createVNode(_component_el_switch, {
  30248. modelValue: __props.config.hideRequiredAsterisk,
  30249. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => __props.config.hideRequiredAsterisk = $event)
  30250. }, null, 8, ["modelValue"])
  30251. ]),
  30252. _: 1
  30253. })
  30254. ]),
  30255. _: 1
  30256. });
  30257. };
  30258. }
  30259. });
  30260. function _extends() {
  30261. _extends = Object.assign || function(target) {
  30262. for (var i = 1; i < arguments.length; i++) {
  30263. var source = arguments[i];
  30264. for (var key in source) {
  30265. if (Object.prototype.hasOwnProperty.call(source, key)) {
  30266. target[key] = source[key];
  30267. }
  30268. }
  30269. }
  30270. return target;
  30271. };
  30272. return _extends.apply(this, arguments);
  30273. }
  30274. var KEYCODE_ENTER = 13;
  30275. var KEYCODE_TAB = 9;
  30276. var KEYCODE_BACKSPACE = 8;
  30277. var KEYCODE_Y = 89;
  30278. var KEYCODE_Z = 90;
  30279. var KEYCODE_M = 77;
  30280. var KEYCODE_PARENS = 57;
  30281. var KEYCODE_BRACKETS = 219;
  30282. var KEYCODE_QUOTE = 222;
  30283. var KEYCODE_BACK_QUOTE = 192;
  30284. var KEYCODE_ESCAPE = 27;
  30285. var HISTORY_LIMIT = 100;
  30286. var HISTORY_TIME_GAP = 3e3;
  30287. var isWindows = typeof window !== "undefined" && navigator && /* @__PURE__ */ /Win/i.test(navigator.platform);
  30288. var isMacLike = typeof window !== "undefined" && navigator && /* @__PURE__ */ /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
  30289. var PrismEditor = /* @__PURE__ */ defineComponent({
  30290. props: {
  30291. lineNumbers: {
  30292. type: Boolean,
  30293. "default": false
  30294. },
  30295. autoStyleLineNumbers: {
  30296. type: Boolean,
  30297. "default": true
  30298. },
  30299. readonly: {
  30300. type: Boolean,
  30301. "default": false
  30302. },
  30303. modelValue: {
  30304. type: String,
  30305. "default": ""
  30306. },
  30307. highlight: {
  30308. type: Function,
  30309. required: true
  30310. },
  30311. tabSize: {
  30312. type: Number,
  30313. "default": 2
  30314. },
  30315. insertSpaces: {
  30316. type: Boolean,
  30317. "default": true
  30318. },
  30319. ignoreTabKey: {
  30320. type: Boolean,
  30321. "default": false
  30322. },
  30323. placeholder: {
  30324. type: String,
  30325. "default": ""
  30326. }
  30327. },
  30328. data: function data() {
  30329. return {
  30330. capture: true,
  30331. history: {
  30332. stack: [],
  30333. offset: -1
  30334. },
  30335. lineNumbersHeight: "20px",
  30336. codeData: ""
  30337. };
  30338. },
  30339. watch: {
  30340. modelValue: {
  30341. immediate: true,
  30342. handler: function handler(newVal) {
  30343. if (!newVal) {
  30344. this.codeData = "";
  30345. } else {
  30346. this.codeData = newVal;
  30347. }
  30348. }
  30349. },
  30350. content: {
  30351. immediate: true,
  30352. handler: function handler2() {
  30353. var _this = this;
  30354. if (this.lineNumbers) {
  30355. this.$nextTick(function() {
  30356. _this.setLineNumbersHeight();
  30357. });
  30358. }
  30359. }
  30360. },
  30361. lineNumbers: function lineNumbers() {
  30362. var _this2 = this;
  30363. this.$nextTick(function() {
  30364. _this2.styleLineNumbers();
  30365. _this2.setLineNumbersHeight();
  30366. });
  30367. }
  30368. },
  30369. computed: {
  30370. isEmpty: function isEmpty2() {
  30371. return this.codeData.length === 0;
  30372. },
  30373. content: function content() {
  30374. var result = this.highlight(this.codeData) + "<br />";
  30375. return result;
  30376. },
  30377. lineNumbersCount: function lineNumbersCount() {
  30378. var totalLines = this.codeData.split(/\r\n|\n/).length;
  30379. return totalLines;
  30380. }
  30381. },
  30382. mounted: function mounted() {
  30383. this._recordCurrentState();
  30384. this.styleLineNumbers();
  30385. },
  30386. methods: {
  30387. setLineNumbersHeight: function setLineNumbersHeight() {
  30388. this.lineNumbersHeight = getComputedStyle(this.$refs.pre).height;
  30389. },
  30390. styleLineNumbers: function styleLineNumbers() {
  30391. if (!this.lineNumbers || !this.autoStyleLineNumbers)
  30392. return;
  30393. var $editor = this.$refs.pre;
  30394. var $lineNumbers = this.$el.querySelector(".prism-editor__line-numbers");
  30395. var editorStyles = window.getComputedStyle($editor);
  30396. this.$nextTick(function() {
  30397. var btlr = "border-top-left-radius";
  30398. var bblr = "border-bottom-left-radius";
  30399. if (!$lineNumbers)
  30400. return;
  30401. $lineNumbers.style[btlr] = editorStyles[btlr];
  30402. $lineNumbers.style[bblr] = editorStyles[bblr];
  30403. $editor.style[btlr] = "0";
  30404. $editor.style[bblr] = "0";
  30405. var stylesList = ["background-color", "margin-top", "padding-top", "font-family", "font-size", "line-height"];
  30406. stylesList.forEach(function(style) {
  30407. $lineNumbers.style[style] = editorStyles[style];
  30408. });
  30409. $lineNumbers.style["margin-bottom"] = "-" + editorStyles["padding-top"];
  30410. });
  30411. },
  30412. _recordCurrentState: function _recordCurrentState() {
  30413. var input = this.$refs.textarea;
  30414. if (!input)
  30415. return;
  30416. var value = input.value, selectionStart = input.selectionStart, selectionEnd = input.selectionEnd;
  30417. this._recordChange({
  30418. value,
  30419. selectionStart,
  30420. selectionEnd
  30421. });
  30422. },
  30423. _getLines: function _getLines(text, position) {
  30424. return text.substring(0, position).split("\n");
  30425. },
  30426. _applyEdits: function _applyEdits(record) {
  30427. var input = this.$refs.textarea;
  30428. var last = this.history.stack[this.history.offset];
  30429. if (last && input) {
  30430. this.history.stack[this.history.offset] = _extends({}, last, {
  30431. selectionStart: input.selectionStart,
  30432. selectionEnd: input.selectionEnd
  30433. });
  30434. }
  30435. this._recordChange(record);
  30436. this._updateInput(record);
  30437. },
  30438. _recordChange: function _recordChange(record, overwrite) {
  30439. if (overwrite === void 0) {
  30440. overwrite = false;
  30441. }
  30442. var _this$history = this.history, stack = _this$history.stack, offset2 = _this$history.offset;
  30443. if (stack.length && offset2 > -1) {
  30444. this.history.stack = stack.slice(0, offset2 + 1);
  30445. var count = this.history.stack.length;
  30446. if (count > HISTORY_LIMIT) {
  30447. var extras = count - HISTORY_LIMIT;
  30448. this.history.stack = stack.slice(extras, count);
  30449. this.history.offset = Math.max(this.history.offset - extras, 0);
  30450. }
  30451. }
  30452. var timestamp = Date.now();
  30453. if (overwrite) {
  30454. var last = this.history.stack[this.history.offset];
  30455. if (last && timestamp - last.timestamp < HISTORY_TIME_GAP) {
  30456. var _this$_getLines$pop, _this$_getLines$pop2;
  30457. var re = /[^a-z0-9]([a-z0-9]+)$/i;
  30458. 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);
  30459. 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);
  30460. if (previous && current && current[1].startsWith(previous[1])) {
  30461. this.history.stack[this.history.offset] = _extends({}, record, {
  30462. timestamp
  30463. });
  30464. return;
  30465. }
  30466. }
  30467. }
  30468. this.history.stack.push(_extends({}, record, {
  30469. timestamp
  30470. }));
  30471. this.history.offset++;
  30472. },
  30473. _updateInput: function _updateInput(record) {
  30474. var input = this.$refs.textarea;
  30475. if (!input)
  30476. return;
  30477. input.value = record.value;
  30478. input.selectionStart = record.selectionStart;
  30479. input.selectionEnd = record.selectionEnd;
  30480. this.$emit("update:modelValue", record.value);
  30481. },
  30482. handleChange: function handleChange(e) {
  30483. var _e$target = e.target, value = _e$target.value, selectionStart = _e$target.selectionStart, selectionEnd = _e$target.selectionEnd;
  30484. this._recordChange({
  30485. value,
  30486. selectionStart,
  30487. selectionEnd
  30488. }, true);
  30489. this.$emit("update:modelValue", value);
  30490. },
  30491. _undoEdit: function _undoEdit() {
  30492. var _this$history2 = this.history, stack = _this$history2.stack, offset2 = _this$history2.offset;
  30493. var record = stack[offset2 - 1];
  30494. if (record) {
  30495. this._updateInput(record);
  30496. this.history.offset = Math.max(offset2 - 1, 0);
  30497. }
  30498. },
  30499. _redoEdit: function _redoEdit() {
  30500. var _this$history3 = this.history, stack = _this$history3.stack, offset2 = _this$history3.offset;
  30501. var record = stack[offset2 + 1];
  30502. if (record) {
  30503. this._updateInput(record);
  30504. this.history.offset = Math.min(offset2 + 1, stack.length - 1);
  30505. }
  30506. },
  30507. handleKeyDown: function handleKeyDown(e) {
  30508. var tabSize = this.tabSize, insertSpaces = this.insertSpaces, ignoreTabKey = this.ignoreTabKey;
  30509. this.$emit("keydown", e);
  30510. if (e.defaultPrevented) {
  30511. return;
  30512. }
  30513. if (e.keyCode === KEYCODE_ESCAPE) {
  30514. e.target.blur();
  30515. this.$emit("blur", e);
  30516. }
  30517. var _e$target2 = e.target, value = _e$target2.value, selectionStart = _e$target2.selectionStart, selectionEnd = _e$target2.selectionEnd;
  30518. var tabCharacter = (insertSpaces ? " " : " ").repeat(tabSize);
  30519. if (e.keyCode === KEYCODE_TAB && !ignoreTabKey && this.capture) {
  30520. e.preventDefault();
  30521. if (e.shiftKey) {
  30522. var linesBeforeCaret = this._getLines(value, selectionStart);
  30523. var startLine = linesBeforeCaret.length - 1;
  30524. var endLine = this._getLines(value, selectionEnd).length - 1;
  30525. var nextValue = value.split("\n").map(function(line2, i) {
  30526. if (i >= startLine && i <= endLine && line2.startsWith(tabCharacter)) {
  30527. return line2.substring(tabCharacter.length);
  30528. }
  30529. return line2;
  30530. }).join("\n");
  30531. if (value !== nextValue) {
  30532. var startLineText = linesBeforeCaret[startLine];
  30533. this._applyEdits({
  30534. value: nextValue,
  30535. selectionStart: startLineText.startsWith(tabCharacter) ? selectionStart - tabCharacter.length : selectionStart,
  30536. selectionEnd: selectionEnd - (value.length - nextValue.length)
  30537. });
  30538. }
  30539. } else if (selectionStart !== selectionEnd) {
  30540. var _linesBeforeCaret = this._getLines(value, selectionStart);
  30541. var _startLine = _linesBeforeCaret.length - 1;
  30542. var _endLine = this._getLines(value, selectionEnd).length - 1;
  30543. var _startLineText = _linesBeforeCaret[_startLine];
  30544. this._applyEdits({
  30545. value: value.split("\n").map(function(line2, i) {
  30546. if (i >= _startLine && i <= _endLine) {
  30547. return tabCharacter + line2;
  30548. }
  30549. return line2;
  30550. }).join("\n"),
  30551. selectionStart: /\S/.test(_startLineText) ? selectionStart + tabCharacter.length : selectionStart,
  30552. selectionEnd: selectionEnd + tabCharacter.length * (_endLine - _startLine + 1)
  30553. });
  30554. } else {
  30555. var updatedSelection = selectionStart + tabCharacter.length;
  30556. this._applyEdits({
  30557. value: value.substring(0, selectionStart) + tabCharacter + value.substring(selectionEnd),
  30558. selectionStart: updatedSelection,
  30559. selectionEnd: updatedSelection
  30560. });
  30561. }
  30562. } else if (e.keyCode === KEYCODE_BACKSPACE) {
  30563. var hasSelection = selectionStart !== selectionEnd;
  30564. var textBeforeCaret = value.substring(0, selectionStart);
  30565. if (textBeforeCaret.endsWith(tabCharacter) && !hasSelection) {
  30566. e.preventDefault();
  30567. var _updatedSelection = selectionStart - tabCharacter.length;
  30568. this._applyEdits({
  30569. value: value.substring(0, selectionStart - tabCharacter.length) + value.substring(selectionEnd),
  30570. selectionStart: _updatedSelection,
  30571. selectionEnd: _updatedSelection
  30572. });
  30573. }
  30574. } else if (e.keyCode === KEYCODE_ENTER) {
  30575. if (selectionStart === selectionEnd) {
  30576. var line = this._getLines(value, selectionStart).pop();
  30577. var matches = line === null || line === void 0 ? void 0 : line.match(/^\s+/);
  30578. if (matches && matches[0]) {
  30579. e.preventDefault();
  30580. var indent = "\n" + matches[0];
  30581. var _updatedSelection2 = selectionStart + indent.length;
  30582. this._applyEdits({
  30583. value: value.substring(0, selectionStart) + indent + value.substring(selectionEnd),
  30584. selectionStart: _updatedSelection2,
  30585. selectionEnd: _updatedSelection2
  30586. });
  30587. }
  30588. }
  30589. } else if (e.keyCode === KEYCODE_PARENS || e.keyCode === KEYCODE_BRACKETS || e.keyCode === KEYCODE_QUOTE || e.keyCode === KEYCODE_BACK_QUOTE) {
  30590. var chars;
  30591. if (e.keyCode === KEYCODE_PARENS && e.shiftKey) {
  30592. chars = ["(", ")"];
  30593. } else if (e.keyCode === KEYCODE_BRACKETS) {
  30594. if (e.shiftKey) {
  30595. chars = ["{", "}"];
  30596. } else {
  30597. chars = ["[", "]"];
  30598. }
  30599. } else if (e.keyCode === KEYCODE_QUOTE) {
  30600. if (e.shiftKey) {
  30601. chars = ['"', '"'];
  30602. } else {
  30603. chars = ["'", "'"];
  30604. }
  30605. } else if (e.keyCode === KEYCODE_BACK_QUOTE && !e.shiftKey) {
  30606. chars = ["`", "`"];
  30607. }
  30608. if (selectionStart !== selectionEnd && chars) {
  30609. e.preventDefault();
  30610. this._applyEdits({
  30611. value: value.substring(0, selectionStart) + chars[0] + value.substring(selectionStart, selectionEnd) + chars[1] + value.substring(selectionEnd),
  30612. selectionStart,
  30613. selectionEnd: selectionEnd + 2
  30614. });
  30615. }
  30616. } else if ((isMacLike ? e.metaKey && e.keyCode === KEYCODE_Z : e.ctrlKey && e.keyCode === KEYCODE_Z) && !e.shiftKey && !e.altKey) {
  30617. e.preventDefault();
  30618. this._undoEdit();
  30619. } 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) {
  30620. e.preventDefault();
  30621. this._redoEdit();
  30622. } else if (e.keyCode === KEYCODE_M && e.ctrlKey && (isMacLike ? e.shiftKey : true)) {
  30623. e.preventDefault();
  30624. this.capture = !this.capture;
  30625. }
  30626. }
  30627. },
  30628. render: function render() {
  30629. var _this3 = this;
  30630. var lineNumberWidthCalculator = h$1("div", {
  30631. "class": "prism-editor__line-width-calc",
  30632. style: "height: 0px; visibility: hidden; pointer-events: none;"
  30633. }, "999");
  30634. var lineNumbers2 = h$1("div", {
  30635. "class": "prism-editor__line-numbers",
  30636. style: {
  30637. "min-height": this.lineNumbersHeight
  30638. },
  30639. "aria-hidden": "true"
  30640. }, [lineNumberWidthCalculator, Array.from(Array(this.lineNumbersCount).keys()).map(function(_2, index) {
  30641. return h$1("div", {
  30642. "class": "prism-editor__line-number token comment"
  30643. }, "" + ++index);
  30644. })]);
  30645. var textarea = h$1("textarea", {
  30646. ref: "textarea",
  30647. onInput: this.handleChange,
  30648. onKeydown: this.handleKeyDown,
  30649. onClick: function onClick($event) {
  30650. _this3.$emit("click", $event);
  30651. },
  30652. onKeyup: function onKeyup($event) {
  30653. _this3.$emit("keyup", $event);
  30654. },
  30655. onFocus: function onFocus($event) {
  30656. _this3.$emit("focus", $event);
  30657. },
  30658. onBlur: function onBlur($event) {
  30659. _this3.$emit("blur", $event);
  30660. },
  30661. "class": {
  30662. "prism-editor__textarea": true,
  30663. "prism-editor__textarea--empty": this.isEmpty
  30664. },
  30665. spellCheck: "false",
  30666. autocapitalize: "off",
  30667. autocomplete: "off",
  30668. autocorrect: "off",
  30669. "data-gramm": "false",
  30670. placeholder: this.placeholder,
  30671. "data-testid": "textarea",
  30672. readonly: this.readonly,
  30673. value: this.codeData
  30674. });
  30675. var preview = h$1("pre", {
  30676. ref: "pre",
  30677. "class": "prism-editor__editor",
  30678. "data-testid": "preview",
  30679. innerHTML: this.content
  30680. });
  30681. var editorContainer = h$1("div", {
  30682. "class": "prism-editor__container"
  30683. }, [textarea, preview]);
  30684. return h$1("div", {
  30685. "class": "prism-editor-wrapper"
  30686. }, [this.lineNumbers && lineNumbers2, editorContainer]);
  30687. }
  30688. });
  30689. var prismeditor_min = "";
  30690. var prismCore = { exports: {} };
  30691. (function(module2) {
  30692. var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
  30693. /**
  30694. * Prism: Lightweight, robust, elegant syntax highlighting
  30695. *
  30696. * @license MIT <https://opensource.org/licenses/MIT>
  30697. * @author Lea Verou <https://lea.verou.me>
  30698. * @namespace
  30699. * @public
  30700. */
  30701. var Prism2 = function(_self2) {
  30702. var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
  30703. var uniqueId = 0;
  30704. var plainTextGrammar = {};
  30705. var _2 = {
  30706. manual: _self2.Prism && _self2.Prism.manual,
  30707. disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
  30708. util: {
  30709. encode: function encode(tokens) {
  30710. if (tokens instanceof Token) {
  30711. return new Token(tokens.type, encode(tokens.content), tokens.alias);
  30712. } else if (Array.isArray(tokens)) {
  30713. return tokens.map(encode);
  30714. } else {
  30715. return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
  30716. }
  30717. },
  30718. type: function(o2) {
  30719. return Object.prototype.toString.call(o2).slice(8, -1);
  30720. },
  30721. objId: function(obj) {
  30722. if (!obj["__id"]) {
  30723. Object.defineProperty(obj, "__id", { value: ++uniqueId });
  30724. }
  30725. return obj["__id"];
  30726. },
  30727. clone: function deepClone(o2, visited) {
  30728. visited = visited || {};
  30729. var clone2;
  30730. var id;
  30731. switch (_2.util.type(o2)) {
  30732. case "Object":
  30733. id = _2.util.objId(o2);
  30734. if (visited[id]) {
  30735. return visited[id];
  30736. }
  30737. clone2 = {};
  30738. visited[id] = clone2;
  30739. for (var key in o2) {
  30740. if (o2.hasOwnProperty(key)) {
  30741. clone2[key] = deepClone(o2[key], visited);
  30742. }
  30743. }
  30744. return clone2;
  30745. case "Array":
  30746. id = _2.util.objId(o2);
  30747. if (visited[id]) {
  30748. return visited[id];
  30749. }
  30750. clone2 = [];
  30751. visited[id] = clone2;
  30752. o2.forEach(function(v2, i) {
  30753. clone2[i] = deepClone(v2, visited);
  30754. });
  30755. return clone2;
  30756. default:
  30757. return o2;
  30758. }
  30759. },
  30760. getLanguage: function(element) {
  30761. while (element) {
  30762. var m2 = lang.exec(element.className);
  30763. if (m2) {
  30764. return m2[1].toLowerCase();
  30765. }
  30766. element = element.parentElement;
  30767. }
  30768. return "none";
  30769. },
  30770. setLanguage: function(element, language) {
  30771. element.className = element.className.replace(RegExp(lang, "gi"), "");
  30772. element.classList.add("language-" + language);
  30773. },
  30774. currentScript: function() {
  30775. if (typeof document === "undefined") {
  30776. return null;
  30777. }
  30778. if ("currentScript" in document && 1 < 2) {
  30779. return document.currentScript;
  30780. }
  30781. try {
  30782. throw new Error();
  30783. } catch (err) {
  30784. var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
  30785. if (src) {
  30786. var scripts = document.getElementsByTagName("script");
  30787. for (var i in scripts) {
  30788. if (scripts[i].src == src) {
  30789. return scripts[i];
  30790. }
  30791. }
  30792. }
  30793. return null;
  30794. }
  30795. },
  30796. isActive: function(element, className, defaultActivation) {
  30797. var no = "no-" + className;
  30798. while (element) {
  30799. var classList = element.classList;
  30800. if (classList.contains(className)) {
  30801. return true;
  30802. }
  30803. if (classList.contains(no)) {
  30804. return false;
  30805. }
  30806. element = element.parentElement;
  30807. }
  30808. return !!defaultActivation;
  30809. }
  30810. },
  30811. languages: {
  30812. plain: plainTextGrammar,
  30813. plaintext: plainTextGrammar,
  30814. text: plainTextGrammar,
  30815. txt: plainTextGrammar,
  30816. extend: function(id, redef) {
  30817. var lang2 = _2.util.clone(_2.languages[id]);
  30818. for (var key in redef) {
  30819. lang2[key] = redef[key];
  30820. }
  30821. return lang2;
  30822. },
  30823. insertBefore: function(inside, before, insert, root2) {
  30824. root2 = root2 || _2.languages;
  30825. var grammar = root2[inside];
  30826. var ret = {};
  30827. for (var token in grammar) {
  30828. if (grammar.hasOwnProperty(token)) {
  30829. if (token == before) {
  30830. for (var newToken in insert) {
  30831. if (insert.hasOwnProperty(newToken)) {
  30832. ret[newToken] = insert[newToken];
  30833. }
  30834. }
  30835. }
  30836. if (!insert.hasOwnProperty(token)) {
  30837. ret[token] = grammar[token];
  30838. }
  30839. }
  30840. }
  30841. var old = root2[inside];
  30842. root2[inside] = ret;
  30843. _2.languages.DFS(_2.languages, function(key, value) {
  30844. if (value === old && key != inside) {
  30845. this[key] = ret;
  30846. }
  30847. });
  30848. return ret;
  30849. },
  30850. DFS: function DFS(o2, callback, type4, visited) {
  30851. visited = visited || {};
  30852. var objId = _2.util.objId;
  30853. for (var i in o2) {
  30854. if (o2.hasOwnProperty(i)) {
  30855. callback.call(o2, i, o2[i], type4 || i);
  30856. var property = o2[i];
  30857. var propertyType = _2.util.type(property);
  30858. if (propertyType === "Object" && !visited[objId(property)]) {
  30859. visited[objId(property)] = true;
  30860. DFS(property, callback, null, visited);
  30861. } else if (propertyType === "Array" && !visited[objId(property)]) {
  30862. visited[objId(property)] = true;
  30863. DFS(property, callback, i, visited);
  30864. }
  30865. }
  30866. }
  30867. }
  30868. },
  30869. plugins: {},
  30870. highlightAll: function(async, callback) {
  30871. _2.highlightAllUnder(document, async, callback);
  30872. },
  30873. highlightAllUnder: function(container, async, callback) {
  30874. var env = {
  30875. callback,
  30876. container,
  30877. selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
  30878. };
  30879. _2.hooks.run("before-highlightall", env);
  30880. env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
  30881. _2.hooks.run("before-all-elements-highlight", env);
  30882. for (var i = 0, element; element = env.elements[i++]; ) {
  30883. _2.highlightElement(element, async === true, env.callback);
  30884. }
  30885. },
  30886. highlightElement: function(element, async, callback) {
  30887. var language = _2.util.getLanguage(element);
  30888. var grammar = _2.languages[language];
  30889. _2.util.setLanguage(element, language);
  30890. var parent = element.parentElement;
  30891. if (parent && parent.nodeName.toLowerCase() === "pre") {
  30892. _2.util.setLanguage(parent, language);
  30893. }
  30894. var code = element.textContent;
  30895. var env = {
  30896. element,
  30897. language,
  30898. grammar,
  30899. code
  30900. };
  30901. function insertHighlightedCode(highlightedCode) {
  30902. env.highlightedCode = highlightedCode;
  30903. _2.hooks.run("before-insert", env);
  30904. env.element.innerHTML = env.highlightedCode;
  30905. _2.hooks.run("after-highlight", env);
  30906. _2.hooks.run("complete", env);
  30907. callback && callback.call(env.element);
  30908. }
  30909. _2.hooks.run("before-sanity-check", env);
  30910. parent = env.element.parentElement;
  30911. if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
  30912. parent.setAttribute("tabindex", "0");
  30913. }
  30914. if (!env.code) {
  30915. _2.hooks.run("complete", env);
  30916. callback && callback.call(env.element);
  30917. return;
  30918. }
  30919. _2.hooks.run("before-highlight", env);
  30920. if (!env.grammar) {
  30921. insertHighlightedCode(_2.util.encode(env.code));
  30922. return;
  30923. }
  30924. if (async && _self2.Worker) {
  30925. var worker = new Worker(_2.filename);
  30926. worker.onmessage = function(evt) {
  30927. insertHighlightedCode(evt.data);
  30928. };
  30929. worker.postMessage(JSON.stringify({
  30930. language: env.language,
  30931. code: env.code,
  30932. immediateClose: true
  30933. }));
  30934. } else {
  30935. insertHighlightedCode(_2.highlight(env.code, env.grammar, env.language));
  30936. }
  30937. },
  30938. highlight: function(text, grammar, language) {
  30939. var env = {
  30940. code: text,
  30941. grammar,
  30942. language
  30943. };
  30944. _2.hooks.run("before-tokenize", env);
  30945. if (!env.grammar) {
  30946. throw new Error('The language "' + env.language + '" has no grammar.');
  30947. }
  30948. env.tokens = _2.tokenize(env.code, env.grammar);
  30949. _2.hooks.run("after-tokenize", env);
  30950. return Token.stringify(_2.util.encode(env.tokens), env.language);
  30951. },
  30952. tokenize: function(text, grammar) {
  30953. var rest = grammar.rest;
  30954. if (rest) {
  30955. for (var token in rest) {
  30956. grammar[token] = rest[token];
  30957. }
  30958. delete grammar.rest;
  30959. }
  30960. var tokenList = new LinkedList();
  30961. addAfter(tokenList, tokenList.head, text);
  30962. matchGrammar(text, tokenList, grammar, tokenList.head, 0);
  30963. return toArray(tokenList);
  30964. },
  30965. hooks: {
  30966. all: {},
  30967. add: function(name, callback) {
  30968. var hooks = _2.hooks.all;
  30969. hooks[name] = hooks[name] || [];
  30970. hooks[name].push(callback);
  30971. },
  30972. run: function(name, env) {
  30973. var callbacks = _2.hooks.all[name];
  30974. if (!callbacks || !callbacks.length) {
  30975. return;
  30976. }
  30977. for (var i = 0, callback; callback = callbacks[i++]; ) {
  30978. callback(env);
  30979. }
  30980. }
  30981. },
  30982. Token
  30983. };
  30984. _self2.Prism = _2;
  30985. function Token(type4, content2, alias, matchedStr) {
  30986. this.type = type4;
  30987. this.content = content2;
  30988. this.alias = alias;
  30989. this.length = (matchedStr || "").length | 0;
  30990. }
  30991. Token.stringify = function stringify(o2, language) {
  30992. if (typeof o2 == "string") {
  30993. return o2;
  30994. }
  30995. if (Array.isArray(o2)) {
  30996. var s2 = "";
  30997. o2.forEach(function(e) {
  30998. s2 += stringify(e, language);
  30999. });
  31000. return s2;
  31001. }
  31002. var env = {
  31003. type: o2.type,
  31004. content: stringify(o2.content, language),
  31005. tag: "span",
  31006. classes: ["token", o2.type],
  31007. attributes: {},
  31008. language
  31009. };
  31010. var aliases = o2.alias;
  31011. if (aliases) {
  31012. if (Array.isArray(aliases)) {
  31013. Array.prototype.push.apply(env.classes, aliases);
  31014. } else {
  31015. env.classes.push(aliases);
  31016. }
  31017. }
  31018. _2.hooks.run("wrap", env);
  31019. var attributes = "";
  31020. for (var name in env.attributes) {
  31021. attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
  31022. }
  31023. return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
  31024. };
  31025. function matchPattern(pattern4, pos, text, lookbehind) {
  31026. pattern4.lastIndex = pos;
  31027. var match = pattern4.exec(text);
  31028. if (match && lookbehind && match[1]) {
  31029. var lookbehindLength = match[1].length;
  31030. match.index += lookbehindLength;
  31031. match[0] = match[0].slice(lookbehindLength);
  31032. }
  31033. return match;
  31034. }
  31035. function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
  31036. for (var token in grammar) {
  31037. if (!grammar.hasOwnProperty(token) || !grammar[token]) {
  31038. continue;
  31039. }
  31040. var patterns = grammar[token];
  31041. patterns = Array.isArray(patterns) ? patterns : [patterns];
  31042. for (var j = 0; j < patterns.length; ++j) {
  31043. if (rematch && rematch.cause == token + "," + j) {
  31044. return;
  31045. }
  31046. var patternObj = patterns[j];
  31047. var inside = patternObj.inside;
  31048. var lookbehind = !!patternObj.lookbehind;
  31049. var greedy = !!patternObj.greedy;
  31050. var alias = patternObj.alias;
  31051. if (greedy && !patternObj.pattern.global) {
  31052. var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
  31053. patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
  31054. }
  31055. var pattern4 = patternObj.pattern || patternObj;
  31056. for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
  31057. if (rematch && pos >= rematch.reach) {
  31058. break;
  31059. }
  31060. var str = currentNode.value;
  31061. if (tokenList.length > text.length) {
  31062. return;
  31063. }
  31064. if (str instanceof Token) {
  31065. continue;
  31066. }
  31067. var removeCount = 1;
  31068. var match;
  31069. if (greedy) {
  31070. match = matchPattern(pattern4, pos, text, lookbehind);
  31071. if (!match || match.index >= text.length) {
  31072. break;
  31073. }
  31074. var from = match.index;
  31075. var to = match.index + match[0].length;
  31076. var p2 = pos;
  31077. p2 += currentNode.value.length;
  31078. while (from >= p2) {
  31079. currentNode = currentNode.next;
  31080. p2 += currentNode.value.length;
  31081. }
  31082. p2 -= currentNode.value.length;
  31083. pos = p2;
  31084. if (currentNode.value instanceof Token) {
  31085. continue;
  31086. }
  31087. for (var k = currentNode; k !== tokenList.tail && (p2 < to || typeof k.value === "string"); k = k.next) {
  31088. removeCount++;
  31089. p2 += k.value.length;
  31090. }
  31091. removeCount--;
  31092. str = text.slice(pos, p2);
  31093. match.index -= pos;
  31094. } else {
  31095. match = matchPattern(pattern4, 0, str, lookbehind);
  31096. if (!match) {
  31097. continue;
  31098. }
  31099. }
  31100. var from = match.index;
  31101. var matchStr = match[0];
  31102. var before = str.slice(0, from);
  31103. var after = str.slice(from + matchStr.length);
  31104. var reach = pos + str.length;
  31105. if (rematch && reach > rematch.reach) {
  31106. rematch.reach = reach;
  31107. }
  31108. var removeFrom = currentNode.prev;
  31109. if (before) {
  31110. removeFrom = addAfter(tokenList, removeFrom, before);
  31111. pos += before.length;
  31112. }
  31113. removeRange(tokenList, removeFrom, removeCount);
  31114. var wrapped = new Token(token, inside ? _2.tokenize(matchStr, inside) : matchStr, alias, matchStr);
  31115. currentNode = addAfter(tokenList, removeFrom, wrapped);
  31116. if (after) {
  31117. addAfter(tokenList, currentNode, after);
  31118. }
  31119. if (removeCount > 1) {
  31120. var nestedRematch = {
  31121. cause: token + "," + j,
  31122. reach
  31123. };
  31124. matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
  31125. if (rematch && nestedRematch.reach > rematch.reach) {
  31126. rematch.reach = nestedRematch.reach;
  31127. }
  31128. }
  31129. }
  31130. }
  31131. }
  31132. }
  31133. function LinkedList() {
  31134. var head = { value: null, prev: null, next: null };
  31135. var tail = { value: null, prev: head, next: null };
  31136. head.next = tail;
  31137. this.head = head;
  31138. this.tail = tail;
  31139. this.length = 0;
  31140. }
  31141. function addAfter(list, node, value) {
  31142. var next = node.next;
  31143. var newNode = { value, prev: node, next };
  31144. node.next = newNode;
  31145. next.prev = newNode;
  31146. list.length++;
  31147. return newNode;
  31148. }
  31149. function removeRange(list, node, count) {
  31150. var next = node.next;
  31151. for (var i = 0; i < count && next !== list.tail; i++) {
  31152. next = next.next;
  31153. }
  31154. node.next = next;
  31155. next.prev = node;
  31156. list.length -= i;
  31157. }
  31158. function toArray(list) {
  31159. var array4 = [];
  31160. var node = list.head.next;
  31161. while (node !== list.tail) {
  31162. array4.push(node.value);
  31163. node = node.next;
  31164. }
  31165. return array4;
  31166. }
  31167. if (!_self2.document) {
  31168. if (!_self2.addEventListener) {
  31169. return _2;
  31170. }
  31171. if (!_2.disableWorkerMessageHandler) {
  31172. _self2.addEventListener("message", function(evt) {
  31173. var message = JSON.parse(evt.data);
  31174. var lang2 = message.language;
  31175. var code = message.code;
  31176. var immediateClose = message.immediateClose;
  31177. _self2.postMessage(_2.highlight(code, _2.languages[lang2], lang2));
  31178. if (immediateClose) {
  31179. _self2.close();
  31180. }
  31181. }, false);
  31182. }
  31183. return _2;
  31184. }
  31185. var script = _2.util.currentScript();
  31186. if (script) {
  31187. _2.filename = script.src;
  31188. if (script.hasAttribute("data-manual")) {
  31189. _2.manual = true;
  31190. }
  31191. }
  31192. function highlightAutomaticallyCallback() {
  31193. if (!_2.manual) {
  31194. _2.highlightAll();
  31195. }
  31196. }
  31197. if (!_2.manual) {
  31198. var readyState = document.readyState;
  31199. if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
  31200. document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
  31201. } else {
  31202. if (window.requestAnimationFrame) {
  31203. window.requestAnimationFrame(highlightAutomaticallyCallback);
  31204. } else {
  31205. window.setTimeout(highlightAutomaticallyCallback, 16);
  31206. }
  31207. }
  31208. }
  31209. return _2;
  31210. }(_self);
  31211. if (module2.exports) {
  31212. module2.exports = Prism2;
  31213. }
  31214. if (typeof commonjsGlobal !== "undefined") {
  31215. commonjsGlobal.Prism = Prism2;
  31216. }
  31217. })(prismCore);
  31218. Prism.languages.clike = {
  31219. "comment": [
  31220. {
  31221. pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
  31222. lookbehind: true,
  31223. greedy: true
  31224. },
  31225. {
  31226. pattern: /(^|[^\\:])\/\/.*/,
  31227. lookbehind: true,
  31228. greedy: true
  31229. }
  31230. ],
  31231. "string": {
  31232. pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  31233. greedy: true
  31234. },
  31235. "class-name": {
  31236. pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
  31237. lookbehind: true,
  31238. inside: {
  31239. "punctuation": /[.\\]/
  31240. }
  31241. },
  31242. "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
  31243. "boolean": /\b(?:false|true)\b/,
  31244. "function": /\b\w+(?=\()/,
  31245. "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
  31246. "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
  31247. "punctuation": /[{}[\];(),.:]/
  31248. };
  31249. Prism.languages.json = {
  31250. "property": {
  31251. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
  31252. lookbehind: true,
  31253. greedy: true
  31254. },
  31255. "string": {
  31256. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
  31257. lookbehind: true,
  31258. greedy: true
  31259. },
  31260. "comment": {
  31261. pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
  31262. greedy: true
  31263. },
  31264. "number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
  31265. "punctuation": /[{}[\],]/,
  31266. "operator": /:/,
  31267. "boolean": /\b(?:false|true)\b/,
  31268. "null": {
  31269. pattern: /\bnull\b/,
  31270. alias: "keyword"
  31271. }
  31272. };
  31273. Prism.languages.webmanifest = Prism.languages.json;
  31274. var prismTomorrow = "";
  31275. var CodeEditor_vue_vue_type_style_index_0_lang = "";
  31276. const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  31277. props: {
  31278. modelValue: { default: "" },
  31279. language: { default: "json" },
  31280. readonly: { type: Boolean, default: false }
  31281. },
  31282. emits: ["update:modelValue"],
  31283. setup(__props, { emit }) {
  31284. const code = computed({
  31285. get() {
  31286. return __props.modelValue;
  31287. },
  31288. set(val) {
  31289. emit("update:modelValue", val);
  31290. }
  31291. });
  31292. return (_ctx, _cache) => {
  31293. return openBlock(), createBlock(unref(PrismEditor), {
  31294. modelValue: code.value,
  31295. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => code.value = $event),
  31296. "max-h-xl": "",
  31297. class: "form-design-editor",
  31298. highlight: (code2) => {
  31299. return unref(prismCore.exports.highlight)(code2, unref(prismCore.exports.languages)[__props.language]);
  31300. },
  31301. readonly: __props.readonly,
  31302. "line-numbers": ""
  31303. }, null, 8, ["modelValue", "highlight", "readonly"]);
  31304. };
  31305. }
  31306. });
  31307. var DesignForm_vue_vue_type_style_index_0_lang = "";
  31308. const _hoisted_1 = {
  31309. "h-full": "",
  31310. "bg-white": "",
  31311. flex: ""
  31312. };
  31313. const _hoisted_2 = {
  31314. "pt-2": "",
  31315. "w-62": ""
  31316. };
  31317. const _hoisted_3 = {
  31318. border: "0 x solid gray-200",
  31319. flex: "~ 1 col nowrap"
  31320. };
  31321. const _hoisted_4 = {
  31322. border: "0 b solid gray-200",
  31323. flex: "",
  31324. "gap-2": "",
  31325. "items-center": "",
  31326. "justify-end": "",
  31327. "h-11": "",
  31328. "py-0": "",
  31329. "px-2": ""
  31330. };
  31331. const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "ep:edit" }, null, -1);
  31332. const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u4FEE\u6539 ");
  31333. const _hoisted_7 = /* @__PURE__ */ createElementVNode("i", { class: "custom:clearable" }, null, -1);
  31334. const _hoisted_8 = /* @__PURE__ */ createTextVNode("\u6E05\u7A7A ");
  31335. const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "custom:preview" }, null, -1);
  31336. const _hoisted_10 = /* @__PURE__ */ createTextVNode("\u9884\u89C8 ");
  31337. const _hoisted_11 = {
  31338. relative: "",
  31339. "w-75": "",
  31340. flex: "~ col"
  31341. };
  31342. const _hoisted_12 = {
  31343. border: "0 b-1 gray-200",
  31344. grid: "~ cols-2",
  31345. "min-h-11": "",
  31346. "px-2": ""
  31347. };
  31348. const _hoisted_13 = /* @__PURE__ */ createTextVNode(" \u590D\u5236 ");
  31349. const _hoisted_14 = /* @__PURE__ */ createTextVNode(" \u786E\u8BA4\u4FEE\u6539 ");
  31350. const __default__ = { name: "DesignForm" };
  31351. const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
  31352. props: {
  31353. preview: {
  31354. type: Boolean,
  31355. default: true
  31356. },
  31357. generateJson: {
  31358. type: Boolean,
  31359. default: true
  31360. },
  31361. clearable: {
  31362. type: Boolean,
  31363. default: true
  31364. },
  31365. basicFieldsList: {
  31366. type: Array,
  31367. default: () => basicFields
  31368. },
  31369. advanceFieldsList: {
  31370. type: Array,
  31371. default: () => advanceFields
  31372. },
  31373. layoutFieldsList: {
  31374. type: Array,
  31375. default: () => layoutFields
  31376. },
  31377. request: {
  31378. type: Function
  31379. }
  31380. },
  31381. setup(__props, { expose }) {
  31382. let tab = ref(0);
  31383. let selectWidget = ref();
  31384. watch(() => selectWidget.value, (val) => {
  31385. tab.value = val ? 0 : 1;
  31386. });
  31387. let widgetForm = ref(getWidgetForm());
  31388. let generateJsonVisible = ref(false);
  31389. let generateJsonTemplate = ref(JSON.stringify(getWidgetForm(), null, 2));
  31390. const handleUploadJson = () => {
  31391. var _a2;
  31392. try {
  31393. widgetForm.value = JSON.parse(generateJsonTemplate.value);
  31394. selectWidget.value = (_a2 = widgetForm.value.list) == null ? void 0 : _a2[0];
  31395. generateJsonVisible.value = false;
  31396. ElMessage.success("\u4FEE\u6539\u6210\u529F");
  31397. } catch (error) {
  31398. ElMessage.error("\u4FEE\u6539\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5JSON\u683C\u5F0F\u662F\u5426\u6B63\u786E\u3002");
  31399. }
  31400. };
  31401. const handleGenerateJson = () => (generateJsonTemplate.value = JSON.stringify(widgetForm.value, null, 2)) && (generateJsonVisible.value = true);
  31402. const handleClearable = () => {
  31403. widgetForm.value = getWidgetForm();
  31404. selectWidget.value = void 0;
  31405. };
  31406. let dataVisible = ref(false);
  31407. const generateFormRef = ref(null);
  31408. const handleGetData = async () => {
  31409. var _a2;
  31410. dataVisible.value = !dataVisible.value;
  31411. if (!dataVisible.value)
  31412. return;
  31413. const res = await ((_a2 = generateFormRef.value) == null ? void 0 : _a2.getData());
  31414. generateJsonTemplate.value = JSON.stringify(res, null, 2);
  31415. };
  31416. const handleReset = () => {
  31417. var _a2;
  31418. return (_a2 = generateFormRef.value) == null ? void 0 : _a2.reset();
  31419. };
  31420. const handleCopyClick = (text) => {
  31421. navigator.clipboard.writeText(text);
  31422. ElMessage.success({ message: "Copy\u6210\u529F" });
  31423. };
  31424. const previewVisible = ref(false);
  31425. expose({
  31426. getJson: () => widgetForm.value,
  31427. setJson: (json) => {
  31428. var _a2;
  31429. widgetForm.value = json;
  31430. selectWidget.value = (_a2 = json.list) == null ? void 0 : _a2[0];
  31431. },
  31432. clear: handleClearable
  31433. });
  31434. return (_ctx, _cache) => {
  31435. const _component_el_button = ElButton;
  31436. const _component_el_dialog = ElDialog;
  31437. return openBlock(), createElementBlock("section", _hoisted_1, [
  31438. createElementVNode("aside", _hoisted_2, [
  31439. createVNode(_sfc_main$6, {
  31440. title: "\u57FA\u7840\u5B57\u6BB5",
  31441. fields: __props.basicFieldsList,
  31442. list: unref(basicComponents),
  31443. allList: widgetForm.value
  31444. }, null, 8, ["fields", "list", "allList"]),
  31445. createVNode(_sfc_main$6, {
  31446. title: "\u9AD8\u7EA7\u5B57\u6BB5",
  31447. fields: __props.advanceFieldsList,
  31448. list: unref(advanceComponents),
  31449. allList: widgetForm.value
  31450. }, null, 8, ["fields", "list", "allList"]),
  31451. createVNode(_sfc_main$6, {
  31452. title: "\u5E03\u5C40\u5B57\u6BB5",
  31453. fields: __props.layoutFieldsList,
  31454. list: unref(layoutComponents),
  31455. allList: widgetForm.value
  31456. }, null, 8, ["fields", "list", "allList"])
  31457. ]),
  31458. createElementVNode("main", _hoisted_3, [
  31459. createElementVNode("header", _hoisted_4, [
  31460. renderSlot(_ctx.$slots, "default"),
  31461. __props.generateJson ? (openBlock(), createBlock(_component_el_button, {
  31462. key: 0,
  31463. type: "text",
  31464. onClick: handleGenerateJson
  31465. }, {
  31466. icon: withCtx(() => [
  31467. _hoisted_5
  31468. ]),
  31469. default: withCtx(() => [
  31470. _hoisted_6
  31471. ]),
  31472. _: 1
  31473. })) : createCommentVNode("", true),
  31474. __props.clearable ? (openBlock(), createBlock(_component_el_button, {
  31475. key: 1,
  31476. type: "text",
  31477. onClick: handleClearable
  31478. }, {
  31479. icon: withCtx(() => [
  31480. _hoisted_7
  31481. ]),
  31482. default: withCtx(() => [
  31483. _hoisted_8
  31484. ]),
  31485. _: 1
  31486. })) : createCommentVNode("", true),
  31487. __props.preview ? (openBlock(), createBlock(_component_el_button, {
  31488. key: 2,
  31489. type: "text",
  31490. onClick: _cache[0] || (_cache[0] = ($event) => previewVisible.value = true)
  31491. }, {
  31492. icon: withCtx(() => [
  31493. _hoisted_9
  31494. ]),
  31495. default: withCtx(() => [
  31496. _hoisted_10
  31497. ]),
  31498. _: 1
  31499. })) : createCommentVNode("", true)
  31500. ]),
  31501. createVNode(_sfc_main$4, mergeProps({ ref: "widgetFormRef" }, widgetForm.value, {
  31502. selectWidget: selectWidget.value,
  31503. "onUpdate:selectWidget": _cache[1] || (_cache[1] = ($event) => selectWidget.value = $event)
  31504. }), null, 16, ["selectWidget"])
  31505. ]),
  31506. createElementVNode("aside", _hoisted_11, [
  31507. createElementVNode("header", _hoisted_12, [
  31508. createElementVNode("div", {
  31509. class: normalizeClass([{ active: !tab.value }, "config-tab"]),
  31510. onClick: _cache[2] || (_cache[2] = ($event) => tab.value = 0)
  31511. }, " \u5B57\u6BB5\u5C5E\u6027 ", 2),
  31512. createElementVNode("div", {
  31513. class: normalizeClass([{ active: tab.value }, "config-tab"]),
  31514. onClick: _cache[3] || (_cache[3] = ($event) => tab.value = 1)
  31515. }, " \u8868\u5355\u5C5E\u6027 ", 2)
  31516. ]),
  31517. withDirectives(createVNode(WidgetConfig, {
  31518. select: selectWidget.value,
  31519. "onUpdate:select": _cache[4] || (_cache[4] = ($event) => selectWidget.value = $event)
  31520. }, null, 8, ["select"]), [
  31521. [vShow, !tab.value]
  31522. ]),
  31523. withDirectives(createVNode(_sfc_main$2, {
  31524. config: widgetForm.value.config,
  31525. "onUpdate:config": _cache[5] || (_cache[5] = ($event) => widgetForm.value.config = $event)
  31526. }, null, 8, ["config"]), [
  31527. [vShow, tab.value]
  31528. ])
  31529. ]),
  31530. createVNode(_component_el_dialog, {
  31531. modelValue: previewVisible.value,
  31532. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => previewVisible.value = $event),
  31533. "destroy-on-close": "",
  31534. title: "\u9884\u89C8",
  31535. "z-index": 2e3,
  31536. width: 800,
  31537. onClose: _cache[9] || (_cache[9] = ($event) => dataVisible.value = false)
  31538. }, {
  31539. footer: withCtx(() => [
  31540. createVNode(_component_el_button, {
  31541. onClick: _cache[7] || (_cache[7] = ($event) => dataVisible.value ? handleCopyClick(generateJsonTemplate.value) : handleReset())
  31542. }, {
  31543. default: withCtx(() => [
  31544. createTextVNode(toDisplayString(dataVisible.value ? "\u590D\u5236" : "\u91CD\u7F6E"), 1)
  31545. ]),
  31546. _: 1
  31547. }),
  31548. createVNode(_component_el_button, {
  31549. type: "primary",
  31550. onClick: handleGetData
  31551. }, {
  31552. default: withCtx(() => [
  31553. createTextVNode(toDisplayString(dataVisible.value ? "\u8FD4\u56DE\u9884\u89C8" : "\u83B7\u53D6\u6570\u636E"), 1)
  31554. ]),
  31555. _: 1
  31556. })
  31557. ]),
  31558. default: withCtx(() => [
  31559. withDirectives(createVNode(_sfc_main$1, {
  31560. modelValue: generateJsonTemplate.value,
  31561. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => generateJsonTemplate.value = $event)
  31562. }, null, 8, ["modelValue"]), [
  31563. [vShow, dataVisible.value]
  31564. ]),
  31565. withDirectives(createVNode(GenerateForm, {
  31566. ref_key: "generateFormRef",
  31567. ref: generateFormRef,
  31568. request: __props.request,
  31569. data: widgetForm.value
  31570. }, null, 8, ["request", "data"]), [
  31571. [vShow, !dataVisible.value]
  31572. ])
  31573. ]),
  31574. _: 1
  31575. }, 8, ["modelValue"]),
  31576. createVNode(_component_el_dialog, {
  31577. modelValue: generateJsonVisible.value,
  31578. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => generateJsonVisible.value = $event),
  31579. "append-to-body": "",
  31580. title: "\u4FEE\u6539JSON",
  31581. "z-index": 2e4,
  31582. width: 800
  31583. }, {
  31584. footer: withCtx(() => [
  31585. createVNode(_component_el_button, {
  31586. onClick: _cache[11] || (_cache[11] = ($event) => handleCopyClick(generateJsonTemplate.value))
  31587. }, {
  31588. default: withCtx(() => [
  31589. _hoisted_13
  31590. ]),
  31591. _: 1
  31592. }),
  31593. createVNode(_component_el_button, {
  31594. type: "primary",
  31595. onClick: handleUploadJson
  31596. }, {
  31597. default: withCtx(() => [
  31598. _hoisted_14
  31599. ]),
  31600. _: 1
  31601. })
  31602. ]),
  31603. default: withCtx(() => [
  31604. createVNode(_sfc_main$1, {
  31605. modelValue: generateJsonTemplate.value,
  31606. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => generateJsonTemplate.value = $event)
  31607. }, null, 8, ["modelValue"])
  31608. ]),
  31609. _: 1
  31610. }, 8, ["modelValue"])
  31611. ]);
  31612. };
  31613. }
  31614. }));
  31615. export { _sfc_main as DesignForm, GenerateForm, advanceFields, basicFields, layoutFields };
  31616. //# sourceMappingURL=index.es.js.map