index.es.js 1.2 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545
  1. import './index.css';
  2. var __defProp = Object.defineProperty;
  3. var __defProps = Object.defineProperties;
  4. var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
  5. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  6. var __hasOwnProp = Object.prototype.hasOwnProperty;
  7. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  8. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  9. var __spreadValues = (a2, b2) => {
  10. for (var prop in b2 || (b2 = {}))
  11. if (__hasOwnProp.call(b2, prop))
  12. __defNormalProp(a2, prop, b2[prop]);
  13. if (__getOwnPropSymbols)
  14. for (var prop of __getOwnPropSymbols(b2)) {
  15. if (__propIsEnum.call(b2, prop))
  16. __defNormalProp(a2, prop, b2[prop]);
  17. }
  18. return a2;
  19. };
  20. var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
  21. var __objRest = (source, exclude) => {
  22. var target = {};
  23. for (var prop in source)
  24. if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
  25. target[prop] = source[prop];
  26. if (source != null && __getOwnPropSymbols)
  27. for (var prop of __getOwnPropSymbols(source)) {
  28. if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
  29. target[prop] = source[prop];
  30. }
  31. return target;
  32. };
  33. import { ref, watch, getCurrentScope, onScopeDispose, unref, getCurrentInstance, computed, defineComponent, openBlock, createElementBlock, createElementVNode, warn, isVNode, Fragment, Comment, inject, provide, onMounted, watchEffect, onBeforeUnmount, isRef, onBeforeMount, mergeProps, renderSlot, useAttrs as useAttrs$1, useSlots, shallowRef, nextTick, onUpdated, toRef, withDirectives, normalizeClass, normalizeStyle, createCommentVNode, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, vShow, Transition, resolveComponent, reactive, cloneVNode, Text, Teleport, createTextVNode, readonly, resolveDirective, renderList, h as h$1, vModelCheckbox, toRefs, withKeys, vModelRadio, onBeforeUpdate, vModelText, createSlots, markRaw, effectScope, toRaw, triggerRef, normalizeProps, guardReactiveProps, onUnmounted, TransitionGroup, pushScopeId, popScopeId, createPropsRestProxy } from "vue";
  34. import { ElMessage } from "element-plus";
  35. import Draggable from "vuedraggable";
  36. var elMessage = "";
  37. const rules$1 = {
  38. trigger: "blur",
  39. enum: "",
  40. len: void 0,
  41. max: void 0,
  42. message: "",
  43. min: void 0,
  44. pattern: "",
  45. required: false,
  46. type: "any"
  47. };
  48. const getWidgetForm = () => ({
  49. list: [],
  50. config: {
  51. size: "default",
  52. hideRequiredAsterisk: false,
  53. labelWidth: 100,
  54. labelPosition: "right"
  55. }
  56. });
  57. const basicComponents = [
  58. {
  59. label: "\u5355\u884C\u6587\u672C",
  60. type: "input",
  61. options: {
  62. width: "100%",
  63. defaultValue: "",
  64. placeholder: "",
  65. maxlength: null,
  66. prefix: "",
  67. suffix: "",
  68. prepend: "",
  69. append: "",
  70. disabled: false,
  71. clearable: false,
  72. readonly: false,
  73. rules: rules$1
  74. }
  75. },
  76. {
  77. label: "\u5BC6\u7801\u6846",
  78. type: "password",
  79. options: {
  80. width: "100%",
  81. defaultValue: "",
  82. placeholder: "",
  83. maxlength: null,
  84. prefix: "",
  85. suffix: "",
  86. prepend: "",
  87. append: "",
  88. showPassword: true,
  89. disabled: false,
  90. clearable: false,
  91. readonly: false,
  92. rules: rules$1
  93. }
  94. },
  95. {
  96. label: "\u591A\u884C\u6587\u672C",
  97. type: "textarea",
  98. options: {
  99. width: "100%",
  100. defaultValue: "",
  101. placeholder: "",
  102. maxlength: null,
  103. rows: 4,
  104. autosize: false,
  105. showWordLimit: false,
  106. disabled: false,
  107. clearable: false,
  108. readonly: false,
  109. rules: rules$1
  110. }
  111. },
  112. {
  113. label: "\u8BA1\u6570\u5668",
  114. type: "number",
  115. options: {
  116. width: "",
  117. defaultValue: 0,
  118. min: 0,
  119. max: 100,
  120. step: 1,
  121. disabled: false,
  122. rules: rules$1
  123. }
  124. },
  125. {
  126. label: "\u5355\u9009\u6846\u7EC4",
  127. type: "radio",
  128. options: {
  129. defaultValue: "",
  130. width: "",
  131. inline: true,
  132. remote: false,
  133. showLabel: true,
  134. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  135. options: [
  136. {
  137. value: "Option 1",
  138. label: "Option 1"
  139. },
  140. {
  141. value: "Option 2",
  142. label: "Option 2"
  143. },
  144. {
  145. value: "Option 3",
  146. label: "Option 3"
  147. }
  148. ],
  149. remoteOptions: [],
  150. props: {
  151. value: "value",
  152. label: "label"
  153. },
  154. disabled: false,
  155. rules: rules$1
  156. }
  157. },
  158. {
  159. label: "\u591A\u9009\u6846\u7EC4",
  160. type: "checkbox",
  161. options: {
  162. defaultValue: [],
  163. width: "",
  164. inline: true,
  165. remote: false,
  166. showLabel: true,
  167. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  168. options: [
  169. {
  170. label: "Option 1",
  171. value: "Option 1"
  172. },
  173. {
  174. label: "Option 2",
  175. value: "Option 2"
  176. },
  177. {
  178. label: "Option 3",
  179. value: "Option 3"
  180. }
  181. ],
  182. remoteOptions: [],
  183. props: {
  184. value: "value",
  185. label: "label"
  186. },
  187. disabled: false,
  188. rules: rules$1
  189. }
  190. },
  191. {
  192. label: "\u65F6\u95F4\u9009\u62E9\u5668",
  193. type: "time",
  194. options: {
  195. defaultValue: "",
  196. width: "",
  197. placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
  198. format: "HH:mm:ss",
  199. valueFormat: "HH:mm:ss",
  200. readonly: false,
  201. editable: true,
  202. clearable: true,
  203. disabled: false,
  204. rules: rules$1
  205. }
  206. },
  207. {
  208. label: "\u65E5\u671F\u9009\u62E9\u5668",
  209. type: "date",
  210. options: {
  211. defaultValue: "",
  212. width: "",
  213. placeholder: "\u8BF7\u9009\u62E9\u65F6\u95F4",
  214. format: "YYYY-MM-DD",
  215. readonly: false,
  216. editable: true,
  217. clearable: true,
  218. disabled: false,
  219. rules: rules$1
  220. }
  221. },
  222. {
  223. label: "\u8BC4\u5206",
  224. type: "rate",
  225. options: {
  226. defaultValue: 0,
  227. max: 5,
  228. allowHalf: false,
  229. disabled: false,
  230. rules: rules$1
  231. }
  232. },
  233. {
  234. label: "\u4E0B\u62C9\u9009\u62E9\u6846",
  235. type: "select",
  236. options: {
  237. defaultValue: "",
  238. width: "200px",
  239. multiple: false,
  240. placeholder: "",
  241. remote: false,
  242. showLabel: true,
  243. filterable: false,
  244. clearable: false,
  245. disabled: false,
  246. props: {
  247. label: "label",
  248. value: "value"
  249. },
  250. options: [
  251. {
  252. label: "Option 1",
  253. value: "Option 1"
  254. },
  255. {
  256. label: "Option 2",
  257. value: "Option 2"
  258. },
  259. {
  260. label: "Option 3",
  261. value: "Option 3"
  262. }
  263. ],
  264. remoteOptions: [],
  265. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  266. rules: rules$1
  267. }
  268. },
  269. {
  270. label: "\u5F00\u5173",
  271. type: "switch",
  272. options: {
  273. defaultValue: false,
  274. disabled: false,
  275. activeText: "",
  276. inactiveText: "",
  277. rules: rules$1
  278. }
  279. },
  280. {
  281. label: "\u6ED1\u5757",
  282. type: "slider",
  283. options: {
  284. defaultValue: 0,
  285. width: "",
  286. min: 0,
  287. max: 100,
  288. step: 1,
  289. disabled: false,
  290. range: false,
  291. rules: rules$1
  292. }
  293. },
  294. {
  295. label: "\u6587\u5B57",
  296. type: "text",
  297. options: {
  298. defaultValue: "This is a text"
  299. }
  300. }
  301. ];
  302. const basicFields = basicComponents.map((i) => i.type);
  303. const advanceComponents = [
  304. {
  305. label: "\u56FE\u7247",
  306. type: "img-upload",
  307. options: {
  308. defaultValue: [],
  309. name: "file",
  310. action: "http://example.com/upload",
  311. method: "post",
  312. listType: "text",
  313. accept: "image/*",
  314. limit: 1,
  315. multiple: false,
  316. disabled: true,
  317. rules: rules$1
  318. }
  319. },
  320. {
  321. label: "\u4E0B\u8F7D",
  322. type: "download",
  323. labelWidth: "auto",
  324. options: {
  325. defaultValue: "",
  326. name: "file"
  327. }
  328. },
  329. {
  330. label: "\u7EA7\u8054\u9009\u62E9\u5668",
  331. type: "cascader",
  332. options: {
  333. defaultValue: [],
  334. width: "200px",
  335. placeholder: "",
  336. disabled: false,
  337. clearable: false,
  338. filterable: false,
  339. remote: true,
  340. remoteOptions: [],
  341. props: {
  342. label: "label",
  343. value: "value",
  344. children: "children"
  345. },
  346. remoteFunc: "https://raw.githubusercontent.com/fuchengwei/vue-form-create/master/mock/mock.json",
  347. rules: rules$1
  348. }
  349. }
  350. ];
  351. const advanceFields = advanceComponents.map((i) => i.type);
  352. const layoutComponents = [
  353. {
  354. label: "\u6805\u683C\u5E03\u5C40",
  355. type: "grid",
  356. columns: [
  357. {
  358. span: 12,
  359. list: []
  360. },
  361. {
  362. span: 12,
  363. list: []
  364. }
  365. ],
  366. options: {
  367. gutter: 0,
  368. align: "initial"
  369. }
  370. },
  371. {
  372. label: "\u6570\u636E\u8868\u683C",
  373. type: "table",
  374. columns: [
  375. { label: "\u540D\u79F0", prop: "name" },
  376. { label: "\u521B\u5EFA\u65F6\u95F4", prop: "createTime" }
  377. ],
  378. options: {
  379. defaultValue: [],
  380. disabled: false,
  381. size: "",
  382. align: "center"
  383. }
  384. },
  385. {
  386. label: "\u5206\u5272\u7EBF",
  387. type: "divider",
  388. options: {}
  389. }
  390. ];
  391. const layoutFields = layoutComponents.map((i) => i.type);
  392. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  393. var freeGlobal$1 = freeGlobal;
  394. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  395. var root = freeGlobal$1 || freeSelf || Function("return this")();
  396. var root$1 = root;
  397. var Symbol$1 = root$1.Symbol;
  398. var Symbol$2 = Symbol$1;
  399. var objectProto$e = Object.prototype;
  400. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  401. var nativeObjectToString$1 = objectProto$e.toString;
  402. var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
  403. function getRawTag(value) {
  404. var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  405. try {
  406. value[symToStringTag$1] = void 0;
  407. var unmasked = true;
  408. } catch (e) {
  409. }
  410. var result = nativeObjectToString$1.call(value);
  411. if (unmasked) {
  412. if (isOwn) {
  413. value[symToStringTag$1] = tag;
  414. } else {
  415. delete value[symToStringTag$1];
  416. }
  417. }
  418. return result;
  419. }
  420. var objectProto$d = Object.prototype;
  421. var nativeObjectToString = objectProto$d.toString;
  422. function objectToString$1(value) {
  423. return nativeObjectToString.call(value);
  424. }
  425. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  426. var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
  427. function baseGetTag(value) {
  428. if (value == null) {
  429. return value === void 0 ? undefinedTag : nullTag;
  430. }
  431. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString$1(value);
  432. }
  433. function isObjectLike(value) {
  434. return value != null && typeof value == "object";
  435. }
  436. var symbolTag$3 = "[object Symbol]";
  437. function isSymbol(value) {
  438. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  439. }
  440. function arrayMap(array4, iteratee) {
  441. var index = -1, length = array4 == null ? 0 : array4.length, result = Array(length);
  442. while (++index < length) {
  443. result[index] = iteratee(array4[index], index, array4);
  444. }
  445. return result;
  446. }
  447. var isArray$1 = Array.isArray;
  448. var isArray$2 = isArray$1;
  449. var INFINITY$3 = 1 / 0;
  450. var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  451. function baseToString(value) {
  452. if (typeof value == "string") {
  453. return value;
  454. }
  455. if (isArray$2(value)) {
  456. return arrayMap(value, baseToString) + "";
  457. }
  458. if (isSymbol(value)) {
  459. return symbolToString ? symbolToString.call(value) : "";
  460. }
  461. var result = value + "";
  462. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  463. }
  464. var reWhitespace = /\s/;
  465. function trimmedEndIndex(string3) {
  466. var index = string3.length;
  467. while (index-- && reWhitespace.test(string3.charAt(index))) {
  468. }
  469. return index;
  470. }
  471. var reTrimStart = /^\s+/;
  472. function baseTrim(string3) {
  473. return string3 ? string3.slice(0, trimmedEndIndex(string3) + 1).replace(reTrimStart, "") : string3;
  474. }
  475. function isObject$2(value) {
  476. var type4 = typeof value;
  477. return value != null && (type4 == "object" || type4 == "function");
  478. }
  479. var NAN = 0 / 0;
  480. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  481. var reIsBinary = /^0b[01]+$/i;
  482. var reIsOctal = /^0o[0-7]+$/i;
  483. var freeParseInt = parseInt;
  484. function toNumber(value) {
  485. if (typeof value == "number") {
  486. return value;
  487. }
  488. if (isSymbol(value)) {
  489. return NAN;
  490. }
  491. if (isObject$2(value)) {
  492. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  493. value = isObject$2(other) ? other + "" : other;
  494. }
  495. if (typeof value != "string") {
  496. return value === 0 ? value : +value;
  497. }
  498. value = baseTrim(value);
  499. var isBinary = reIsBinary.test(value);
  500. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  501. }
  502. function identity(value) {
  503. return value;
  504. }
  505. var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  506. function isFunction$1(value) {
  507. if (!isObject$2(value)) {
  508. return false;
  509. }
  510. var tag = baseGetTag(value);
  511. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  512. }
  513. var coreJsData = root$1["__core-js_shared__"];
  514. var coreJsData$1 = coreJsData;
  515. var maskSrcKey = function() {
  516. var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  517. return uid2 ? "Symbol(src)_1." + uid2 : "";
  518. }();
  519. function isMasked(func) {
  520. return !!maskSrcKey && maskSrcKey in func;
  521. }
  522. var funcProto$1 = Function.prototype;
  523. var funcToString$1 = funcProto$1.toString;
  524. function toSource(func) {
  525. if (func != null) {
  526. try {
  527. return funcToString$1.call(func);
  528. } catch (e) {
  529. }
  530. try {
  531. return func + "";
  532. } catch (e) {
  533. }
  534. }
  535. return "";
  536. }
  537. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  538. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  539. var funcProto = Function.prototype, objectProto$c = Object.prototype;
  540. var funcToString = funcProto.toString;
  541. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  542. var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  543. function baseIsNative(value) {
  544. if (!isObject$2(value) || isMasked(value)) {
  545. return false;
  546. }
  547. var pattern4 = isFunction$1(value) ? reIsNative : reIsHostCtor;
  548. return pattern4.test(toSource(value));
  549. }
  550. function getValue$1(object4, key) {
  551. return object4 == null ? void 0 : object4[key];
  552. }
  553. function getNative(object4, key) {
  554. var value = getValue$1(object4, key);
  555. return baseIsNative(value) ? value : void 0;
  556. }
  557. var WeakMap = getNative(root$1, "WeakMap");
  558. var WeakMap$1 = WeakMap;
  559. var objectCreate = Object.create;
  560. var baseCreate = function() {
  561. function object4() {
  562. }
  563. return function(proto) {
  564. if (!isObject$2(proto)) {
  565. return {};
  566. }
  567. if (objectCreate) {
  568. return objectCreate(proto);
  569. }
  570. object4.prototype = proto;
  571. var result = new object4();
  572. object4.prototype = void 0;
  573. return result;
  574. };
  575. }();
  576. var baseCreate$1 = baseCreate;
  577. function apply(func, thisArg, args) {
  578. switch (args.length) {
  579. case 0:
  580. return func.call(thisArg);
  581. case 1:
  582. return func.call(thisArg, args[0]);
  583. case 2:
  584. return func.call(thisArg, args[0], args[1]);
  585. case 3:
  586. return func.call(thisArg, args[0], args[1], args[2]);
  587. }
  588. return func.apply(thisArg, args);
  589. }
  590. function noop$1() {
  591. }
  592. function copyArray(source, array4) {
  593. var index = -1, length = source.length;
  594. array4 || (array4 = Array(length));
  595. while (++index < length) {
  596. array4[index] = source[index];
  597. }
  598. return array4;
  599. }
  600. var HOT_COUNT = 800, HOT_SPAN = 16;
  601. var nativeNow = Date.now;
  602. function shortOut(func) {
  603. var count = 0, lastCalled = 0;
  604. return function() {
  605. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  606. lastCalled = stamp;
  607. if (remaining > 0) {
  608. if (++count >= HOT_COUNT) {
  609. return arguments[0];
  610. }
  611. } else {
  612. count = 0;
  613. }
  614. return func.apply(void 0, arguments);
  615. };
  616. }
  617. function constant(value) {
  618. return function() {
  619. return value;
  620. };
  621. }
  622. var defineProperty = function() {
  623. try {
  624. var func = getNative(Object, "defineProperty");
  625. func({}, "", {});
  626. return func;
  627. } catch (e) {
  628. }
  629. }();
  630. var defineProperty$1 = defineProperty;
  631. var baseSetToString = !defineProperty$1 ? identity : function(func, string3) {
  632. return defineProperty$1(func, "toString", {
  633. "configurable": true,
  634. "enumerable": false,
  635. "value": constant(string3),
  636. "writable": true
  637. });
  638. };
  639. var baseSetToString$1 = baseSetToString;
  640. var setToString = shortOut(baseSetToString$1);
  641. var setToString$1 = setToString;
  642. function arrayEach(array4, iteratee) {
  643. var index = -1, length = array4 == null ? 0 : array4.length;
  644. while (++index < length) {
  645. if (iteratee(array4[index], index, array4) === false) {
  646. break;
  647. }
  648. }
  649. return array4;
  650. }
  651. function baseFindIndex(array4, predicate, fromIndex, fromRight) {
  652. var length = array4.length, index = fromIndex + (fromRight ? 1 : -1);
  653. while (fromRight ? index-- : ++index < length) {
  654. if (predicate(array4[index], index, array4)) {
  655. return index;
  656. }
  657. }
  658. return -1;
  659. }
  660. function baseIsNaN(value) {
  661. return value !== value;
  662. }
  663. function strictIndexOf(array4, value, fromIndex) {
  664. var index = fromIndex - 1, length = array4.length;
  665. while (++index < length) {
  666. if (array4[index] === value) {
  667. return index;
  668. }
  669. }
  670. return -1;
  671. }
  672. function baseIndexOf(array4, value, fromIndex) {
  673. return value === value ? strictIndexOf(array4, value, fromIndex) : baseFindIndex(array4, baseIsNaN, fromIndex);
  674. }
  675. function arrayIncludes(array4, value) {
  676. var length = array4 == null ? 0 : array4.length;
  677. return !!length && baseIndexOf(array4, value, 0) > -1;
  678. }
  679. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  680. var reIsUint = /^(?:0|[1-9]\d*)$/;
  681. function isIndex(value, length) {
  682. var type4 = typeof value;
  683. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  684. return !!length && (type4 == "number" || type4 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  685. }
  686. function baseAssignValue(object4, key, value) {
  687. if (key == "__proto__" && defineProperty$1) {
  688. defineProperty$1(object4, key, {
  689. "configurable": true,
  690. "enumerable": true,
  691. "value": value,
  692. "writable": true
  693. });
  694. } else {
  695. object4[key] = value;
  696. }
  697. }
  698. function eq(value, other) {
  699. return value === other || value !== value && other !== other;
  700. }
  701. var objectProto$b = Object.prototype;
  702. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  703. function assignValue(object4, key, value) {
  704. var objValue = object4[key];
  705. if (!(hasOwnProperty$a.call(object4, key) && eq(objValue, value)) || value === void 0 && !(key in object4)) {
  706. baseAssignValue(object4, key, value);
  707. }
  708. }
  709. function copyObject(source, props, object4, customizer) {
  710. var isNew = !object4;
  711. object4 || (object4 = {});
  712. var index = -1, length = props.length;
  713. while (++index < length) {
  714. var key = props[index];
  715. var newValue = customizer ? customizer(object4[key], source[key], key, object4, source) : void 0;
  716. if (newValue === void 0) {
  717. newValue = source[key];
  718. }
  719. if (isNew) {
  720. baseAssignValue(object4, key, newValue);
  721. } else {
  722. assignValue(object4, key, newValue);
  723. }
  724. }
  725. return object4;
  726. }
  727. var nativeMax$1 = Math.max;
  728. function overRest(func, start2, transform) {
  729. start2 = nativeMax$1(start2 === void 0 ? func.length - 1 : start2, 0);
  730. return function() {
  731. var args = arguments, index = -1, length = nativeMax$1(args.length - start2, 0), array4 = Array(length);
  732. while (++index < length) {
  733. array4[index] = args[start2 + index];
  734. }
  735. index = -1;
  736. var otherArgs = Array(start2 + 1);
  737. while (++index < start2) {
  738. otherArgs[index] = args[index];
  739. }
  740. otherArgs[start2] = transform(array4);
  741. return apply(func, this, otherArgs);
  742. };
  743. }
  744. function baseRest(func, start2) {
  745. return setToString$1(overRest(func, start2, identity), func + "");
  746. }
  747. var MAX_SAFE_INTEGER = 9007199254740991;
  748. function isLength(value) {
  749. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  750. }
  751. function isArrayLike(value) {
  752. return value != null && isLength(value.length) && !isFunction$1(value);
  753. }
  754. var objectProto$a = Object.prototype;
  755. function isPrototype(value) {
  756. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$a;
  757. return value === proto;
  758. }
  759. function baseTimes(n, iteratee) {
  760. var index = -1, result = Array(n);
  761. while (++index < n) {
  762. result[index] = iteratee(index);
  763. }
  764. return result;
  765. }
  766. var argsTag$3 = "[object Arguments]";
  767. function baseIsArguments(value) {
  768. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  769. }
  770. var objectProto$9 = Object.prototype;
  771. var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
  772. var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
  773. var isArguments = baseIsArguments(function() {
  774. return arguments;
  775. }()) ? baseIsArguments : function(value) {
  776. return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  777. };
  778. var isArguments$1 = isArguments;
  779. function stubFalse() {
  780. return false;
  781. }
  782. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  783. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  784. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  785. var Buffer$1 = moduleExports$2 ? root$1.Buffer : void 0;
  786. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  787. var isBuffer = nativeIsBuffer || stubFalse;
  788. var isBuffer$1 = isBuffer;
  789. var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$3 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
  790. var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
  791. var typedArrayTags = {};
  792. typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
  793. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
  794. function baseIsTypedArray(value) {
  795. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  796. }
  797. function baseUnary(func) {
  798. return function(value) {
  799. return func(value);
  800. };
  801. }
  802. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  803. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  804. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  805. var freeProcess = moduleExports$1 && freeGlobal$1.process;
  806. var nodeUtil = function() {
  807. try {
  808. var types2 = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  809. if (types2) {
  810. return types2;
  811. }
  812. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  813. } catch (e) {
  814. }
  815. }();
  816. var nodeUtil$1 = nodeUtil;
  817. var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
  818. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  819. var isTypedArray$1 = isTypedArray;
  820. var objectProto$8 = Object.prototype;
  821. var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
  822. function arrayLikeKeys(value, inherited) {
  823. var isArr = isArray$2(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  824. for (var key in value) {
  825. if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  826. result.push(key);
  827. }
  828. }
  829. return result;
  830. }
  831. function overArg(func, transform) {
  832. return function(arg) {
  833. return func(transform(arg));
  834. };
  835. }
  836. var nativeKeys = overArg(Object.keys, Object);
  837. var nativeKeys$1 = nativeKeys;
  838. var objectProto$7 = Object.prototype;
  839. var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
  840. function baseKeys(object4) {
  841. if (!isPrototype(object4)) {
  842. return nativeKeys$1(object4);
  843. }
  844. var result = [];
  845. for (var key in Object(object4)) {
  846. if (hasOwnProperty$7.call(object4, key) && key != "constructor") {
  847. result.push(key);
  848. }
  849. }
  850. return result;
  851. }
  852. function keys(object4) {
  853. return isArrayLike(object4) ? arrayLikeKeys(object4) : baseKeys(object4);
  854. }
  855. function nativeKeysIn(object4) {
  856. var result = [];
  857. if (object4 != null) {
  858. for (var key in Object(object4)) {
  859. result.push(key);
  860. }
  861. }
  862. return result;
  863. }
  864. var objectProto$6 = Object.prototype;
  865. var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
  866. function baseKeysIn(object4) {
  867. if (!isObject$2(object4)) {
  868. return nativeKeysIn(object4);
  869. }
  870. var isProto = isPrototype(object4), result = [];
  871. for (var key in object4) {
  872. if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object4, key)))) {
  873. result.push(key);
  874. }
  875. }
  876. return result;
  877. }
  878. function keysIn(object4) {
  879. return isArrayLike(object4) ? arrayLikeKeys(object4, true) : baseKeysIn(object4);
  880. }
  881. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  882. function isKey(value, object4) {
  883. if (isArray$2(value)) {
  884. return false;
  885. }
  886. var type4 = typeof value;
  887. if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value == null || isSymbol(value)) {
  888. return true;
  889. }
  890. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object4 != null && value in Object(object4);
  891. }
  892. var nativeCreate = getNative(Object, "create");
  893. var nativeCreate$1 = nativeCreate;
  894. function hashClear() {
  895. this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  896. this.size = 0;
  897. }
  898. function hashDelete(key) {
  899. var result = this.has(key) && delete this.__data__[key];
  900. this.size -= result ? 1 : 0;
  901. return result;
  902. }
  903. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  904. var objectProto$5 = Object.prototype;
  905. var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
  906. function hashGet(key) {
  907. var data2 = this.__data__;
  908. if (nativeCreate$1) {
  909. var result = data2[key];
  910. return result === HASH_UNDEFINED$2 ? void 0 : result;
  911. }
  912. return hasOwnProperty$5.call(data2, key) ? data2[key] : void 0;
  913. }
  914. var objectProto$4 = Object.prototype;
  915. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  916. function hashHas(key) {
  917. var data2 = this.__data__;
  918. return nativeCreate$1 ? data2[key] !== void 0 : hasOwnProperty$4.call(data2, key);
  919. }
  920. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  921. function hashSet(key, value) {
  922. var data2 = this.__data__;
  923. this.size += this.has(key) ? 0 : 1;
  924. data2[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
  925. return this;
  926. }
  927. function Hash(entries) {
  928. var index = -1, length = entries == null ? 0 : entries.length;
  929. this.clear();
  930. while (++index < length) {
  931. var entry = entries[index];
  932. this.set(entry[0], entry[1]);
  933. }
  934. }
  935. Hash.prototype.clear = hashClear;
  936. Hash.prototype["delete"] = hashDelete;
  937. Hash.prototype.get = hashGet;
  938. Hash.prototype.has = hashHas;
  939. Hash.prototype.set = hashSet;
  940. function listCacheClear() {
  941. this.__data__ = [];
  942. this.size = 0;
  943. }
  944. function assocIndexOf(array4, key) {
  945. var length = array4.length;
  946. while (length--) {
  947. if (eq(array4[length][0], key)) {
  948. return length;
  949. }
  950. }
  951. return -1;
  952. }
  953. var arrayProto = Array.prototype;
  954. var splice = arrayProto.splice;
  955. function listCacheDelete(key) {
  956. var data2 = this.__data__, index = assocIndexOf(data2, key);
  957. if (index < 0) {
  958. return false;
  959. }
  960. var lastIndex = data2.length - 1;
  961. if (index == lastIndex) {
  962. data2.pop();
  963. } else {
  964. splice.call(data2, index, 1);
  965. }
  966. --this.size;
  967. return true;
  968. }
  969. function listCacheGet(key) {
  970. var data2 = this.__data__, index = assocIndexOf(data2, key);
  971. return index < 0 ? void 0 : data2[index][1];
  972. }
  973. function listCacheHas(key) {
  974. return assocIndexOf(this.__data__, key) > -1;
  975. }
  976. function listCacheSet(key, value) {
  977. var data2 = this.__data__, index = assocIndexOf(data2, key);
  978. if (index < 0) {
  979. ++this.size;
  980. data2.push([key, value]);
  981. } else {
  982. data2[index][1] = value;
  983. }
  984. return this;
  985. }
  986. function ListCache(entries) {
  987. var index = -1, length = entries == null ? 0 : entries.length;
  988. this.clear();
  989. while (++index < length) {
  990. var entry = entries[index];
  991. this.set(entry[0], entry[1]);
  992. }
  993. }
  994. ListCache.prototype.clear = listCacheClear;
  995. ListCache.prototype["delete"] = listCacheDelete;
  996. ListCache.prototype.get = listCacheGet;
  997. ListCache.prototype.has = listCacheHas;
  998. ListCache.prototype.set = listCacheSet;
  999. var Map$1 = getNative(root$1, "Map");
  1000. var Map$2 = Map$1;
  1001. function mapCacheClear() {
  1002. this.size = 0;
  1003. this.__data__ = {
  1004. "hash": new Hash(),
  1005. "map": new (Map$2 || ListCache)(),
  1006. "string": new Hash()
  1007. };
  1008. }
  1009. function isKeyable(value) {
  1010. var type4 = typeof value;
  1011. return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value !== "__proto__" : value === null;
  1012. }
  1013. function getMapData(map, key) {
  1014. var data2 = map.__data__;
  1015. return isKeyable(key) ? data2[typeof key == "string" ? "string" : "hash"] : data2.map;
  1016. }
  1017. function mapCacheDelete(key) {
  1018. var result = getMapData(this, key)["delete"](key);
  1019. this.size -= result ? 1 : 0;
  1020. return result;
  1021. }
  1022. function mapCacheGet(key) {
  1023. return getMapData(this, key).get(key);
  1024. }
  1025. function mapCacheHas(key) {
  1026. return getMapData(this, key).has(key);
  1027. }
  1028. function mapCacheSet(key, value) {
  1029. var data2 = getMapData(this, key), size = data2.size;
  1030. data2.set(key, value);
  1031. this.size += data2.size == size ? 0 : 1;
  1032. return this;
  1033. }
  1034. function MapCache(entries) {
  1035. var index = -1, length = entries == null ? 0 : entries.length;
  1036. this.clear();
  1037. while (++index < length) {
  1038. var entry = entries[index];
  1039. this.set(entry[0], entry[1]);
  1040. }
  1041. }
  1042. MapCache.prototype.clear = mapCacheClear;
  1043. MapCache.prototype["delete"] = mapCacheDelete;
  1044. MapCache.prototype.get = mapCacheGet;
  1045. MapCache.prototype.has = mapCacheHas;
  1046. MapCache.prototype.set = mapCacheSet;
  1047. var FUNC_ERROR_TEXT$2 = "Expected a function";
  1048. function memoize(func, resolver) {
  1049. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1050. throw new TypeError(FUNC_ERROR_TEXT$2);
  1051. }
  1052. var memoized = function() {
  1053. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache;
  1054. if (cache2.has(key)) {
  1055. return cache2.get(key);
  1056. }
  1057. var result = func.apply(this, args);
  1058. memoized.cache = cache2.set(key, result) || cache2;
  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 (cache2.size === MAX_MEMOIZE_SIZE) {
  1069. cache2.clear();
  1070. }
  1071. return key;
  1072. });
  1073. var cache2 = 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(cache2, key) {
  1485. return cache2.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$1(value, other) {
  1797. return baseIsEqual(value, other);
  1798. }
  1799. function isNil(value) {
  1800. return value == null;
  1801. }
  1802. function baseSet(object4, path, value, customizer) {
  1803. if (!isObject$2(object4)) {
  1804. return object4;
  1805. }
  1806. path = castPath(path, object4);
  1807. var index = -1, length = path.length, lastIndex = length - 1, nested = object4;
  1808. while (nested != null && ++index < length) {
  1809. var key = toKey(path[index]), newValue = value;
  1810. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  1811. return object4;
  1812. }
  1813. if (index != lastIndex) {
  1814. var objValue = nested[key];
  1815. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  1816. if (newValue === void 0) {
  1817. newValue = isObject$2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  1818. }
  1819. }
  1820. assignValue(nested, key, newValue);
  1821. nested = nested[key];
  1822. }
  1823. return object4;
  1824. }
  1825. function set(object4, path, value) {
  1826. return object4 == null ? object4 : baseSet(object4, path, value);
  1827. }
  1828. var FUNC_ERROR_TEXT = "Expected a function";
  1829. function throttle(func, wait, options) {
  1830. var leading = true, trailing = true;
  1831. if (typeof func != "function") {
  1832. throw new TypeError(FUNC_ERROR_TEXT);
  1833. }
  1834. if (isObject$2(options)) {
  1835. leading = "leading" in options ? !!options.leading : leading;
  1836. trailing = "trailing" in options ? !!options.trailing : trailing;
  1837. }
  1838. return debounce$1(func, wait, {
  1839. "leading": leading,
  1840. "maxWait": wait,
  1841. "trailing": trailing
  1842. });
  1843. }
  1844. var INFINITY = 1 / 0;
  1845. var createSet = !(Set$2 && 1 / setToArray(new Set$2([, -0]))[1] == INFINITY) ? noop$1 : function(values) {
  1846. return new Set$2(values);
  1847. };
  1848. var createSet$1 = createSet;
  1849. var LARGE_ARRAY_SIZE = 200;
  1850. function baseUniq(array4, iteratee, comparator) {
  1851. var index = -1, includes = arrayIncludes, length = array4.length, isCommon = true, result = [], seen = result;
  1852. if (comparator) {
  1853. isCommon = false;
  1854. includes = arrayIncludesWith;
  1855. } else if (length >= LARGE_ARRAY_SIZE) {
  1856. var set2 = iteratee ? null : createSet$1(array4);
  1857. if (set2) {
  1858. return setToArray(set2);
  1859. }
  1860. isCommon = false;
  1861. includes = cacheHas;
  1862. seen = new SetCache();
  1863. } else {
  1864. seen = iteratee ? [] : result;
  1865. }
  1866. outer:
  1867. while (++index < length) {
  1868. var value = array4[index], computed2 = iteratee ? iteratee(value) : value;
  1869. value = comparator || value !== 0 ? value : 0;
  1870. if (isCommon && computed2 === computed2) {
  1871. var seenIndex = seen.length;
  1872. while (seenIndex--) {
  1873. if (seen[seenIndex] === computed2) {
  1874. continue outer;
  1875. }
  1876. }
  1877. if (iteratee) {
  1878. seen.push(computed2);
  1879. }
  1880. result.push(value);
  1881. } else if (!includes(seen, computed2, comparator)) {
  1882. if (seen !== result) {
  1883. seen.push(computed2);
  1884. }
  1885. result.push(value);
  1886. }
  1887. }
  1888. return result;
  1889. }
  1890. var union = baseRest(function(arrays) {
  1891. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  1892. });
  1893. var union$1 = union;
  1894. const isLeaf = (el) => !el.getAttribute("aria-owns");
  1895. const getSibling = (el, distance, elClass) => {
  1896. const { parentNode } = el;
  1897. if (!parentNode)
  1898. return null;
  1899. const siblings = parentNode.querySelectorAll(elClass);
  1900. const index = Array.prototype.indexOf.call(siblings, el);
  1901. return siblings[index + distance] || null;
  1902. };
  1903. const focusNode = (el) => {
  1904. if (!el)
  1905. return;
  1906. el.focus();
  1907. !isLeaf(el) && el.click();
  1908. };
  1909. const on = (element, event, handler3, useCapture = false) => {
  1910. if (element && event && handler3) {
  1911. element == null ? void 0 : element.addEventListener(event, handler3, useCapture);
  1912. }
  1913. };
  1914. const off = (element, event, handler3, useCapture = false) => {
  1915. if (element && event && handler3) {
  1916. element == null ? void 0 : element.removeEventListener(event, handler3, useCapture);
  1917. }
  1918. };
  1919. const once = (el, event, fn2) => {
  1920. const listener = function(...args) {
  1921. if (fn2) {
  1922. fn2.apply(this, args);
  1923. }
  1924. off(el, event, listener);
  1925. };
  1926. on(el, event, listener);
  1927. };
  1928. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  1929. const handleEvent = (event) => {
  1930. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  1931. if (checkForDefaultPrevented === false || !shouldPrevent) {
  1932. return oursHandler == null ? void 0 : oursHandler(event);
  1933. }
  1934. };
  1935. return handleEvent;
  1936. };
  1937. function tryOnScopeDispose(fn2) {
  1938. if (getCurrentScope()) {
  1939. onScopeDispose(fn2);
  1940. return true;
  1941. }
  1942. return false;
  1943. }
  1944. const isClient = typeof window !== "undefined";
  1945. const isBoolean = (val) => typeof val === "boolean";
  1946. const isNumber = (val) => typeof val === "number";
  1947. const isString$1 = (val) => typeof val === "string";
  1948. const noop = () => {
  1949. };
  1950. function createFilterWrapper(filter, fn2) {
  1951. function wrapper(...args) {
  1952. filter(() => fn2.apply(this, args), { fn: fn2, thisArg: this, args });
  1953. }
  1954. return wrapper;
  1955. }
  1956. function debounceFilter(ms, options = {}) {
  1957. let timer;
  1958. let maxTimer;
  1959. const filter = (invoke) => {
  1960. const duration = unref(ms);
  1961. const maxDuration = unref(options.maxWait);
  1962. if (timer)
  1963. clearTimeout(timer);
  1964. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  1965. if (maxTimer) {
  1966. clearTimeout(maxTimer);
  1967. maxTimer = null;
  1968. }
  1969. return invoke();
  1970. }
  1971. if (maxDuration && !maxTimer) {
  1972. maxTimer = setTimeout(() => {
  1973. if (timer)
  1974. clearTimeout(timer);
  1975. maxTimer = null;
  1976. invoke();
  1977. }, maxDuration);
  1978. }
  1979. timer = setTimeout(() => {
  1980. if (maxTimer)
  1981. clearTimeout(maxTimer);
  1982. maxTimer = null;
  1983. invoke();
  1984. }, duration);
  1985. };
  1986. return filter;
  1987. }
  1988. function throttleFilter(ms, trailing = true, leading = true) {
  1989. let lastExec = 0;
  1990. let timer;
  1991. let preventLeading = !leading;
  1992. const clear = () => {
  1993. if (timer) {
  1994. clearTimeout(timer);
  1995. timer = void 0;
  1996. }
  1997. };
  1998. const filter = (invoke) => {
  1999. const duration = unref(ms);
  2000. const elapsed = Date.now() - lastExec;
  2001. clear();
  2002. if (duration <= 0) {
  2003. lastExec = Date.now();
  2004. return invoke();
  2005. }
  2006. if (elapsed > duration) {
  2007. lastExec = Date.now();
  2008. if (preventLeading)
  2009. preventLeading = false;
  2010. else
  2011. invoke();
  2012. }
  2013. if (trailing) {
  2014. timer = setTimeout(() => {
  2015. lastExec = Date.now();
  2016. if (!leading)
  2017. preventLeading = true;
  2018. clear();
  2019. invoke();
  2020. }, duration);
  2021. }
  2022. if (!leading && !timer)
  2023. timer = setTimeout(() => preventLeading = true, duration);
  2024. };
  2025. return filter;
  2026. }
  2027. function useDebounceFn(fn2, ms = 200, options = {}) {
  2028. return createFilterWrapper(debounceFilter(ms, options), fn2);
  2029. }
  2030. function refDebounced(value, ms = 200, options = {}) {
  2031. if (ms <= 0)
  2032. return value;
  2033. const debounced = ref(value.value);
  2034. const updater = useDebounceFn(() => {
  2035. debounced.value = value.value;
  2036. }, ms, options);
  2037. watch(value, () => updater());
  2038. return debounced;
  2039. }
  2040. function useThrottleFn(fn2, ms = 200, trailing = true, leading = true) {
  2041. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn2);
  2042. }
  2043. function useTimeoutFn(cb, interval, options = {}) {
  2044. const {
  2045. immediate = true
  2046. } = options;
  2047. const isPending = ref(false);
  2048. let timer = null;
  2049. function clear() {
  2050. if (timer) {
  2051. clearTimeout(timer);
  2052. timer = null;
  2053. }
  2054. }
  2055. function stop() {
  2056. isPending.value = false;
  2057. clear();
  2058. }
  2059. function start2(...args) {
  2060. clear();
  2061. isPending.value = true;
  2062. timer = setTimeout(() => {
  2063. isPending.value = false;
  2064. timer = null;
  2065. cb(...args);
  2066. }, unref(interval));
  2067. }
  2068. if (immediate) {
  2069. isPending.value = true;
  2070. if (isClient)
  2071. start2();
  2072. }
  2073. tryOnScopeDispose(stop);
  2074. return {
  2075. isPending,
  2076. start: start2,
  2077. stop
  2078. };
  2079. }
  2080. function unrefElement(elRef) {
  2081. var _a2;
  2082. const plain = unref(elRef);
  2083. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  2084. }
  2085. const defaultWindow = isClient ? window : void 0;
  2086. isClient ? window.document : void 0;
  2087. isClient ? window.navigator : void 0;
  2088. isClient ? window.location : void 0;
  2089. function useEventListener(...args) {
  2090. let target;
  2091. let event;
  2092. let listener;
  2093. let options;
  2094. if (isString$1(args[0])) {
  2095. [event, listener, options] = args;
  2096. target = defaultWindow;
  2097. } else {
  2098. [target, event, listener, options] = args;
  2099. }
  2100. if (!target)
  2101. return noop;
  2102. let cleanup = noop;
  2103. const stopWatch = watch(() => unrefElement(target), (el) => {
  2104. cleanup();
  2105. if (!el)
  2106. return;
  2107. el.addEventListener(event, listener, options);
  2108. cleanup = () => {
  2109. el.removeEventListener(event, listener, options);
  2110. cleanup = noop;
  2111. };
  2112. }, { immediate: true, flush: "post" });
  2113. const stop = () => {
  2114. stopWatch();
  2115. cleanup();
  2116. };
  2117. tryOnScopeDispose(stop);
  2118. return stop;
  2119. }
  2120. function onClickOutside(target, handler3, options = {}) {
  2121. const { window: window2 = defaultWindow, ignore, capture = true } = options;
  2122. if (!window2)
  2123. return;
  2124. const shouldListen = ref(true);
  2125. const listener = (event) => {
  2126. const el = unrefElement(target);
  2127. const composedPath = event.composedPath();
  2128. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  2129. return;
  2130. if (ignore && ignore.length > 0) {
  2131. if (ignore.some((target2) => {
  2132. const el2 = unrefElement(target2);
  2133. return el2 && (event.target === el2 || composedPath.includes(el2));
  2134. }))
  2135. return;
  2136. }
  2137. handler3(event);
  2138. };
  2139. const cleanup = [
  2140. useEventListener(window2, "click", listener, { passive: true, capture }),
  2141. useEventListener(window2, "pointerdown", (e) => {
  2142. const el = unrefElement(target);
  2143. shouldListen.value = !!el && !e.composedPath().includes(el);
  2144. }, { passive: true })
  2145. ];
  2146. const stop = () => cleanup.forEach((fn2) => fn2());
  2147. return stop;
  2148. }
  2149. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  2150. const globalKey = "__vueuse_ssr_handlers__";
  2151. _global[globalKey] = _global[globalKey] || {};
  2152. _global[globalKey];
  2153. var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
  2154. var __hasOwnProp$c = Object.prototype.hasOwnProperty;
  2155. var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
  2156. var __objRest$2 = (source, exclude) => {
  2157. var target = {};
  2158. for (var prop in source)
  2159. if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
  2160. target[prop] = source[prop];
  2161. if (source != null && __getOwnPropSymbols$c)
  2162. for (var prop of __getOwnPropSymbols$c(source)) {
  2163. if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
  2164. target[prop] = source[prop];
  2165. }
  2166. return target;
  2167. };
  2168. function useResizeObserver(target, callback, options = {}) {
  2169. const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  2170. let observer;
  2171. const isSupported = window2 && "ResizeObserver" in window2;
  2172. const cleanup = () => {
  2173. if (observer) {
  2174. observer.disconnect();
  2175. observer = void 0;
  2176. }
  2177. };
  2178. const stopWatch = watch(() => unrefElement(target), (el) => {
  2179. cleanup();
  2180. if (isSupported && window2 && el) {
  2181. observer = new ResizeObserver(callback);
  2182. observer.observe(el, observerOptions);
  2183. }
  2184. }, { immediate: true, flush: "post" });
  2185. const stop = () => {
  2186. cleanup();
  2187. stopWatch();
  2188. };
  2189. tryOnScopeDispose(stop);
  2190. return {
  2191. isSupported,
  2192. stop
  2193. };
  2194. }
  2195. var _a, _b;
  2196. isClient && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform);
  2197. function useVModel(props, key, emit, options = {}) {
  2198. var _a2;
  2199. const {
  2200. passive: passive2 = false,
  2201. eventName,
  2202. deep = false
  2203. } = options;
  2204. const vm = getCurrentInstance();
  2205. const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a2 = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a2.bind(vm));
  2206. let event = eventName;
  2207. if (!key) {
  2208. {
  2209. key = "modelValue";
  2210. }
  2211. }
  2212. event = eventName || event || `update:${key}`;
  2213. if (passive2) {
  2214. const proxy = ref(props[key]);
  2215. watch(() => props[key], (v2) => proxy.value = v2);
  2216. watch(proxy, (v2) => {
  2217. if (v2 !== props[key] || deep)
  2218. _emit(event, v2);
  2219. }, {
  2220. deep
  2221. });
  2222. return proxy;
  2223. } else {
  2224. return computed({
  2225. get() {
  2226. return props[key];
  2227. },
  2228. set(value) {
  2229. _emit(event, value);
  2230. }
  2231. });
  2232. }
  2233. }
  2234. const isInContainer = (el, container) => {
  2235. if (!isClient || !el || !container)
  2236. return false;
  2237. const elRect = el.getBoundingClientRect();
  2238. let containerRect;
  2239. if (container instanceof Element) {
  2240. containerRect = container.getBoundingClientRect();
  2241. } else {
  2242. containerRect = {
  2243. top: 0,
  2244. right: window.innerWidth,
  2245. bottom: window.innerHeight,
  2246. left: 0
  2247. };
  2248. }
  2249. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  2250. };
  2251. const resizeHandler = function(entries) {
  2252. for (const entry of entries) {
  2253. const listeners = entry.target.__resizeListeners__ || [];
  2254. if (listeners.length) {
  2255. listeners.forEach((fn2) => {
  2256. fn2();
  2257. });
  2258. }
  2259. }
  2260. };
  2261. const addResizeListener = function(element, fn2) {
  2262. if (!isClient || !element)
  2263. return;
  2264. if (!element.__resizeListeners__) {
  2265. element.__resizeListeners__ = [];
  2266. element.__ro__ = new ResizeObserver(resizeHandler);
  2267. element.__ro__.observe(element);
  2268. }
  2269. element.__resizeListeners__.push(fn2);
  2270. };
  2271. const removeResizeListener = function(element, fn2) {
  2272. var _a2;
  2273. if (!element || !element.__resizeListeners__)
  2274. return;
  2275. element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn2), 1);
  2276. if (!element.__resizeListeners__.length) {
  2277. (_a2 = element.__ro__) == null ? void 0 : _a2.disconnect();
  2278. }
  2279. };
  2280. const NOOP = () => {
  2281. };
  2282. const hasOwnProperty = Object.prototype.hasOwnProperty;
  2283. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  2284. const isArray = Array.isArray;
  2285. const isFunction = (val) => typeof val === "function";
  2286. const isString = (val) => typeof val === "string";
  2287. const isObject$1 = (val) => val !== null && typeof val === "object";
  2288. const isPromise = (val) => {
  2289. return isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
  2290. };
  2291. const objectToString = Object.prototype.toString;
  2292. const toTypeString = (value) => objectToString.call(value);
  2293. const toRawType = (value) => {
  2294. return toTypeString(value).slice(8, -1);
  2295. };
  2296. const cacheStringFunction = (fn2) => {
  2297. const cache2 = /* @__PURE__ */ Object.create(null);
  2298. return (str) => {
  2299. const hit = cache2[str];
  2300. return hit || (cache2[str] = fn2(str));
  2301. };
  2302. };
  2303. const camelizeRE = /-(\w)/g;
  2304. const camelize = cacheStringFunction((str) => {
  2305. return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : "");
  2306. });
  2307. const capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  2308. const isUndefined = (val) => val === void 0;
  2309. const isEmpty = (val) => !val && val !== 0 || isArray(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  2310. const isElement$1 = (e) => {
  2311. if (typeof Element === "undefined")
  2312. return false;
  2313. return e instanceof Element;
  2314. };
  2315. const escapeStringRegexp = (string3 = "") => string3.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  2316. const keysOf = (arr) => Object.keys(arr);
  2317. const entriesOf = (arr) => Object.entries(arr);
  2318. const getProp = (obj, path, defaultValue) => {
  2319. return {
  2320. get value() {
  2321. return get(obj, path, defaultValue);
  2322. },
  2323. set value(val) {
  2324. set(obj, path, val);
  2325. }
  2326. };
  2327. };
  2328. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  2329. const hasClass = (el, cls) => {
  2330. if (!el || !cls)
  2331. return false;
  2332. if (cls.includes(" "))
  2333. throw new Error("className should not contain space.");
  2334. return el.classList.contains(cls);
  2335. };
  2336. const addClass = (el, cls) => {
  2337. if (!el || !cls.trim())
  2338. return;
  2339. el.classList.add(...classNameToArray(cls));
  2340. };
  2341. const removeClass = (el, cls) => {
  2342. if (!el || !cls.trim())
  2343. return;
  2344. el.classList.remove(...classNameToArray(cls));
  2345. };
  2346. const getStyle = (element, styleName) => {
  2347. var _a2;
  2348. if (!isClient || !element || !styleName)
  2349. return "";
  2350. camelize(styleName);
  2351. try {
  2352. const style = element.style[styleName];
  2353. if (style)
  2354. return style;
  2355. const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
  2356. return computed2 ? computed2[styleName] : "";
  2357. } catch (e) {
  2358. return element.style[styleName];
  2359. }
  2360. };
  2361. const isScroll = (el, isVertical) => {
  2362. if (!isClient)
  2363. return false;
  2364. const key = {
  2365. undefined: "overflow",
  2366. true: "overflow-y",
  2367. false: "overflow-x"
  2368. }[String(isVertical)];
  2369. const overflow = getStyle(el, key);
  2370. return ["scroll", "auto", "overlay"].some((s2) => overflow.includes(s2));
  2371. };
  2372. const getScrollContainer = (el, isVertical) => {
  2373. if (!isClient)
  2374. return;
  2375. let parent = el;
  2376. while (parent) {
  2377. if ([window, document, document.documentElement].includes(parent))
  2378. return window;
  2379. if (isScroll(parent, isVertical))
  2380. return parent;
  2381. parent = parent.parentNode;
  2382. }
  2383. return parent;
  2384. };
  2385. let scrollBarWidth;
  2386. const getScrollBarWidth = () => {
  2387. var _a2;
  2388. if (!isClient)
  2389. return 0;
  2390. if (scrollBarWidth !== void 0)
  2391. return scrollBarWidth;
  2392. const outer = document.createElement("div");
  2393. outer.className = "el-scrollbar__wrap";
  2394. outer.style.visibility = "hidden";
  2395. outer.style.width = "100px";
  2396. outer.style.position = "absolute";
  2397. outer.style.top = "-9999px";
  2398. document.body.appendChild(outer);
  2399. const widthNoScroll = outer.offsetWidth;
  2400. outer.style.overflow = "scroll";
  2401. const inner = document.createElement("div");
  2402. inner.style.width = "100%";
  2403. outer.appendChild(inner);
  2404. const widthWithScroll = inner.offsetWidth;
  2405. (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
  2406. scrollBarWidth = widthNoScroll - widthWithScroll;
  2407. return scrollBarWidth;
  2408. };
  2409. function scrollIntoView(container, selected) {
  2410. if (!isClient)
  2411. return;
  2412. if (!selected) {
  2413. container.scrollTop = 0;
  2414. return;
  2415. }
  2416. const offsetParents = [];
  2417. let pointer = selected.offsetParent;
  2418. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  2419. offsetParents.push(pointer);
  2420. pointer = pointer.offsetParent;
  2421. }
  2422. const top2 = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  2423. const bottom2 = top2 + selected.offsetHeight;
  2424. const viewRectTop = container.scrollTop;
  2425. const viewRectBottom = viewRectTop + container.clientHeight;
  2426. if (top2 < viewRectTop) {
  2427. container.scrollTop = top2;
  2428. } else if (bottom2 > viewRectBottom) {
  2429. container.scrollTop = bottom2 - container.clientHeight;
  2430. }
  2431. }
  2432. var _export_sfc$2 = (sfc, props) => {
  2433. const target = sfc.__vccOpts || sfc;
  2434. for (const [key, val] of props) {
  2435. target[key] = val;
  2436. }
  2437. return target;
  2438. };
  2439. const _sfc_main$1C = defineComponent({
  2440. name: "ArrowDown"
  2441. });
  2442. const _hoisted_1$15 = {
  2443. viewBox: "0 0 1024 1024",
  2444. xmlns: "http://www.w3.org/2000/svg"
  2445. };
  2446. const _hoisted_2$X = /* @__PURE__ */ createElementVNode("path", {
  2447. fill: "currentColor",
  2448. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  2449. }, null, -1);
  2450. const _hoisted_3$K = [
  2451. _hoisted_2$X
  2452. ];
  2453. function _sfc_render$16(_ctx, _cache, $props, $setup, $data, $options) {
  2454. return openBlock(), createElementBlock("svg", _hoisted_1$15, _hoisted_3$K);
  2455. }
  2456. var arrowDown = /* @__PURE__ */ _export_sfc$2(_sfc_main$1C, [["render", _sfc_render$16]]);
  2457. const _sfc_main$1B = defineComponent({
  2458. name: "ArrowLeft"
  2459. });
  2460. const _hoisted_1$14 = {
  2461. viewBox: "0 0 1024 1024",
  2462. xmlns: "http://www.w3.org/2000/svg"
  2463. };
  2464. const _hoisted_2$W = /* @__PURE__ */ createElementVNode("path", {
  2465. fill: "currentColor",
  2466. d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
  2467. }, null, -1);
  2468. const _hoisted_3$J = [
  2469. _hoisted_2$W
  2470. ];
  2471. function _sfc_render$15(_ctx, _cache, $props, $setup, $data, $options) {
  2472. return openBlock(), createElementBlock("svg", _hoisted_1$14, _hoisted_3$J);
  2473. }
  2474. var arrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1B, [["render", _sfc_render$15]]);
  2475. const _sfc_main$1A = defineComponent({
  2476. name: "ArrowRight"
  2477. });
  2478. const _hoisted_1$13 = {
  2479. viewBox: "0 0 1024 1024",
  2480. xmlns: "http://www.w3.org/2000/svg"
  2481. };
  2482. const _hoisted_2$V = /* @__PURE__ */ createElementVNode("path", {
  2483. fill: "currentColor",
  2484. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  2485. }, null, -1);
  2486. const _hoisted_3$I = [
  2487. _hoisted_2$V
  2488. ];
  2489. function _sfc_render$14(_ctx, _cache, $props, $setup, $data, $options) {
  2490. return openBlock(), createElementBlock("svg", _hoisted_1$13, _hoisted_3$I);
  2491. }
  2492. var arrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1A, [["render", _sfc_render$14]]);
  2493. const _sfc_main$1z = defineComponent({
  2494. name: "ArrowUp"
  2495. });
  2496. const _hoisted_1$12 = {
  2497. viewBox: "0 0 1024 1024",
  2498. xmlns: "http://www.w3.org/2000/svg"
  2499. };
  2500. const _hoisted_2$U = /* @__PURE__ */ createElementVNode("path", {
  2501. fill: "currentColor",
  2502. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0z"
  2503. }, null, -1);
  2504. const _hoisted_3$H = [
  2505. _hoisted_2$U
  2506. ];
  2507. function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
  2508. return openBlock(), createElementBlock("svg", _hoisted_1$12, _hoisted_3$H);
  2509. }
  2510. var arrowUp = /* @__PURE__ */ _export_sfc$2(_sfc_main$1z, [["render", _sfc_render$13]]);
  2511. const _sfc_main$1y = defineComponent({
  2512. name: "Calendar"
  2513. });
  2514. const _hoisted_1$11 = {
  2515. viewBox: "0 0 1024 1024",
  2516. xmlns: "http://www.w3.org/2000/svg"
  2517. };
  2518. const _hoisted_2$T = /* @__PURE__ */ createElementVNode("path", {
  2519. fill: "currentColor",
  2520. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64H128zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0v32zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64z"
  2521. }, null, -1);
  2522. const _hoisted_3$G = [
  2523. _hoisted_2$T
  2524. ];
  2525. function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
  2526. return openBlock(), createElementBlock("svg", _hoisted_1$11, _hoisted_3$G);
  2527. }
  2528. var calendar = /* @__PURE__ */ _export_sfc$2(_sfc_main$1y, [["render", _sfc_render$12]]);
  2529. const _sfc_main$1x = defineComponent({
  2530. name: "Check"
  2531. });
  2532. const _hoisted_1$10 = {
  2533. viewBox: "0 0 1024 1024",
  2534. xmlns: "http://www.w3.org/2000/svg"
  2535. };
  2536. const _hoisted_2$S = /* @__PURE__ */ createElementVNode("path", {
  2537. fill: "currentColor",
  2538. d: "M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"
  2539. }, null, -1);
  2540. const _hoisted_3$F = [
  2541. _hoisted_2$S
  2542. ];
  2543. function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
  2544. return openBlock(), createElementBlock("svg", _hoisted_1$10, _hoisted_3$F);
  2545. }
  2546. var check = /* @__PURE__ */ _export_sfc$2(_sfc_main$1x, [["render", _sfc_render$11]]);
  2547. const _sfc_main$1w = defineComponent({
  2548. name: "CircleCheck"
  2549. });
  2550. const _hoisted_1$$ = {
  2551. viewBox: "0 0 1024 1024",
  2552. xmlns: "http://www.w3.org/2000/svg"
  2553. };
  2554. const _hoisted_2$R = /* @__PURE__ */ createElementVNode("path", {
  2555. fill: "currentColor",
  2556. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2557. }, null, -1);
  2558. const _hoisted_3$E = /* @__PURE__ */ createElementVNode("path", {
  2559. fill: "currentColor",
  2560. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
  2561. }, null, -1);
  2562. const _hoisted_4$j = [
  2563. _hoisted_2$R,
  2564. _hoisted_3$E
  2565. ];
  2566. function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
  2567. return openBlock(), createElementBlock("svg", _hoisted_1$$, _hoisted_4$j);
  2568. }
  2569. var circleCheck = /* @__PURE__ */ _export_sfc$2(_sfc_main$1w, [["render", _sfc_render$10]]);
  2570. const _sfc_main$1v = defineComponent({
  2571. name: "CircleClose"
  2572. });
  2573. const _hoisted_1$_ = {
  2574. viewBox: "0 0 1024 1024",
  2575. xmlns: "http://www.w3.org/2000/svg"
  2576. };
  2577. const _hoisted_2$Q = /* @__PURE__ */ createElementVNode("path", {
  2578. fill: "currentColor",
  2579. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"
  2580. }, null, -1);
  2581. const _hoisted_3$D = /* @__PURE__ */ createElementVNode("path", {
  2582. fill: "currentColor",
  2583. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2584. }, null, -1);
  2585. const _hoisted_4$i = [
  2586. _hoisted_2$Q,
  2587. _hoisted_3$D
  2588. ];
  2589. function _sfc_render$$(_ctx, _cache, $props, $setup, $data, $options) {
  2590. return openBlock(), createElementBlock("svg", _hoisted_1$_, _hoisted_4$i);
  2591. }
  2592. var circleClose = /* @__PURE__ */ _export_sfc$2(_sfc_main$1v, [["render", _sfc_render$$]]);
  2593. const _sfc_main$1u = defineComponent({
  2594. name: "Clock"
  2595. });
  2596. const _hoisted_1$Z = {
  2597. viewBox: "0 0 1024 1024",
  2598. xmlns: "http://www.w3.org/2000/svg"
  2599. };
  2600. const _hoisted_2$P = /* @__PURE__ */ createElementVNode("path", {
  2601. fill: "currentColor",
  2602. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  2603. }, null, -1);
  2604. const _hoisted_3$C = /* @__PURE__ */ createElementVNode("path", {
  2605. fill: "currentColor",
  2606. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
  2607. }, null, -1);
  2608. const _hoisted_4$h = /* @__PURE__ */ createElementVNode("path", {
  2609. fill: "currentColor",
  2610. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z"
  2611. }, null, -1);
  2612. const _hoisted_5$e = [
  2613. _hoisted_2$P,
  2614. _hoisted_3$C,
  2615. _hoisted_4$h
  2616. ];
  2617. function _sfc_render$_(_ctx, _cache, $props, $setup, $data, $options) {
  2618. return openBlock(), createElementBlock("svg", _hoisted_1$Z, _hoisted_5$e);
  2619. }
  2620. var clock = /* @__PURE__ */ _export_sfc$2(_sfc_main$1u, [["render", _sfc_render$_]]);
  2621. const _sfc_main$1t = defineComponent({
  2622. name: "Close"
  2623. });
  2624. const _hoisted_1$Y = {
  2625. viewBox: "0 0 1024 1024",
  2626. xmlns: "http://www.w3.org/2000/svg"
  2627. };
  2628. const _hoisted_2$O = /* @__PURE__ */ createElementVNode("path", {
  2629. fill: "currentColor",
  2630. d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
  2631. }, null, -1);
  2632. const _hoisted_3$B = [
  2633. _hoisted_2$O
  2634. ];
  2635. function _sfc_render$Z(_ctx, _cache, $props, $setup, $data, $options) {
  2636. return openBlock(), createElementBlock("svg", _hoisted_1$Y, _hoisted_3$B);
  2637. }
  2638. var close = /* @__PURE__ */ _export_sfc$2(_sfc_main$1t, [["render", _sfc_render$Z]]);
  2639. const _sfc_main$1s = defineComponent({
  2640. name: "DArrowLeft"
  2641. });
  2642. const _hoisted_1$X = {
  2643. viewBox: "0 0 1024 1024",
  2644. xmlns: "http://www.w3.org/2000/svg"
  2645. };
  2646. const _hoisted_2$N = /* @__PURE__ */ createElementVNode("path", {
  2647. fill: "currentColor",
  2648. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z"
  2649. }, null, -1);
  2650. const _hoisted_3$A = [
  2651. _hoisted_2$N
  2652. ];
  2653. function _sfc_render$Y(_ctx, _cache, $props, $setup, $data, $options) {
  2654. return openBlock(), createElementBlock("svg", _hoisted_1$X, _hoisted_3$A);
  2655. }
  2656. var dArrowLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1s, [["render", _sfc_render$Y]]);
  2657. const _sfc_main$1r = defineComponent({
  2658. name: "DArrowRight"
  2659. });
  2660. const _hoisted_1$W = {
  2661. viewBox: "0 0 1024 1024",
  2662. xmlns: "http://www.w3.org/2000/svg"
  2663. };
  2664. const _hoisted_2$M = /* @__PURE__ */ createElementVNode("path", {
  2665. fill: "currentColor",
  2666. d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688zm-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"
  2667. }, null, -1);
  2668. const _hoisted_3$z = [
  2669. _hoisted_2$M
  2670. ];
  2671. function _sfc_render$X(_ctx, _cache, $props, $setup, $data, $options) {
  2672. return openBlock(), createElementBlock("svg", _hoisted_1$W, _hoisted_3$z);
  2673. }
  2674. var dArrowRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1r, [["render", _sfc_render$X]]);
  2675. const _sfc_main$1q = defineComponent({
  2676. name: "Delete"
  2677. });
  2678. const _hoisted_1$V = {
  2679. viewBox: "0 0 1024 1024",
  2680. xmlns: "http://www.w3.org/2000/svg"
  2681. };
  2682. const _hoisted_2$L = /* @__PURE__ */ createElementVNode("path", {
  2683. fill: "currentColor",
  2684. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
  2685. }, null, -1);
  2686. const _hoisted_3$y = [
  2687. _hoisted_2$L
  2688. ];
  2689. function _sfc_render$W(_ctx, _cache, $props, $setup, $data, $options) {
  2690. return openBlock(), createElementBlock("svg", _hoisted_1$V, _hoisted_3$y);
  2691. }
  2692. var _delete = /* @__PURE__ */ _export_sfc$2(_sfc_main$1q, [["render", _sfc_render$W]]);
  2693. const _sfc_main$1p = defineComponent({
  2694. name: "Document"
  2695. });
  2696. const _hoisted_1$U = {
  2697. viewBox: "0 0 1024 1024",
  2698. xmlns: "http://www.w3.org/2000/svg"
  2699. };
  2700. const _hoisted_2$K = /* @__PURE__ */ createElementVNode("path", {
  2701. fill: "currentColor",
  2702. d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
  2703. }, null, -1);
  2704. const _hoisted_3$x = [
  2705. _hoisted_2$K
  2706. ];
  2707. function _sfc_render$V(_ctx, _cache, $props, $setup, $data, $options) {
  2708. return openBlock(), createElementBlock("svg", _hoisted_1$U, _hoisted_3$x);
  2709. }
  2710. var document$1 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1p, [["render", _sfc_render$V]]);
  2711. const _sfc_main$1o = defineComponent({
  2712. name: "FullScreen"
  2713. });
  2714. const _hoisted_1$T = {
  2715. viewBox: "0 0 1024 1024",
  2716. xmlns: "http://www.w3.org/2000/svg"
  2717. };
  2718. const _hoisted_2$J = /* @__PURE__ */ createElementVNode("path", {
  2719. fill: "currentColor",
  2720. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64v.064zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64l-192 .192zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64v-.064z"
  2721. }, null, -1);
  2722. const _hoisted_3$w = [
  2723. _hoisted_2$J
  2724. ];
  2725. function _sfc_render$U(_ctx, _cache, $props, $setup, $data, $options) {
  2726. return openBlock(), createElementBlock("svg", _hoisted_1$T, _hoisted_3$w);
  2727. }
  2728. var fullScreen = /* @__PURE__ */ _export_sfc$2(_sfc_main$1o, [["render", _sfc_render$U]]);
  2729. const _sfc_main$1n = defineComponent({
  2730. name: "Hide"
  2731. });
  2732. const _hoisted_1$S = {
  2733. viewBox: "0 0 1024 1024",
  2734. xmlns: "http://www.w3.org/2000/svg"
  2735. };
  2736. const _hoisted_2$I = /* @__PURE__ */ createElementVNode("path", {
  2737. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z",
  2738. fill: "currentColor"
  2739. }, null, -1);
  2740. const _hoisted_3$v = /* @__PURE__ */ createElementVNode("path", {
  2741. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z",
  2742. fill: "currentColor"
  2743. }, null, -1);
  2744. const _hoisted_4$g = [
  2745. _hoisted_2$I,
  2746. _hoisted_3$v
  2747. ];
  2748. function _sfc_render$T(_ctx, _cache, $props, $setup, $data, $options) {
  2749. return openBlock(), createElementBlock("svg", _hoisted_1$S, _hoisted_4$g);
  2750. }
  2751. var hide$2 = /* @__PURE__ */ _export_sfc$2(_sfc_main$1n, [["render", _sfc_render$T]]);
  2752. const _sfc_main$1m = defineComponent({
  2753. name: "Loading"
  2754. });
  2755. const _hoisted_1$R = {
  2756. viewBox: "0 0 1024 1024",
  2757. xmlns: "http://www.w3.org/2000/svg"
  2758. };
  2759. const _hoisted_2$H = /* @__PURE__ */ createElementVNode("path", {
  2760. fill: "currentColor",
  2761. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  2762. }, null, -1);
  2763. const _hoisted_3$u = [
  2764. _hoisted_2$H
  2765. ];
  2766. function _sfc_render$S(_ctx, _cache, $props, $setup, $data, $options) {
  2767. return openBlock(), createElementBlock("svg", _hoisted_1$R, _hoisted_3$u);
  2768. }
  2769. var loading = /* @__PURE__ */ _export_sfc$2(_sfc_main$1m, [["render", _sfc_render$S]]);
  2770. const _sfc_main$1l = defineComponent({
  2771. name: "Minus"
  2772. });
  2773. const _hoisted_1$Q = {
  2774. viewBox: "0 0 1024 1024",
  2775. xmlns: "http://www.w3.org/2000/svg"
  2776. };
  2777. const _hoisted_2$G = /* @__PURE__ */ createElementVNode("path", {
  2778. fill: "currentColor",
  2779. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  2780. }, null, -1);
  2781. const _hoisted_3$t = [
  2782. _hoisted_2$G
  2783. ];
  2784. function _sfc_render$R(_ctx, _cache, $props, $setup, $data, $options) {
  2785. return openBlock(), createElementBlock("svg", _hoisted_1$Q, _hoisted_3$t);
  2786. }
  2787. var minus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1l, [["render", _sfc_render$R]]);
  2788. const _sfc_main$1k = defineComponent({
  2789. name: "Plus"
  2790. });
  2791. const _hoisted_1$P = {
  2792. viewBox: "0 0 1024 1024",
  2793. xmlns: "http://www.w3.org/2000/svg"
  2794. };
  2795. const _hoisted_2$F = /* @__PURE__ */ createElementVNode("path", {
  2796. fill: "currentColor",
  2797. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"
  2798. }, null, -1);
  2799. const _hoisted_3$s = [
  2800. _hoisted_2$F
  2801. ];
  2802. function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
  2803. return openBlock(), createElementBlock("svg", _hoisted_1$P, _hoisted_3$s);
  2804. }
  2805. var plus = /* @__PURE__ */ _export_sfc$2(_sfc_main$1k, [["render", _sfc_render$Q]]);
  2806. const _sfc_main$1j = defineComponent({
  2807. name: "RefreshLeft"
  2808. });
  2809. const _hoisted_1$O = {
  2810. viewBox: "0 0 1024 1024",
  2811. xmlns: "http://www.w3.org/2000/svg"
  2812. };
  2813. const _hoisted_2$E = /* @__PURE__ */ createElementVNode("path", {
  2814. fill: "currentColor",
  2815. d: "M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"
  2816. }, null, -1);
  2817. const _hoisted_3$r = [
  2818. _hoisted_2$E
  2819. ];
  2820. function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
  2821. return openBlock(), createElementBlock("svg", _hoisted_1$O, _hoisted_3$r);
  2822. }
  2823. var refreshLeft = /* @__PURE__ */ _export_sfc$2(_sfc_main$1j, [["render", _sfc_render$P]]);
  2824. const _sfc_main$1i = defineComponent({
  2825. name: "RefreshRight"
  2826. });
  2827. const _hoisted_1$N = {
  2828. viewBox: "0 0 1024 1024",
  2829. xmlns: "http://www.w3.org/2000/svg"
  2830. };
  2831. const _hoisted_2$D = /* @__PURE__ */ createElementVNode("path", {
  2832. fill: "currentColor",
  2833. d: "M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"
  2834. }, null, -1);
  2835. const _hoisted_3$q = [
  2836. _hoisted_2$D
  2837. ];
  2838. function _sfc_render$O(_ctx, _cache, $props, $setup, $data, $options) {
  2839. return openBlock(), createElementBlock("svg", _hoisted_1$N, _hoisted_3$q);
  2840. }
  2841. var refreshRight = /* @__PURE__ */ _export_sfc$2(_sfc_main$1i, [["render", _sfc_render$O]]);
  2842. const _sfc_main$1h = defineComponent({
  2843. name: "ScaleToOriginal"
  2844. });
  2845. const _hoisted_1$M = {
  2846. viewBox: "0 0 1024 1024",
  2847. xmlns: "http://www.w3.org/2000/svg"
  2848. };
  2849. const _hoisted_2$C = /* @__PURE__ */ createElementVNode("path", {
  2850. fill: "currentColor",
  2851. d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zm-361.412 0a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zM512 361.412a30.118 30.118 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.118 30.118 0 0 0 512 361.412zM512 512a30.118 30.118 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.118 30.118 0 0 0 512 512z"
  2852. }, null, -1);
  2853. const _hoisted_3$p = [
  2854. _hoisted_2$C
  2855. ];
  2856. function _sfc_render$N(_ctx, _cache, $props, $setup, $data, $options) {
  2857. return openBlock(), createElementBlock("svg", _hoisted_1$M, _hoisted_3$p);
  2858. }
  2859. var scaleToOriginal = /* @__PURE__ */ _export_sfc$2(_sfc_main$1h, [["render", _sfc_render$N]]);
  2860. const _sfc_main$1g = defineComponent({
  2861. name: "StarFilled"
  2862. });
  2863. const _hoisted_1$L = {
  2864. viewBox: "0 0 1024 1024",
  2865. xmlns: "http://www.w3.org/2000/svg"
  2866. };
  2867. const _hoisted_2$B = /* @__PURE__ */ createElementVNode("path", {
  2868. fill: "currentColor",
  2869. d: "M283.84 867.84 512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"
  2870. }, null, -1);
  2871. const _hoisted_3$o = [
  2872. _hoisted_2$B
  2873. ];
  2874. function _sfc_render$M(_ctx, _cache, $props, $setup, $data, $options) {
  2875. return openBlock(), createElementBlock("svg", _hoisted_1$L, _hoisted_3$o);
  2876. }
  2877. var starFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$1g, [["render", _sfc_render$M]]);
  2878. const _sfc_main$1f = defineComponent({
  2879. name: "Star"
  2880. });
  2881. const _hoisted_1$K = {
  2882. viewBox: "0 0 1024 1024",
  2883. xmlns: "http://www.w3.org/2000/svg"
  2884. };
  2885. const _hoisted_2$A = /* @__PURE__ */ createElementVNode("path", {
  2886. fill: "currentColor",
  2887. d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72L512 747.84zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  2888. }, null, -1);
  2889. const _hoisted_3$n = [
  2890. _hoisted_2$A
  2891. ];
  2892. function _sfc_render$L(_ctx, _cache, $props, $setup, $data, $options) {
  2893. return openBlock(), createElementBlock("svg", _hoisted_1$K, _hoisted_3$n);
  2894. }
  2895. var star = /* @__PURE__ */ _export_sfc$2(_sfc_main$1f, [["render", _sfc_render$L]]);
  2896. const _sfc_main$1e = defineComponent({
  2897. name: "View"
  2898. });
  2899. const _hoisted_1$J = {
  2900. viewBox: "0 0 1024 1024",
  2901. xmlns: "http://www.w3.org/2000/svg"
  2902. };
  2903. const _hoisted_2$z = /* @__PURE__ */ createElementVNode("path", {
  2904. fill: "currentColor",
  2905. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
  2906. }, null, -1);
  2907. const _hoisted_3$m = [
  2908. _hoisted_2$z
  2909. ];
  2910. function _sfc_render$K(_ctx, _cache, $props, $setup, $data, $options) {
  2911. return openBlock(), createElementBlock("svg", _hoisted_1$J, _hoisted_3$m);
  2912. }
  2913. var view = /* @__PURE__ */ _export_sfc$2(_sfc_main$1e, [["render", _sfc_render$K]]);
  2914. const _sfc_main$1d = defineComponent({
  2915. name: "WarningFilled"
  2916. });
  2917. const _hoisted_1$I = {
  2918. viewBox: "0 0 1024 1024",
  2919. xmlns: "http://www.w3.org/2000/svg"
  2920. };
  2921. const _hoisted_2$y = /* @__PURE__ */ createElementVNode("path", {
  2922. fill: "currentColor",
  2923. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"
  2924. }, null, -1);
  2925. const _hoisted_3$l = [
  2926. _hoisted_2$y
  2927. ];
  2928. function _sfc_render$J(_ctx, _cache, $props, $setup, $data, $options) {
  2929. return openBlock(), createElementBlock("svg", _hoisted_1$I, _hoisted_3$l);
  2930. }
  2931. var warningFilled = /* @__PURE__ */ _export_sfc$2(_sfc_main$1d, [["render", _sfc_render$J]]);
  2932. const _sfc_main$1c = defineComponent({
  2933. name: "ZoomIn"
  2934. });
  2935. const _hoisted_1$H = {
  2936. viewBox: "0 0 1024 1024",
  2937. xmlns: "http://www.w3.org/2000/svg"
  2938. };
  2939. const _hoisted_2$x = /* @__PURE__ */ createElementVNode("path", {
  2940. fill: "currentColor",
  2941. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zm-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96z"
  2942. }, null, -1);
  2943. const _hoisted_3$k = [
  2944. _hoisted_2$x
  2945. ];
  2946. function _sfc_render$I(_ctx, _cache, $props, $setup, $data, $options) {
  2947. return openBlock(), createElementBlock("svg", _hoisted_1$H, _hoisted_3$k);
  2948. }
  2949. var zoomIn = /* @__PURE__ */ _export_sfc$2(_sfc_main$1c, [["render", _sfc_render$I]]);
  2950. const _sfc_main$1b = defineComponent({
  2951. name: "ZoomOut"
  2952. });
  2953. const _hoisted_1$G = {
  2954. viewBox: "0 0 1024 1024",
  2955. xmlns: "http://www.w3.org/2000/svg"
  2956. };
  2957. const _hoisted_2$w = /* @__PURE__ */ createElementVNode("path", {
  2958. fill: "currentColor",
  2959. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zM352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"
  2960. }, null, -1);
  2961. const _hoisted_3$j = [
  2962. _hoisted_2$w
  2963. ];
  2964. function _sfc_render$H(_ctx, _cache, $props, $setup, $data, $options) {
  2965. return openBlock(), createElementBlock("svg", _hoisted_1$G, _hoisted_3$j);
  2966. }
  2967. var zoomOut = /* @__PURE__ */ _export_sfc$2(_sfc_main$1b, [["render", _sfc_render$H]]);
  2968. const wrapperKey = Symbol();
  2969. const propKey = "__elPropsReservedKey";
  2970. function buildProp(option, key) {
  2971. if (!isObject$1(option) || !!option[propKey])
  2972. return option;
  2973. const { values, required: required4, default: defaultValue, type: type4, validator } = option;
  2974. const _validator = values || validator ? (val) => {
  2975. let valid = false;
  2976. let allowedValues = [];
  2977. if (values) {
  2978. allowedValues = Array.from(values);
  2979. if (hasOwn(option, "default")) {
  2980. allowedValues.push(defaultValue);
  2981. }
  2982. valid || (valid = allowedValues.includes(val));
  2983. }
  2984. if (validator)
  2985. valid || (valid = validator(val));
  2986. if (!valid && allowedValues.length > 0) {
  2987. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  2988. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  2989. }
  2990. return valid;
  2991. } : void 0;
  2992. const prop = {
  2993. type: isObject$1(type4) && Object.getOwnPropertySymbols(type4).includes(wrapperKey) ? type4[wrapperKey] : type4,
  2994. required: !!required4,
  2995. validator: _validator,
  2996. [propKey]: true
  2997. };
  2998. if (hasOwn(option, "default"))
  2999. prop.default = defaultValue;
  3000. return prop;
  3001. }
  3002. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  3003. key,
  3004. buildProp(option, key)
  3005. ]));
  3006. const definePropType = (val) => ({ [wrapperKey]: val });
  3007. const iconPropType = definePropType([
  3008. String,
  3009. Object,
  3010. Function
  3011. ]);
  3012. const CloseComponents = {
  3013. Close: close
  3014. };
  3015. const ValidateComponentsMap = {
  3016. validating: loading,
  3017. success: circleCheck,
  3018. error: circleClose
  3019. };
  3020. const withInstall = (main2, extra) => {
  3021. main2.install = (app) => {
  3022. for (const comp of [main2, ...Object.values(extra != null ? extra : {})]) {
  3023. app.component(comp.name, comp);
  3024. }
  3025. };
  3026. if (extra) {
  3027. for (const [key, comp] of Object.entries(extra)) {
  3028. main2[key] = comp;
  3029. }
  3030. }
  3031. return main2;
  3032. };
  3033. const withNoopInstall = (component) => {
  3034. component.install = NOOP;
  3035. return component;
  3036. };
  3037. class ElementPlusError extends Error {
  3038. constructor(m2) {
  3039. super(m2);
  3040. this.name = "ElementPlusError";
  3041. }
  3042. }
  3043. function throwError(scope, m2) {
  3044. throw new ElementPlusError(`[${scope}] ${m2}`);
  3045. }
  3046. function debugWarn(scope, message) {
  3047. }
  3048. function addUnit(value, defaultUnit = "px") {
  3049. if (!value)
  3050. return "";
  3051. if (isString(value)) {
  3052. return value;
  3053. } else if (isNumber(value)) {
  3054. return `${value}${defaultUnit}`;
  3055. }
  3056. }
  3057. const EVENT_CODE = {
  3058. tab: "Tab",
  3059. enter: "Enter",
  3060. space: "Space",
  3061. left: "ArrowLeft",
  3062. up: "ArrowUp",
  3063. right: "ArrowRight",
  3064. down: "ArrowDown",
  3065. esc: "Escape",
  3066. delete: "Delete",
  3067. backspace: "Backspace",
  3068. numpadEnter: "NumpadEnter",
  3069. pageUp: "PageUp",
  3070. pageDown: "PageDown",
  3071. home: "Home",
  3072. end: "End"
  3073. };
  3074. const datePickTypes = [
  3075. "year",
  3076. "month",
  3077. "date",
  3078. "dates",
  3079. "week",
  3080. "datetime",
  3081. "datetimerange",
  3082. "daterange",
  3083. "monthrange"
  3084. ];
  3085. const UPDATE_MODEL_EVENT = "update:modelValue";
  3086. const CHANGE_EVENT = "change";
  3087. const INPUT_EVENT = "input";
  3088. const componentSizes = ["", "default", "small", "large"];
  3089. const componentSizeMap = {
  3090. large: 40,
  3091. default: 32,
  3092. small: 24
  3093. };
  3094. const getComponentSize = (size = "default") => {
  3095. return componentSizeMap[size || "default"];
  3096. };
  3097. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  3098. const isValidDatePickType = (val) => [...datePickTypes].includes(val);
  3099. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  3100. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  3101. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  3102. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  3103. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  3104. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  3105. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  3106. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  3107. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  3108. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  3109. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  3110. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  3111. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  3112. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  3113. return PatchFlags2;
  3114. })(PatchFlags || {});
  3115. function isFragment(node) {
  3116. return isVNode(node) && node.type === Fragment;
  3117. }
  3118. function isComment(node) {
  3119. return isVNode(node) && node.type === Comment;
  3120. }
  3121. function isValidElementNode(node) {
  3122. return isVNode(node) && !isFragment(node) && !isComment(node);
  3123. }
  3124. const unique = (arr) => [...new Set(arr)];
  3125. const castArray = (arr) => {
  3126. if (!arr && arr !== 0)
  3127. return [];
  3128. return Array.isArray(arr) ? arr : [arr];
  3129. };
  3130. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  3131. const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
  3132. const rAF = (fn2) => isClient ? window.requestAnimationFrame(fn2) : setTimeout(fn2, 16);
  3133. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  3134. const generateId = () => Math.floor(Math.random() * 1e4);
  3135. const mutable = (val) => val;
  3136. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  3137. const LISTENER_PREFIX = /^on[A-Z]/;
  3138. const useAttrs = (params = {}) => {
  3139. const { excludeListeners = false, excludeKeys = [] } = params;
  3140. const allExcludeKeys = excludeKeys.concat(DEFAULT_EXCLUDE_KEYS);
  3141. const instance = getCurrentInstance();
  3142. if (!instance) {
  3143. return computed(() => ({}));
  3144. }
  3145. return computed(() => {
  3146. var _a2;
  3147. return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  3148. });
  3149. };
  3150. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  3151. const configProviderContextKey = Symbol();
  3152. const dialogInjectionKey = Symbol("dialogInjectionKey");
  3153. const formContextKey = Symbol("formContextKey");
  3154. const formItemContextKey = Symbol("formItemContextKey");
  3155. const radioGroupKey = Symbol("radioGroupKey");
  3156. const scrollbarContextKey = Symbol("scrollbarContextKey");
  3157. const uploadContextKey = Symbol("uploadContextKey");
  3158. const POPPER_INJECTION_KEY = Symbol("popper");
  3159. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  3160. const useProp = (name) => {
  3161. const vm = getCurrentInstance();
  3162. return computed(() => {
  3163. var _a2, _b2;
  3164. return (_b2 = (_a2 = vm.proxy) == null ? void 0 : _a2.$props[name]) != null ? _b2 : void 0;
  3165. });
  3166. };
  3167. const globalConfig = ref();
  3168. function useGlobalConfig(key, defaultValue = void 0) {
  3169. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  3170. if (key) {
  3171. return computed(() => {
  3172. var _a2, _b2;
  3173. return (_b2 = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b2 : defaultValue;
  3174. });
  3175. } else {
  3176. return config;
  3177. }
  3178. }
  3179. const provideGlobalConfig = (config, app, global2 = false) => {
  3180. var _a2;
  3181. const inSetup = !!getCurrentInstance();
  3182. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  3183. const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
  3184. if (!provideFn) {
  3185. return;
  3186. }
  3187. const context = computed(() => {
  3188. const cfg = unref(config);
  3189. if (!(oldConfig == null ? void 0 : oldConfig.value))
  3190. return cfg;
  3191. return mergeConfig(oldConfig.value, cfg);
  3192. });
  3193. provideFn(configProviderContextKey, context);
  3194. if (global2 || !globalConfig.value) {
  3195. globalConfig.value = context.value;
  3196. }
  3197. return context;
  3198. };
  3199. const mergeConfig = (a2, b2) => {
  3200. var _a2;
  3201. const keys2 = [.../* @__PURE__ */ new Set([...keysOf(a2), ...keysOf(b2)])];
  3202. const obj = {};
  3203. for (const key of keys2) {
  3204. obj[key] = (_a2 = b2[key]) != null ? _a2 : a2[key];
  3205. }
  3206. return obj;
  3207. };
  3208. const useSizeProp = buildProp({
  3209. type: String,
  3210. values: componentSizes,
  3211. required: false
  3212. });
  3213. const useSize = (fallback, ignore = {}) => {
  3214. const emptyRef = ref(void 0);
  3215. const size = ignore.prop ? emptyRef : useProp("size");
  3216. const globalConfig2 = ignore.global ? emptyRef : useGlobalConfig("size");
  3217. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  3218. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  3219. return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  3220. };
  3221. const useDisabled$1 = (fallback) => {
  3222. const disabled = useProp("disabled");
  3223. const form = inject(formContextKey, void 0);
  3224. return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  3225. };
  3226. const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type: type4 = "API" }, condition) => {
  3227. watch(() => unref(condition), (val) => {
  3228. }, {
  3229. immediate: true
  3230. });
  3231. };
  3232. const useDraggable = (targetRef, dragRef, draggable) => {
  3233. let transform = {
  3234. offsetX: 0,
  3235. offsetY: 0
  3236. };
  3237. const onMousedown = (e) => {
  3238. const downX = e.clientX;
  3239. const downY = e.clientY;
  3240. const { offsetX, offsetY } = transform;
  3241. const targetRect = targetRef.value.getBoundingClientRect();
  3242. const targetLeft = targetRect.left;
  3243. const targetTop = targetRect.top;
  3244. const targetWidth = targetRect.width;
  3245. const targetHeight = targetRect.height;
  3246. const clientWidth = document.documentElement.clientWidth;
  3247. const clientHeight = document.documentElement.clientHeight;
  3248. const minLeft = -targetLeft + offsetX;
  3249. const minTop = -targetTop + offsetY;
  3250. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  3251. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  3252. const onMousemove = (e2) => {
  3253. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  3254. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  3255. transform = {
  3256. offsetX: moveX,
  3257. offsetY: moveY
  3258. };
  3259. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  3260. };
  3261. const onMouseup = () => {
  3262. document.removeEventListener("mousemove", onMousemove);
  3263. document.removeEventListener("mouseup", onMouseup);
  3264. };
  3265. document.addEventListener("mousemove", onMousemove);
  3266. document.addEventListener("mouseup", onMouseup);
  3267. };
  3268. const onDraggable = () => {
  3269. if (dragRef.value && targetRef.value) {
  3270. dragRef.value.addEventListener("mousedown", onMousedown);
  3271. }
  3272. };
  3273. const offDraggable = () => {
  3274. if (dragRef.value && targetRef.value) {
  3275. dragRef.value.removeEventListener("mousedown", onMousedown);
  3276. }
  3277. };
  3278. onMounted(() => {
  3279. watchEffect(() => {
  3280. if (draggable.value) {
  3281. onDraggable();
  3282. } else {
  3283. offDraggable();
  3284. }
  3285. });
  3286. });
  3287. onBeforeUnmount(() => {
  3288. offDraggable();
  3289. });
  3290. };
  3291. const useFocus = (el) => {
  3292. return {
  3293. focus: () => {
  3294. var _a2, _b2;
  3295. (_b2 = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  3296. }
  3297. };
  3298. };
  3299. const useFormItem = () => {
  3300. const form = inject(formContextKey, void 0);
  3301. const formItem = inject(formItemContextKey, void 0);
  3302. return {
  3303. form,
  3304. formItem
  3305. };
  3306. };
  3307. var English = {
  3308. name: "en",
  3309. el: {
  3310. colorpicker: {
  3311. confirm: "OK",
  3312. clear: "Clear"
  3313. },
  3314. datepicker: {
  3315. now: "Now",
  3316. today: "Today",
  3317. cancel: "Cancel",
  3318. clear: "Clear",
  3319. confirm: "OK",
  3320. selectDate: "Select date",
  3321. selectTime: "Select time",
  3322. startDate: "Start Date",
  3323. startTime: "Start Time",
  3324. endDate: "End Date",
  3325. endTime: "End Time",
  3326. prevYear: "Previous Year",
  3327. nextYear: "Next Year",
  3328. prevMonth: "Previous Month",
  3329. nextMonth: "Next Month",
  3330. year: "",
  3331. month1: "January",
  3332. month2: "February",
  3333. month3: "March",
  3334. month4: "April",
  3335. month5: "May",
  3336. month6: "June",
  3337. month7: "July",
  3338. month8: "August",
  3339. month9: "September",
  3340. month10: "October",
  3341. month11: "November",
  3342. month12: "December",
  3343. week: "week",
  3344. weeks: {
  3345. sun: "Sun",
  3346. mon: "Mon",
  3347. tue: "Tue",
  3348. wed: "Wed",
  3349. thu: "Thu",
  3350. fri: "Fri",
  3351. sat: "Sat"
  3352. },
  3353. months: {
  3354. jan: "Jan",
  3355. feb: "Feb",
  3356. mar: "Mar",
  3357. apr: "Apr",
  3358. may: "May",
  3359. jun: "Jun",
  3360. jul: "Jul",
  3361. aug: "Aug",
  3362. sep: "Sep",
  3363. oct: "Oct",
  3364. nov: "Nov",
  3365. dec: "Dec"
  3366. }
  3367. },
  3368. select: {
  3369. loading: "Loading",
  3370. noMatch: "No matching data",
  3371. noData: "No data",
  3372. placeholder: "Select"
  3373. },
  3374. cascader: {
  3375. noMatch: "No matching data",
  3376. loading: "Loading",
  3377. placeholder: "Select",
  3378. noData: "No data"
  3379. },
  3380. pagination: {
  3381. goto: "Go to",
  3382. pagesize: "/page",
  3383. total: "Total {total}",
  3384. pageClassifier: "",
  3385. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  3386. },
  3387. messagebox: {
  3388. title: "Message",
  3389. confirm: "OK",
  3390. cancel: "Cancel",
  3391. error: "Illegal input"
  3392. },
  3393. upload: {
  3394. deleteTip: "press delete to remove",
  3395. delete: "Delete",
  3396. preview: "Preview",
  3397. continue: "Continue"
  3398. },
  3399. table: {
  3400. emptyText: "No Data",
  3401. confirmFilter: "Confirm",
  3402. resetFilter: "Reset",
  3403. clearFilter: "All",
  3404. sumText: "Sum"
  3405. },
  3406. tree: {
  3407. emptyText: "No Data"
  3408. },
  3409. transfer: {
  3410. noMatch: "No matching data",
  3411. noData: "No data",
  3412. titles: ["List 1", "List 2"],
  3413. filterPlaceholder: "Enter keyword",
  3414. noCheckedFormat: "{total} items",
  3415. hasCheckedFormat: "{checked}/{total} checked"
  3416. },
  3417. image: {
  3418. error: "FAILED"
  3419. },
  3420. pageHeader: {
  3421. title: "Back"
  3422. },
  3423. popconfirm: {
  3424. confirmButtonText: "Yes",
  3425. cancelButtonText: "No"
  3426. }
  3427. }
  3428. };
  3429. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  3430. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_2, key) => {
  3431. var _a2;
  3432. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  3433. });
  3434. const buildLocaleContext = (locale) => {
  3435. const lang = computed(() => unref(locale).name);
  3436. const localeRef = isRef(locale) ? locale : ref(locale);
  3437. return {
  3438. lang,
  3439. locale: localeRef,
  3440. t: buildTranslator(locale)
  3441. };
  3442. };
  3443. const useLocale = () => {
  3444. const locale = useGlobalConfig("locale");
  3445. return buildLocaleContext(computed(() => locale.value || English));
  3446. };
  3447. const useLockscreen = (trigger) => {
  3448. if (!isRef(trigger)) {
  3449. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  3450. }
  3451. if (!isClient || hasClass(document.body, "el-popup-parent--hidden")) {
  3452. return;
  3453. }
  3454. let scrollBarWidth2 = 0;
  3455. let withoutHiddenClass = false;
  3456. let bodyPaddingRight = "0";
  3457. let computedBodyPaddingRight = 0;
  3458. const cleanup = () => {
  3459. removeClass(document.body, "el-popup-parent--hidden");
  3460. if (withoutHiddenClass) {
  3461. document.body.style.paddingRight = bodyPaddingRight;
  3462. }
  3463. };
  3464. watch(trigger, (val) => {
  3465. if (!val) {
  3466. cleanup();
  3467. return;
  3468. }
  3469. withoutHiddenClass = !hasClass(document.body, "el-popup-parent--hidden");
  3470. if (withoutHiddenClass) {
  3471. bodyPaddingRight = document.body.style.paddingRight;
  3472. computedBodyPaddingRight = Number.parseInt(getStyle(document.body, "paddingRight"), 10);
  3473. }
  3474. scrollBarWidth2 = getScrollBarWidth();
  3475. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  3476. const bodyOverflowY = getStyle(document.body, "overflowY");
  3477. if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  3478. document.body.style.paddingRight = `${computedBodyPaddingRight + scrollBarWidth2}px`;
  3479. }
  3480. addClass(document.body, "el-popup-parent--hidden");
  3481. });
  3482. onScopeDispose(() => cleanup());
  3483. };
  3484. const modalStack = [];
  3485. const closeModal = (e) => {
  3486. if (modalStack.length === 0)
  3487. return;
  3488. if (e.code === EVENT_CODE.esc) {
  3489. e.stopPropagation();
  3490. const topModal = modalStack[modalStack.length - 1];
  3491. topModal.handleClose();
  3492. }
  3493. };
  3494. const useModal = (instance, visibleRef) => {
  3495. watch(visibleRef, (val) => {
  3496. if (val) {
  3497. modalStack.push(instance);
  3498. } else {
  3499. modalStack.splice(modalStack.indexOf(instance), 1);
  3500. }
  3501. });
  3502. };
  3503. if (isClient)
  3504. useEventListener(document, "keydown", closeModal);
  3505. const _prop = buildProp({
  3506. type: definePropType(Boolean),
  3507. default: null
  3508. });
  3509. const _event = buildProp({
  3510. type: definePropType(Function)
  3511. });
  3512. const createModelToggleComposable = (name) => {
  3513. const useModelToggleProps2 = {
  3514. [name]: _prop,
  3515. [`onUpdate:${name}`]: _event
  3516. };
  3517. const useModelToggleEmits2 = [`update:${name}`];
  3518. const useModelToggle2 = ({
  3519. indicator,
  3520. shouldHideWhenRouteChanges,
  3521. shouldProceed,
  3522. onShow,
  3523. onHide
  3524. }) => {
  3525. const instance = getCurrentInstance();
  3526. const props = instance.props;
  3527. const { emit } = instance;
  3528. const updateEventKey = `update:${name}`;
  3529. const hasUpdateHandler = computed(() => isFunction(props[`onUpdate:${name}`]));
  3530. const isModelBindingAbsent = computed(() => props[name] === null);
  3531. const doShow = () => {
  3532. if (indicator.value === true) {
  3533. return;
  3534. }
  3535. indicator.value = true;
  3536. if (isFunction(onShow)) {
  3537. onShow();
  3538. }
  3539. };
  3540. const doHide = () => {
  3541. if (indicator.value === false) {
  3542. return;
  3543. }
  3544. indicator.value = false;
  3545. if (isFunction(onHide)) {
  3546. onHide();
  3547. }
  3548. };
  3549. const show = () => {
  3550. if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
  3551. return;
  3552. const shouldEmit = hasUpdateHandler.value && isClient;
  3553. if (shouldEmit) {
  3554. emit(updateEventKey, true);
  3555. }
  3556. if (isModelBindingAbsent.value || !shouldEmit) {
  3557. doShow();
  3558. }
  3559. };
  3560. const hide2 = () => {
  3561. if (props.disabled === true || !isClient)
  3562. return;
  3563. const shouldEmit = hasUpdateHandler.value && isClient;
  3564. if (shouldEmit) {
  3565. emit(updateEventKey, false);
  3566. }
  3567. if (isModelBindingAbsent.value || !shouldEmit) {
  3568. doHide();
  3569. }
  3570. };
  3571. const onChange = (val) => {
  3572. if (!isBoolean(val))
  3573. return;
  3574. if (props.disabled && val) {
  3575. if (hasUpdateHandler.value) {
  3576. emit(updateEventKey, false);
  3577. }
  3578. } else if (indicator.value !== val) {
  3579. if (val) {
  3580. doShow();
  3581. } else {
  3582. doHide();
  3583. }
  3584. }
  3585. };
  3586. const toggle = () => {
  3587. if (indicator.value) {
  3588. hide2();
  3589. } else {
  3590. show();
  3591. }
  3592. };
  3593. watch(() => props[name], onChange);
  3594. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  3595. watch(() => __spreadValues({}, instance.proxy.$route), () => {
  3596. if (shouldHideWhenRouteChanges.value && indicator.value) {
  3597. hide2();
  3598. }
  3599. });
  3600. }
  3601. onMounted(() => {
  3602. onChange(props[name]);
  3603. });
  3604. return {
  3605. hide: hide2,
  3606. show,
  3607. toggle
  3608. };
  3609. };
  3610. return {
  3611. useModelToggle: useModelToggle2,
  3612. useModelToggleProps: useModelToggleProps2,
  3613. useModelToggleEmits: useModelToggleEmits2
  3614. };
  3615. };
  3616. const useRestoreActive = (toggle, initialFocus) => {
  3617. let previousActive;
  3618. watch(() => toggle.value, (val) => {
  3619. var _a2, _b2;
  3620. if (val) {
  3621. previousActive = document.activeElement;
  3622. if (isRef(initialFocus)) {
  3623. (_b2 = (_a2 = initialFocus.value).focus) == null ? void 0 : _b2.call(_a2);
  3624. }
  3625. } else {
  3626. {
  3627. previousActive.focus();
  3628. }
  3629. }
  3630. });
  3631. };
  3632. const useSameTarget = (handleClick) => {
  3633. if (!handleClick) {
  3634. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  3635. }
  3636. let mousedownTarget = false;
  3637. let mouseupTarget = false;
  3638. const onClick = (e) => {
  3639. if (mousedownTarget && mouseupTarget) {
  3640. handleClick(e);
  3641. }
  3642. mousedownTarget = mouseupTarget = false;
  3643. };
  3644. const onMousedown = (e) => {
  3645. mousedownTarget = e.target === e.currentTarget;
  3646. };
  3647. const onMouseup = (e) => {
  3648. mouseupTarget = e.target === e.currentTarget;
  3649. };
  3650. return { onClick, onMousedown, onMouseup };
  3651. };
  3652. function useTimeout() {
  3653. let timeoutHandle;
  3654. const registerTimeout = (fn2, delay) => {
  3655. cancelTimeout();
  3656. timeoutHandle = window.setTimeout(fn2, delay);
  3657. };
  3658. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  3659. tryOnScopeDispose(() => cancelTimeout());
  3660. return {
  3661. registerTimeout,
  3662. cancelTimeout
  3663. };
  3664. }
  3665. const defaultIdInjection = {
  3666. prefix: Math.floor(Math.random() * 1e4),
  3667. current: 0
  3668. };
  3669. const ID_INJECTION_KEY = Symbol("elIdInjection");
  3670. const useId = (deterministicId) => {
  3671. const idInjection = inject(ID_INJECTION_KEY, defaultIdInjection);
  3672. const idRef = computed(() => unref(deterministicId) || `el-id-${idInjection.prefix}-${idInjection.current++}`);
  3673. return idRef;
  3674. };
  3675. const useEscapeKeydown = (handler3) => {
  3676. const cachedHandler = (e) => {
  3677. const event = e;
  3678. if (event.key === EVENT_CODE.esc) {
  3679. handler3 == null ? void 0 : handler3(event);
  3680. }
  3681. };
  3682. onMounted(() => {
  3683. on(document, "keydown", cachedHandler);
  3684. });
  3685. onBeforeUnmount(() => {
  3686. off(document, "keydown", cachedHandler);
  3687. });
  3688. };
  3689. let cachedContainer;
  3690. const POPPER_CONTAINER_ID = `el-popper-container-${generateId()}`;
  3691. const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`;
  3692. const createContainer = () => {
  3693. const container = document.createElement("div");
  3694. container.id = POPPER_CONTAINER_ID;
  3695. document.body.appendChild(container);
  3696. return container;
  3697. };
  3698. const usePopperContainer = () => {
  3699. onBeforeMount(() => {
  3700. if (!isClient)
  3701. return;
  3702. if (!cachedContainer || !document.body.querySelector(POPPER_CONTAINER_SELECTOR)) {
  3703. cachedContainer = createContainer();
  3704. }
  3705. });
  3706. };
  3707. const useDelayedToggleProps = buildProps({
  3708. showAfter: {
  3709. type: Number,
  3710. default: 0
  3711. },
  3712. hideAfter: {
  3713. type: Number,
  3714. default: 200
  3715. }
  3716. });
  3717. const useDelayedToggle = ({
  3718. showAfter,
  3719. hideAfter,
  3720. open,
  3721. close: close2
  3722. }) => {
  3723. const { registerTimeout } = useTimeout();
  3724. const onOpen = () => {
  3725. registerTimeout(() => {
  3726. open();
  3727. }, unref(showAfter));
  3728. };
  3729. const onClose = () => {
  3730. registerTimeout(() => {
  3731. close2();
  3732. }, unref(hideAfter));
  3733. };
  3734. return {
  3735. onOpen,
  3736. onClose
  3737. };
  3738. };
  3739. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  3740. const useForwardRef = (forwardRef) => {
  3741. const setForwardRef = (el) => {
  3742. forwardRef.value = el;
  3743. };
  3744. provide(FORWARD_REF_INJECTION_KEY, {
  3745. setForwardRef
  3746. });
  3747. };
  3748. const useForwardRefDirective = (setForwardRef) => {
  3749. return {
  3750. mounted(el) {
  3751. setForwardRef(el);
  3752. },
  3753. updated(el) {
  3754. setForwardRef(el);
  3755. },
  3756. unmounted() {
  3757. setForwardRef(null);
  3758. }
  3759. };
  3760. };
  3761. const defaultNamespace = "el";
  3762. const statePrefix = "is-";
  3763. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  3764. let cls = `${namespace}-${block}`;
  3765. if (blockSuffix) {
  3766. cls += `-${blockSuffix}`;
  3767. }
  3768. if (element) {
  3769. cls += `__${element}`;
  3770. }
  3771. if (modifier) {
  3772. cls += `--${modifier}`;
  3773. }
  3774. return cls;
  3775. };
  3776. const useNamespace = (block) => {
  3777. const globalConfig2 = useGlobalConfig("namespace");
  3778. const namespace = computed(() => globalConfig2.value || defaultNamespace);
  3779. const b2 = (blockSuffix = "") => _bem(unref(namespace), block, blockSuffix, "", "");
  3780. const e = (element) => element ? _bem(unref(namespace), block, "", element, "") : "";
  3781. const m2 = (modifier) => modifier ? _bem(unref(namespace), block, "", "", modifier) : "";
  3782. const be = (blockSuffix, element) => blockSuffix && element ? _bem(unref(namespace), block, blockSuffix, element, "") : "";
  3783. const em = (element, modifier) => element && modifier ? _bem(unref(namespace), block, "", element, modifier) : "";
  3784. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(unref(namespace), block, blockSuffix, "", modifier) : "";
  3785. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(unref(namespace), block, blockSuffix, element, modifier) : "";
  3786. const is = (name, ...args) => {
  3787. const state = args.length >= 1 ? args[0] : true;
  3788. return name && state ? `${statePrefix}${name}` : "";
  3789. };
  3790. return {
  3791. namespace,
  3792. b: b2,
  3793. e,
  3794. m: m2,
  3795. be,
  3796. em,
  3797. bm,
  3798. bem,
  3799. is
  3800. };
  3801. };
  3802. const zIndex = ref(0);
  3803. const useZIndex = () => {
  3804. const initialZIndex = useGlobalConfig("zIndex", 2e3);
  3805. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  3806. const nextZIndex = () => {
  3807. zIndex.value++;
  3808. return currentZIndex.value;
  3809. };
  3810. return {
  3811. initialZIndex,
  3812. currentZIndex,
  3813. nextZIndex
  3814. };
  3815. };
  3816. var _export_sfc$1 = (sfc, props) => {
  3817. const target = sfc.__vccOpts || sfc;
  3818. for (const [key, val] of props) {
  3819. target[key] = val;
  3820. }
  3821. return target;
  3822. };
  3823. const iconProps = buildProps({
  3824. size: {
  3825. type: definePropType([Number, String])
  3826. },
  3827. color: {
  3828. type: String
  3829. }
  3830. });
  3831. const __default__$l = {
  3832. name: "ElIcon",
  3833. inheritAttrs: false
  3834. };
  3835. const _sfc_main$1a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$l), {
  3836. props: iconProps,
  3837. setup(__props) {
  3838. const props = __props;
  3839. const ns = useNamespace("icon");
  3840. const style = computed(() => {
  3841. if (!props.size && !props.color)
  3842. return {};
  3843. return {
  3844. fontSize: isUndefined(props.size) ? void 0 : addUnit(props.size),
  3845. "--color": props.color
  3846. };
  3847. });
  3848. return (_ctx, _cache) => {
  3849. return openBlock(), createElementBlock("i", mergeProps({
  3850. class: unref(ns).b(),
  3851. style: unref(style)
  3852. }, _ctx.$attrs), [
  3853. renderSlot(_ctx.$slots, "default")
  3854. ], 16);
  3855. };
  3856. }
  3857. }));
  3858. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$1a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  3859. const ElIcon = withInstall(Icon);
  3860. let hiddenTextarea = void 0;
  3861. const HIDDEN_STYLE = `
  3862. height:0 !important;
  3863. visibility:hidden !important;
  3864. overflow:hidden !important;
  3865. position:absolute !important;
  3866. z-index:-1000 !important;
  3867. top:0 !important;
  3868. right:0 !important;
  3869. `;
  3870. const CONTEXT_STYLE = [
  3871. "letter-spacing",
  3872. "line-height",
  3873. "padding-top",
  3874. "padding-bottom",
  3875. "font-family",
  3876. "font-weight",
  3877. "font-size",
  3878. "text-rendering",
  3879. "text-transform",
  3880. "width",
  3881. "text-indent",
  3882. "padding-left",
  3883. "padding-right",
  3884. "border-width",
  3885. "box-sizing"
  3886. ];
  3887. function calculateNodeStyling(targetElement) {
  3888. const style = window.getComputedStyle(targetElement);
  3889. const boxSizing = style.getPropertyValue("box-sizing");
  3890. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  3891. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  3892. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  3893. return { contextStyle, paddingSize, borderSize, boxSizing };
  3894. }
  3895. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  3896. var _a2;
  3897. if (!hiddenTextarea) {
  3898. hiddenTextarea = document.createElement("textarea");
  3899. document.body.appendChild(hiddenTextarea);
  3900. }
  3901. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  3902. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  3903. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  3904. let height = hiddenTextarea.scrollHeight;
  3905. const result = {};
  3906. if (boxSizing === "border-box") {
  3907. height = height + borderSize;
  3908. } else if (boxSizing === "content-box") {
  3909. height = height - paddingSize;
  3910. }
  3911. hiddenTextarea.value = "";
  3912. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  3913. if (isNumber(minRows)) {
  3914. let minHeight = singleRowHeight * minRows;
  3915. if (boxSizing === "border-box") {
  3916. minHeight = minHeight + paddingSize + borderSize;
  3917. }
  3918. height = Math.max(minHeight, height);
  3919. result.minHeight = `${minHeight}px`;
  3920. }
  3921. if (isNumber(maxRows)) {
  3922. let maxHeight = singleRowHeight * maxRows;
  3923. if (boxSizing === "border-box") {
  3924. maxHeight = maxHeight + paddingSize + borderSize;
  3925. }
  3926. height = Math.min(maxHeight, height);
  3927. }
  3928. result.height = `${height}px`;
  3929. (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
  3930. hiddenTextarea = void 0;
  3931. return result;
  3932. }
  3933. const inputProps = buildProps({
  3934. size: useSizeProp,
  3935. disabled: Boolean,
  3936. modelValue: {
  3937. type: definePropType([
  3938. String,
  3939. Number,
  3940. Object
  3941. ]),
  3942. default: ""
  3943. },
  3944. type: {
  3945. type: String,
  3946. default: "text"
  3947. },
  3948. resize: {
  3949. type: String,
  3950. values: ["none", "both", "horizontal", "vertical"]
  3951. },
  3952. autosize: {
  3953. type: definePropType([Boolean, Object]),
  3954. default: false
  3955. },
  3956. autocomplete: {
  3957. type: String,
  3958. default: "off"
  3959. },
  3960. placeholder: {
  3961. type: String
  3962. },
  3963. form: {
  3964. type: String,
  3965. default: ""
  3966. },
  3967. readonly: {
  3968. type: Boolean,
  3969. default: false
  3970. },
  3971. clearable: {
  3972. type: Boolean,
  3973. default: false
  3974. },
  3975. showPassword: {
  3976. type: Boolean,
  3977. default: false
  3978. },
  3979. showWordLimit: {
  3980. type: Boolean,
  3981. default: false
  3982. },
  3983. suffixIcon: {
  3984. type: iconPropType,
  3985. default: ""
  3986. },
  3987. prefixIcon: {
  3988. type: iconPropType,
  3989. default: ""
  3990. },
  3991. label: {
  3992. type: String
  3993. },
  3994. tabindex: {
  3995. type: [Number, String]
  3996. },
  3997. validateEvent: {
  3998. type: Boolean,
  3999. default: true
  4000. },
  4001. inputStyle: {
  4002. type: definePropType([Object, Array, String]),
  4003. default: () => mutable({})
  4004. }
  4005. });
  4006. const inputEmits = {
  4007. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  4008. input: (value) => isString(value),
  4009. change: (value) => isString(value),
  4010. focus: (evt) => evt instanceof FocusEvent,
  4011. blur: (evt) => evt instanceof FocusEvent,
  4012. clear: () => true,
  4013. mouseleave: (evt) => evt instanceof MouseEvent,
  4014. mouseenter: (evt) => evt instanceof MouseEvent,
  4015. keydown: (evt) => evt instanceof Event,
  4016. compositionstart: (evt) => evt instanceof CompositionEvent,
  4017. compositionupdate: (evt) => evt instanceof CompositionEvent,
  4018. compositionend: (evt) => evt instanceof CompositionEvent
  4019. };
  4020. const _hoisted_1$F = ["type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder"];
  4021. const _hoisted_2$v = ["tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder"];
  4022. const __default__$k = {
  4023. name: "ElInput",
  4024. inheritAttrs: false
  4025. };
  4026. const _sfc_main$19 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$k), {
  4027. props: inputProps,
  4028. emits: inputEmits,
  4029. setup(__props, { expose, emit }) {
  4030. const props = __props;
  4031. const PENDANT_MAP = {
  4032. suffix: "append",
  4033. prefix: "prepend"
  4034. };
  4035. const instance = getCurrentInstance();
  4036. const rawAttrs = useAttrs$1();
  4037. const slots = useSlots();
  4038. const attrs = useAttrs();
  4039. const { form, formItem } = useFormItem();
  4040. const inputSize = useSize();
  4041. const inputDisabled = useDisabled$1();
  4042. const nsInput = useNamespace("input");
  4043. const nsTextarea = useNamespace("textarea");
  4044. const input = shallowRef();
  4045. const textarea = shallowRef();
  4046. const focused = ref(false);
  4047. const hovering = ref(false);
  4048. const isComposing = ref(false);
  4049. const passwordVisible = ref(false);
  4050. const textareaCalcStyle = shallowRef(props.inputStyle);
  4051. const _ref = computed(() => input.value || textarea.value);
  4052. const needStatusIcon = computed(() => {
  4053. var _a2;
  4054. return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
  4055. });
  4056. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  4057. const validateIcon = computed(() => ValidateComponentsMap[validateState.value]);
  4058. const passwordIcon = computed(() => passwordVisible.value ? view : hide$2);
  4059. const containerStyle = computed(() => [
  4060. rawAttrs.style,
  4061. props.inputStyle
  4062. ]);
  4063. const textareaStyle = computed(() => [
  4064. props.inputStyle,
  4065. textareaCalcStyle.value,
  4066. { resize: props.resize }
  4067. ]);
  4068. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  4069. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  4070. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !props.readonly && (!!nativeInputValue.value || focused.value));
  4071. const isWordLimitVisible = computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  4072. const textLength = computed(() => Array.from(nativeInputValue.value).length);
  4073. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  4074. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  4075. const resizeTextarea = () => {
  4076. const { type: type4, autosize } = props;
  4077. if (!isClient || type4 !== "textarea")
  4078. return;
  4079. if (autosize) {
  4080. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  4081. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  4082. textareaCalcStyle.value = __spreadValues({}, calcTextareaHeight(textarea.value, minRows, maxRows));
  4083. } else {
  4084. textareaCalcStyle.value = {
  4085. minHeight: calcTextareaHeight(textarea.value).minHeight
  4086. };
  4087. }
  4088. };
  4089. const setNativeInputValue = () => {
  4090. const input2 = _ref.value;
  4091. if (!input2 || input2.value === nativeInputValue.value)
  4092. return;
  4093. input2.value = nativeInputValue.value;
  4094. };
  4095. const calcIconOffset = (place) => {
  4096. const { el } = instance.vnode;
  4097. if (!el)
  4098. return;
  4099. const elList = Array.from(el.querySelectorAll(`.${nsInput.e(place)}`));
  4100. const target = elList.find((item) => item.parentNode === el);
  4101. if (!target)
  4102. return;
  4103. const pendant = PENDANT_MAP[place];
  4104. if (slots[pendant]) {
  4105. target.style.transform = `translateX(${place === "suffix" ? "-" : ""}${el.querySelector(`.${nsInput.be("group", pendant)}`).offsetWidth}px)`;
  4106. } else {
  4107. target.removeAttribute("style");
  4108. }
  4109. };
  4110. const updateIconOffset = () => {
  4111. calcIconOffset("prefix");
  4112. calcIconOffset("suffix");
  4113. };
  4114. const handleInput = async (event) => {
  4115. const { value } = event.target;
  4116. if (isComposing.value)
  4117. return;
  4118. if (value === nativeInputValue.value)
  4119. return;
  4120. emit(UPDATE_MODEL_EVENT, value);
  4121. emit("input", value);
  4122. await nextTick();
  4123. setNativeInputValue();
  4124. };
  4125. const handleChange2 = (event) => {
  4126. emit("change", event.target.value);
  4127. };
  4128. const handleCompositionStart = (event) => {
  4129. emit("compositionstart", event);
  4130. isComposing.value = true;
  4131. };
  4132. const handleCompositionUpdate = (event) => {
  4133. var _a2;
  4134. emit("compositionupdate", event);
  4135. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  4136. const lastCharacter = text[text.length - 1] || "";
  4137. isComposing.value = !isKorean(lastCharacter);
  4138. };
  4139. const handleCompositionEnd = (event) => {
  4140. emit("compositionend", event);
  4141. if (isComposing.value) {
  4142. isComposing.value = false;
  4143. handleInput(event);
  4144. }
  4145. };
  4146. const handlePasswordVisible = () => {
  4147. passwordVisible.value = !passwordVisible.value;
  4148. focus();
  4149. };
  4150. const focus = async () => {
  4151. var _a2;
  4152. await nextTick();
  4153. (_a2 = _ref.value) == null ? void 0 : _a2.focus();
  4154. };
  4155. const blur = () => {
  4156. var _a2;
  4157. return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
  4158. };
  4159. const handleFocus = (event) => {
  4160. focused.value = true;
  4161. emit("focus", event);
  4162. };
  4163. const handleBlur = (event) => {
  4164. var _a2;
  4165. focused.value = false;
  4166. emit("blur", event);
  4167. if (props.validateEvent) {
  4168. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  4169. }
  4170. };
  4171. const handleMouseLeave = (evt) => {
  4172. hovering.value = false;
  4173. emit("mouseleave", evt);
  4174. };
  4175. const handleMouseEnter = (evt) => {
  4176. hovering.value = true;
  4177. emit("mouseenter", evt);
  4178. };
  4179. const handleKeydown = (evt) => {
  4180. emit("keydown", evt);
  4181. };
  4182. const select = () => {
  4183. var _a2;
  4184. (_a2 = _ref.value) == null ? void 0 : _a2.select();
  4185. };
  4186. const clear = () => {
  4187. emit(UPDATE_MODEL_EVENT, "");
  4188. emit("change", "");
  4189. emit("clear");
  4190. emit("input", "");
  4191. };
  4192. watch(() => props.modelValue, () => {
  4193. var _a2;
  4194. nextTick(() => resizeTextarea());
  4195. if (props.validateEvent) {
  4196. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  4197. }
  4198. });
  4199. watch(nativeInputValue, () => setNativeInputValue());
  4200. watch(() => props.type, async () => {
  4201. await nextTick();
  4202. setNativeInputValue();
  4203. resizeTextarea();
  4204. updateIconOffset();
  4205. });
  4206. onMounted(async () => {
  4207. setNativeInputValue();
  4208. updateIconOffset();
  4209. await nextTick();
  4210. resizeTextarea();
  4211. });
  4212. onUpdated(async () => {
  4213. await nextTick();
  4214. updateIconOffset();
  4215. });
  4216. expose({
  4217. input,
  4218. textarea,
  4219. ref: _ref,
  4220. textareaStyle,
  4221. autosize: toRef(props, "autosize"),
  4222. focus,
  4223. blur,
  4224. select,
  4225. clear,
  4226. resizeTextarea
  4227. });
  4228. return (_ctx, _cache) => {
  4229. return withDirectives((openBlock(), createElementBlock("div", {
  4230. class: normalizeClass([
  4231. _ctx.type === "textarea" ? unref(nsTextarea).b() : unref(nsInput).b(),
  4232. unref(nsInput).m(unref(inputSize)),
  4233. unref(nsInput).is("disabled", unref(inputDisabled)),
  4234. unref(nsInput).is("exceed", unref(inputExceed)),
  4235. {
  4236. [unref(nsInput).b("group")]: _ctx.$slots.prepend || _ctx.$slots.append,
  4237. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  4238. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend,
  4239. [unref(nsInput).m("prefix")]: _ctx.$slots.prefix || _ctx.prefixIcon,
  4240. [unref(nsInput).m("suffix")]: _ctx.$slots.suffix || _ctx.suffixIcon || _ctx.clearable || _ctx.showPassword,
  4241. [unref(nsInput).bm("suffix", "password-clear")]: unref(showClear) && unref(showPwdVisible)
  4242. },
  4243. _ctx.$attrs.class
  4244. ]),
  4245. style: normalizeStyle(unref(containerStyle)),
  4246. onMouseenter: handleMouseEnter,
  4247. onMouseleave: handleMouseLeave
  4248. }, [
  4249. createCommentVNode(" input "),
  4250. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4251. createCommentVNode(" prepend slot "),
  4252. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  4253. key: 0,
  4254. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  4255. }, [
  4256. renderSlot(_ctx.$slots, "prepend")
  4257. ], 2)) : createCommentVNode("v-if", true),
  4258. createElementVNode("div", {
  4259. class: normalizeClass([unref(nsInput).e("wrapper"), unref(nsInput).is("focus", focused.value)])
  4260. }, [
  4261. createCommentVNode(" prefix slot "),
  4262. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  4263. key: 0,
  4264. class: normalizeClass(unref(nsInput).e("prefix"))
  4265. }, [
  4266. createElementVNode("span", {
  4267. class: normalizeClass(unref(nsInput).e("prefix-inner"))
  4268. }, [
  4269. renderSlot(_ctx.$slots, "prefix"),
  4270. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4271. key: 0,
  4272. class: normalizeClass(unref(nsInput).e("icon"))
  4273. }, {
  4274. default: withCtx(() => [
  4275. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  4276. ]),
  4277. _: 1
  4278. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4279. ], 2)
  4280. ], 2)) : createCommentVNode("v-if", true),
  4281. createElementVNode("input", mergeProps({
  4282. ref_key: "input",
  4283. ref: input,
  4284. class: unref(nsInput).e("inner")
  4285. }, unref(attrs), {
  4286. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  4287. disabled: unref(inputDisabled),
  4288. readonly: _ctx.readonly,
  4289. autocomplete: _ctx.autocomplete,
  4290. tabindex: _ctx.tabindex,
  4291. "aria-label": _ctx.label,
  4292. placeholder: _ctx.placeholder,
  4293. style: _ctx.inputStyle,
  4294. onCompositionstart: handleCompositionStart,
  4295. onCompositionupdate: handleCompositionUpdate,
  4296. onCompositionend: handleCompositionEnd,
  4297. onInput: handleInput,
  4298. onFocus: handleFocus,
  4299. onBlur: handleBlur,
  4300. onChange: handleChange2,
  4301. onKeydown: handleKeydown
  4302. }), null, 16, _hoisted_1$F),
  4303. createCommentVNode(" suffix slot "),
  4304. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  4305. key: 1,
  4306. class: normalizeClass(unref(nsInput).e("suffix"))
  4307. }, [
  4308. createElementVNode("span", {
  4309. class: normalizeClass(unref(nsInput).e("suffix-inner"))
  4310. }, [
  4311. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  4312. renderSlot(_ctx.$slots, "suffix"),
  4313. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  4314. key: 0,
  4315. class: normalizeClass(unref(nsInput).e("icon"))
  4316. }, {
  4317. default: withCtx(() => [
  4318. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  4319. ]),
  4320. _: 1
  4321. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4322. ], 64)) : createCommentVNode("v-if", true),
  4323. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  4324. key: 1,
  4325. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  4326. onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
  4327. }, ["prevent"])),
  4328. onClick: clear
  4329. }, {
  4330. default: withCtx(() => [
  4331. createVNode(unref(circleClose))
  4332. ]),
  4333. _: 1
  4334. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4335. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  4336. key: 2,
  4337. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  4338. onClick: handlePasswordVisible
  4339. }, {
  4340. default: withCtx(() => [
  4341. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  4342. ]),
  4343. _: 1
  4344. }, 8, ["class"])) : createCommentVNode("v-if", true),
  4345. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4346. key: 3,
  4347. class: normalizeClass(unref(nsInput).e("count"))
  4348. }, [
  4349. createElementVNode("span", {
  4350. class: normalizeClass(unref(nsInput).e("count-inner"))
  4351. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
  4352. ], 2)) : createCommentVNode("v-if", true)
  4353. ], 2),
  4354. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  4355. key: 0,
  4356. class: normalizeClass([
  4357. unref(nsInput).e("icon"),
  4358. unref(nsInput).e("validateIcon"),
  4359. unref(nsInput).is("loading", unref(validateState) === "validating")
  4360. ])
  4361. }, {
  4362. default: withCtx(() => [
  4363. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  4364. ]),
  4365. _: 1
  4366. }, 8, ["class"])) : createCommentVNode("v-if", true)
  4367. ], 2)) : createCommentVNode("v-if", true)
  4368. ], 2),
  4369. createCommentVNode(" append slot "),
  4370. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  4371. key: 1,
  4372. class: normalizeClass(unref(nsInput).be("group", "append"))
  4373. }, [
  4374. renderSlot(_ctx.$slots, "append")
  4375. ], 2)) : createCommentVNode("v-if", true)
  4376. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  4377. createCommentVNode(" textarea "),
  4378. createElementVNode("textarea", mergeProps({
  4379. ref_key: "textarea",
  4380. ref: textarea,
  4381. class: unref(nsTextarea).e("inner")
  4382. }, unref(attrs), {
  4383. tabindex: _ctx.tabindex,
  4384. disabled: unref(inputDisabled),
  4385. readonly: _ctx.readonly,
  4386. autocomplete: _ctx.autocomplete,
  4387. style: unref(textareaStyle),
  4388. "aria-label": _ctx.label,
  4389. placeholder: _ctx.placeholder,
  4390. onCompositionstart: handleCompositionStart,
  4391. onCompositionupdate: handleCompositionUpdate,
  4392. onCompositionend: handleCompositionEnd,
  4393. onInput: handleInput,
  4394. onFocus: handleFocus,
  4395. onBlur: handleBlur,
  4396. onChange: handleChange2,
  4397. onKeydown: handleKeydown
  4398. }), null, 16, _hoisted_2$v),
  4399. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  4400. key: 0,
  4401. class: normalizeClass(unref(nsInput).e("count"))
  4402. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)) : createCommentVNode("v-if", true)
  4403. ], 64))
  4404. ], 38)), [
  4405. [vShow, _ctx.type !== "hidden"]
  4406. ]);
  4407. };
  4408. }
  4409. }));
  4410. var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$19, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
  4411. const ElInput = withInstall(Input);
  4412. const BAR_MAP = {
  4413. vertical: {
  4414. offset: "offsetHeight",
  4415. scroll: "scrollTop",
  4416. scrollSize: "scrollHeight",
  4417. size: "height",
  4418. key: "vertical",
  4419. axis: "Y",
  4420. client: "clientY",
  4421. direction: "top"
  4422. },
  4423. horizontal: {
  4424. offset: "offsetWidth",
  4425. scroll: "scrollLeft",
  4426. scrollSize: "scrollWidth",
  4427. size: "width",
  4428. key: "horizontal",
  4429. axis: "X",
  4430. client: "clientX",
  4431. direction: "left"
  4432. }
  4433. };
  4434. const renderThumbStyle$1 = ({ move, size, bar }) => ({
  4435. [bar.size]: size,
  4436. transform: `translate${bar.axis}(${move}%)`
  4437. });
  4438. const thumbProps = buildProps({
  4439. vertical: Boolean,
  4440. size: String,
  4441. move: Number,
  4442. ratio: {
  4443. type: Number,
  4444. required: true
  4445. },
  4446. always: Boolean
  4447. });
  4448. const COMPONENT_NAME$5 = "Thumb";
  4449. const _sfc_main$18 = defineComponent({
  4450. name: COMPONENT_NAME$5,
  4451. props: thumbProps,
  4452. setup(props) {
  4453. const scrollbar = inject(scrollbarContextKey);
  4454. const ns = useNamespace("scrollbar");
  4455. if (!scrollbar)
  4456. throwError(COMPONENT_NAME$5, "can not inject scrollbar context");
  4457. const instance = ref();
  4458. const thumb = ref();
  4459. const thumbState = ref({});
  4460. const visible = ref(false);
  4461. let cursorDown = false;
  4462. let cursorLeave = false;
  4463. let originalOnSelectStart = isClient ? document.onselectstart : null;
  4464. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  4465. const thumbStyle = computed(() => renderThumbStyle$1({
  4466. size: props.size,
  4467. move: props.move,
  4468. bar: bar.value
  4469. }));
  4470. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  4471. const clickThumbHandler = (e) => {
  4472. var _a2;
  4473. e.stopPropagation();
  4474. if (e.ctrlKey || [1, 2].includes(e.button))
  4475. return;
  4476. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  4477. startDrag(e);
  4478. const el = e.currentTarget;
  4479. if (!el)
  4480. return;
  4481. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  4482. };
  4483. const clickTrackHandler = (e) => {
  4484. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  4485. return;
  4486. const offset2 = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  4487. const thumbHalf = thumb.value[bar.value.offset] / 2;
  4488. const thumbPositionPercentage = (offset2 - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4489. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4490. };
  4491. const startDrag = (e) => {
  4492. e.stopImmediatePropagation();
  4493. cursorDown = true;
  4494. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  4495. document.addEventListener("mouseup", mouseUpDocumentHandler);
  4496. originalOnSelectStart = document.onselectstart;
  4497. document.onselectstart = () => false;
  4498. };
  4499. const mouseMoveDocumentHandler = (e) => {
  4500. if (!instance.value || !thumb.value)
  4501. return;
  4502. if (cursorDown === false)
  4503. return;
  4504. const prevPage = thumbState.value[bar.value.axis];
  4505. if (!prevPage)
  4506. return;
  4507. const offset2 = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  4508. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  4509. const thumbPositionPercentage = (offset2 - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  4510. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  4511. };
  4512. const mouseUpDocumentHandler = () => {
  4513. cursorDown = false;
  4514. thumbState.value[bar.value.axis] = 0;
  4515. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  4516. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4517. restoreOnselectstart();
  4518. if (cursorLeave)
  4519. visible.value = false;
  4520. };
  4521. const mouseMoveScrollbarHandler = () => {
  4522. cursorLeave = false;
  4523. visible.value = !!props.size;
  4524. };
  4525. const mouseLeaveScrollbarHandler = () => {
  4526. cursorLeave = true;
  4527. visible.value = cursorDown;
  4528. };
  4529. onBeforeUnmount(() => {
  4530. restoreOnselectstart();
  4531. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  4532. });
  4533. const restoreOnselectstart = () => {
  4534. if (document.onselectstart !== originalOnSelectStart)
  4535. document.onselectstart = originalOnSelectStart;
  4536. };
  4537. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  4538. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  4539. return {
  4540. ns,
  4541. instance,
  4542. thumb,
  4543. bar,
  4544. thumbStyle,
  4545. visible,
  4546. clickTrackHandler,
  4547. clickThumbHandler
  4548. };
  4549. }
  4550. });
  4551. function _sfc_render$G(_ctx, _cache, $props, $setup, $data, $options) {
  4552. return openBlock(), createBlock(Transition, {
  4553. name: _ctx.ns.b("fade")
  4554. }, {
  4555. default: withCtx(() => [
  4556. withDirectives(createElementVNode("div", {
  4557. ref: "instance",
  4558. class: normalizeClass([_ctx.ns.e("bar"), _ctx.ns.is(_ctx.bar.key)]),
  4559. onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
  4560. }, [
  4561. createElementVNode("div", {
  4562. ref: "thumb",
  4563. class: normalizeClass(_ctx.ns.e("thumb")),
  4564. style: normalizeStyle(_ctx.thumbStyle),
  4565. onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
  4566. }, null, 38)
  4567. ], 34), [
  4568. [vShow, _ctx.always || _ctx.visible]
  4569. ])
  4570. ]),
  4571. _: 1
  4572. }, 8, ["name"]);
  4573. }
  4574. var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$18, [["render", _sfc_render$G], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
  4575. const barProps = buildProps({
  4576. always: {
  4577. type: Boolean,
  4578. default: true
  4579. },
  4580. width: {
  4581. type: String,
  4582. default: ""
  4583. },
  4584. height: {
  4585. type: String,
  4586. default: ""
  4587. },
  4588. ratioX: {
  4589. type: Number,
  4590. default: 1
  4591. },
  4592. ratioY: {
  4593. type: Number,
  4594. default: 1
  4595. }
  4596. });
  4597. const _sfc_main$17 = defineComponent({
  4598. components: {
  4599. Thumb
  4600. },
  4601. props: barProps,
  4602. setup(props) {
  4603. const moveX = ref(0);
  4604. const moveY = ref(0);
  4605. const GAP = 4;
  4606. const handleScroll = (wrap) => {
  4607. if (wrap) {
  4608. const offsetHeight = wrap.offsetHeight - GAP;
  4609. const offsetWidth = wrap.offsetWidth - GAP;
  4610. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  4611. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  4612. }
  4613. };
  4614. return {
  4615. handleScroll,
  4616. moveX,
  4617. moveY
  4618. };
  4619. }
  4620. });
  4621. function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
  4622. const _component_thumb = resolveComponent("thumb");
  4623. return openBlock(), createElementBlock(Fragment, null, [
  4624. createVNode(_component_thumb, {
  4625. move: _ctx.moveX,
  4626. ratio: _ctx.ratioX,
  4627. size: _ctx.width,
  4628. always: _ctx.always
  4629. }, null, 8, ["move", "ratio", "size", "always"]),
  4630. createVNode(_component_thumb, {
  4631. move: _ctx.moveY,
  4632. ratio: _ctx.ratioY,
  4633. size: _ctx.height,
  4634. vertical: "",
  4635. always: _ctx.always
  4636. }, null, 8, ["move", "ratio", "size", "always"])
  4637. ], 64);
  4638. }
  4639. var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$17, [["render", _sfc_render$F], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
  4640. const scrollbarProps = buildProps({
  4641. height: {
  4642. type: [String, Number],
  4643. default: ""
  4644. },
  4645. maxHeight: {
  4646. type: [String, Number],
  4647. default: ""
  4648. },
  4649. native: {
  4650. type: Boolean,
  4651. default: false
  4652. },
  4653. wrapStyle: {
  4654. type: definePropType([String, Object, Array]),
  4655. default: ""
  4656. },
  4657. wrapClass: {
  4658. type: [String, Array],
  4659. default: ""
  4660. },
  4661. viewClass: {
  4662. type: [String, Array],
  4663. default: ""
  4664. },
  4665. viewStyle: {
  4666. type: [String, Array, Object],
  4667. default: ""
  4668. },
  4669. noresize: Boolean,
  4670. tag: {
  4671. type: String,
  4672. default: "div"
  4673. },
  4674. always: {
  4675. type: Boolean,
  4676. default: false
  4677. },
  4678. minSize: {
  4679. type: Number,
  4680. default: 20
  4681. }
  4682. });
  4683. const scrollbarEmits = {
  4684. scroll: ({
  4685. scrollTop,
  4686. scrollLeft
  4687. }) => isNumber(scrollTop) && isNumber(scrollLeft)
  4688. };
  4689. const _sfc_main$16 = defineComponent({
  4690. name: "ElScrollbar",
  4691. components: {
  4692. Bar
  4693. },
  4694. props: scrollbarProps,
  4695. emits: scrollbarEmits,
  4696. setup(props, { emit }) {
  4697. const ns = useNamespace("scrollbar");
  4698. let stopResizeObserver = void 0;
  4699. let stopResizeListener = void 0;
  4700. const scrollbar$ = ref();
  4701. const wrap$ = ref();
  4702. const resize$ = ref();
  4703. const sizeWidth = ref("0");
  4704. const sizeHeight = ref("0");
  4705. const barRef = ref();
  4706. const moveX = ref(0);
  4707. const moveY = ref(0);
  4708. const ratioY = ref(1);
  4709. const ratioX = ref(1);
  4710. const GAP = 4;
  4711. const style = computed(() => {
  4712. const style2 = {};
  4713. if (props.height)
  4714. style2.height = addUnit(props.height);
  4715. if (props.maxHeight)
  4716. style2.maxHeight = addUnit(props.maxHeight);
  4717. return [props.wrapStyle, style2];
  4718. });
  4719. const handleScroll = () => {
  4720. var _a2;
  4721. if (wrap$.value) {
  4722. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4723. emit("scroll", {
  4724. scrollTop: wrap$.value.scrollTop,
  4725. scrollLeft: wrap$.value.scrollLeft
  4726. });
  4727. }
  4728. };
  4729. function scrollTo(arg1, arg2) {
  4730. if (isObject$1(arg1)) {
  4731. wrap$.value.scrollTo(arg1);
  4732. } else if (isNumber(arg1) && isNumber(arg2)) {
  4733. wrap$.value.scrollTo(arg1, arg2);
  4734. }
  4735. }
  4736. const setScrollTop = (value) => {
  4737. if (!isNumber(value)) {
  4738. return;
  4739. }
  4740. wrap$.value.scrollTop = value;
  4741. };
  4742. const setScrollLeft = (value) => {
  4743. if (!isNumber(value)) {
  4744. return;
  4745. }
  4746. wrap$.value.scrollLeft = value;
  4747. };
  4748. const update = () => {
  4749. if (!wrap$.value)
  4750. return;
  4751. const offsetHeight = wrap$.value.offsetHeight - GAP;
  4752. const offsetWidth = wrap$.value.offsetWidth - GAP;
  4753. const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight;
  4754. const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth;
  4755. const height = Math.max(originalHeight, props.minSize);
  4756. const width = Math.max(originalWidth, props.minSize);
  4757. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  4758. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  4759. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  4760. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  4761. };
  4762. watch(() => props.noresize, (noresize) => {
  4763. if (noresize) {
  4764. stopResizeObserver == null ? void 0 : stopResizeObserver();
  4765. stopResizeListener == null ? void 0 : stopResizeListener();
  4766. } else {
  4767. ({ stop: stopResizeObserver } = useResizeObserver(resize$, update));
  4768. stopResizeListener = useEventListener("resize", update);
  4769. }
  4770. }, { immediate: true });
  4771. watch(() => [props.maxHeight, props.height], () => {
  4772. if (!props.native)
  4773. nextTick(() => {
  4774. var _a2;
  4775. update();
  4776. if (wrap$.value) {
  4777. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrap$.value);
  4778. }
  4779. });
  4780. });
  4781. provide(scrollbarContextKey, reactive({
  4782. scrollbarElement: scrollbar$,
  4783. wrapElement: wrap$
  4784. }));
  4785. onMounted(() => {
  4786. if (!props.native)
  4787. nextTick(() => update());
  4788. });
  4789. onUpdated(() => update());
  4790. return {
  4791. ns,
  4792. scrollbar$,
  4793. wrap$,
  4794. resize$,
  4795. barRef,
  4796. moveX,
  4797. moveY,
  4798. ratioX,
  4799. ratioY,
  4800. sizeWidth,
  4801. sizeHeight,
  4802. style,
  4803. update,
  4804. handleScroll,
  4805. scrollTo,
  4806. setScrollTop,
  4807. setScrollLeft
  4808. };
  4809. }
  4810. });
  4811. function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
  4812. const _component_bar = resolveComponent("bar");
  4813. return openBlock(), createElementBlock("div", {
  4814. ref: "scrollbar$",
  4815. class: normalizeClass(_ctx.ns.b())
  4816. }, [
  4817. createElementVNode("div", {
  4818. ref: "wrap$",
  4819. class: normalizeClass([
  4820. _ctx.wrapClass,
  4821. _ctx.ns.e("wrap"),
  4822. { [_ctx.ns.em("wrap", "hidden-default")]: !_ctx.native }
  4823. ]),
  4824. style: normalizeStyle(_ctx.style),
  4825. onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
  4826. }, [
  4827. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  4828. ref: "resize$",
  4829. class: normalizeClass([_ctx.ns.e("view"), _ctx.viewClass]),
  4830. style: normalizeStyle(_ctx.viewStyle)
  4831. }, {
  4832. default: withCtx(() => [
  4833. renderSlot(_ctx.$slots, "default")
  4834. ]),
  4835. _: 3
  4836. }, 8, ["class", "style"]))
  4837. ], 38),
  4838. !_ctx.native ? (openBlock(), createBlock(_component_bar, {
  4839. key: 0,
  4840. ref: "barRef",
  4841. height: _ctx.sizeHeight,
  4842. width: _ctx.sizeWidth,
  4843. always: _ctx.always,
  4844. "ratio-x": _ctx.ratioX,
  4845. "ratio-y": _ctx.ratioY
  4846. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
  4847. ], 2);
  4848. }
  4849. var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$16, [["render", _sfc_render$E], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
  4850. const ElScrollbar = withInstall(Scrollbar);
  4851. const __default__$j = {
  4852. name: "ElPopperRoot",
  4853. inheritAttrs: false
  4854. };
  4855. const _sfc_main$15 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$j), {
  4856. setup(__props, { expose }) {
  4857. const triggerRef2 = ref();
  4858. const popperInstanceRef = ref();
  4859. const contentRef = ref();
  4860. const referenceRef = ref();
  4861. const popperProvides = {
  4862. triggerRef: triggerRef2,
  4863. popperInstanceRef,
  4864. contentRef,
  4865. referenceRef
  4866. };
  4867. expose(popperProvides);
  4868. provide(POPPER_INJECTION_KEY, popperProvides);
  4869. return (_ctx, _cache) => {
  4870. return renderSlot(_ctx.$slots, "default");
  4871. };
  4872. }
  4873. }));
  4874. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$15, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
  4875. const usePopperArrowProps = buildProps({
  4876. arrowOffset: {
  4877. type: Number,
  4878. default: 5
  4879. }
  4880. });
  4881. const __default__$i = {
  4882. name: "ElPopperArrow",
  4883. inheritAttrs: false
  4884. };
  4885. const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$i), {
  4886. props: usePopperArrowProps,
  4887. setup(__props, { expose }) {
  4888. const props = __props;
  4889. const ns = useNamespace("popper");
  4890. const { arrowOffset, arrowRef } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  4891. watch(() => props.arrowOffset, (val) => {
  4892. arrowOffset.value = val;
  4893. });
  4894. onBeforeUnmount(() => {
  4895. arrowRef.value = void 0;
  4896. });
  4897. expose({
  4898. arrowRef
  4899. });
  4900. return (_ctx, _cache) => {
  4901. return openBlock(), createElementBlock("span", {
  4902. ref_key: "arrowRef",
  4903. ref: arrowRef,
  4904. class: normalizeClass(unref(ns).e("arrow")),
  4905. "data-popper-arrow": ""
  4906. }, null, 2);
  4907. };
  4908. }
  4909. }));
  4910. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$14, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
  4911. const NAME = "ElOnlyChild";
  4912. const OnlyChild = defineComponent({
  4913. name: NAME,
  4914. setup(_2, {
  4915. slots,
  4916. attrs
  4917. }) {
  4918. var _a2;
  4919. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  4920. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  4921. return () => {
  4922. var _a22;
  4923. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  4924. if (!defaultSlot)
  4925. return null;
  4926. if (defaultSlot.length > 1) {
  4927. return null;
  4928. }
  4929. const firstLegitNode = findFirstLegitChild(defaultSlot);
  4930. if (!firstLegitNode) {
  4931. return null;
  4932. }
  4933. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  4934. };
  4935. }
  4936. });
  4937. function findFirstLegitChild(node) {
  4938. if (!node)
  4939. return null;
  4940. const children = node;
  4941. for (const child of children) {
  4942. if (isObject$1(child)) {
  4943. switch (child.type) {
  4944. case Comment:
  4945. continue;
  4946. case Text:
  4947. return wrapTextContent(child);
  4948. case "svg":
  4949. return wrapTextContent(child);
  4950. case Fragment:
  4951. return findFirstLegitChild(child.children);
  4952. default:
  4953. return child;
  4954. }
  4955. }
  4956. return wrapTextContent(child);
  4957. }
  4958. return null;
  4959. }
  4960. function wrapTextContent(s2) {
  4961. return createVNode("span", {
  4962. "class": "el-only-child__content"
  4963. }, [s2]);
  4964. }
  4965. const usePopperTriggerProps = buildProps({
  4966. virtualRef: {
  4967. type: definePropType(Object)
  4968. },
  4969. virtualTriggering: Boolean,
  4970. onMouseenter: Function,
  4971. onMouseleave: Function,
  4972. onClick: Function,
  4973. onKeydown: Function,
  4974. onFocus: Function,
  4975. onBlur: Function,
  4976. onContextmenu: Function,
  4977. id: String,
  4978. open: Boolean
  4979. });
  4980. const __default__$h = {
  4981. name: "ElPopperTrigger",
  4982. inheritAttrs: false
  4983. };
  4984. const _sfc_main$13 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$h), {
  4985. props: usePopperTriggerProps,
  4986. setup(__props, { expose }) {
  4987. const props = __props;
  4988. const { triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  4989. useForwardRef(triggerRef2);
  4990. onMounted(() => {
  4991. watch(() => props.virtualRef, (virtualEl) => {
  4992. if (virtualEl) {
  4993. triggerRef2.value = unrefElement(virtualEl);
  4994. }
  4995. }, {
  4996. immediate: true
  4997. });
  4998. watch(() => triggerRef2.value, (el, prevEl) => {
  4999. if (isElement$1(el)) {
  5000. [
  5001. "onMouseenter",
  5002. "onMouseleave",
  5003. "onClick",
  5004. "onKeydown",
  5005. "onFocus",
  5006. "onBlur",
  5007. "onContextmenu"
  5008. ].forEach((eventName) => {
  5009. var _a2;
  5010. const handler3 = props[eventName];
  5011. if (handler3) {
  5012. el.addEventListener(eventName.slice(2).toLowerCase(), handler3);
  5013. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler3);
  5014. }
  5015. });
  5016. }
  5017. }, {
  5018. immediate: true
  5019. });
  5020. });
  5021. expose({
  5022. triggerRef: triggerRef2
  5023. });
  5024. return (_ctx, _cache) => {
  5025. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  5026. "aria-describedby": _ctx.open ? _ctx.id : void 0
  5027. }), {
  5028. default: withCtx(() => [
  5029. renderSlot(_ctx.$slots, "default")
  5030. ]),
  5031. _: 3
  5032. }, 16, ["aria-describedby"])) : createCommentVNode("v-if", true);
  5033. };
  5034. }
  5035. }));
  5036. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$13, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
  5037. var top = "top";
  5038. var bottom = "bottom";
  5039. var right = "right";
  5040. var left = "left";
  5041. var auto = "auto";
  5042. var basePlacements = [top, bottom, right, left];
  5043. var start = "start";
  5044. var end = "end";
  5045. var clippingParents = "clippingParents";
  5046. var viewport = "viewport";
  5047. var popper = "popper";
  5048. var reference = "reference";
  5049. var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
  5050. return acc.concat([placement + "-" + start, placement + "-" + end]);
  5051. }, []);
  5052. var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
  5053. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  5054. }, []);
  5055. var beforeRead = "beforeRead";
  5056. var read = "read";
  5057. var afterRead = "afterRead";
  5058. var beforeMain = "beforeMain";
  5059. var main = "main";
  5060. var afterMain = "afterMain";
  5061. var beforeWrite = "beforeWrite";
  5062. var write = "write";
  5063. var afterWrite = "afterWrite";
  5064. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  5065. function getNodeName(element) {
  5066. return element ? (element.nodeName || "").toLowerCase() : null;
  5067. }
  5068. function getWindow(node) {
  5069. if (node == null) {
  5070. return window;
  5071. }
  5072. if (node.toString() !== "[object Window]") {
  5073. var ownerDocument = node.ownerDocument;
  5074. return ownerDocument ? ownerDocument.defaultView || window : window;
  5075. }
  5076. return node;
  5077. }
  5078. function isElement(node) {
  5079. var OwnElement = getWindow(node).Element;
  5080. return node instanceof OwnElement || node instanceof Element;
  5081. }
  5082. function isHTMLElement(node) {
  5083. var OwnElement = getWindow(node).HTMLElement;
  5084. return node instanceof OwnElement || node instanceof HTMLElement;
  5085. }
  5086. function isShadowRoot(node) {
  5087. if (typeof ShadowRoot === "undefined") {
  5088. return false;
  5089. }
  5090. var OwnElement = getWindow(node).ShadowRoot;
  5091. return node instanceof OwnElement || node instanceof ShadowRoot;
  5092. }
  5093. function applyStyles(_ref) {
  5094. var state = _ref.state;
  5095. Object.keys(state.elements).forEach(function(name) {
  5096. var style = state.styles[name] || {};
  5097. var attributes = state.attributes[name] || {};
  5098. var element = state.elements[name];
  5099. if (!isHTMLElement(element) || !getNodeName(element)) {
  5100. return;
  5101. }
  5102. Object.assign(element.style, style);
  5103. Object.keys(attributes).forEach(function(name2) {
  5104. var value = attributes[name2];
  5105. if (value === false) {
  5106. element.removeAttribute(name2);
  5107. } else {
  5108. element.setAttribute(name2, value === true ? "" : value);
  5109. }
  5110. });
  5111. });
  5112. }
  5113. function effect$2(_ref2) {
  5114. var state = _ref2.state;
  5115. var initialStyles = {
  5116. popper: {
  5117. position: state.options.strategy,
  5118. left: "0",
  5119. top: "0",
  5120. margin: "0"
  5121. },
  5122. arrow: {
  5123. position: "absolute"
  5124. },
  5125. reference: {}
  5126. };
  5127. Object.assign(state.elements.popper.style, initialStyles.popper);
  5128. state.styles = initialStyles;
  5129. if (state.elements.arrow) {
  5130. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  5131. }
  5132. return function() {
  5133. Object.keys(state.elements).forEach(function(name) {
  5134. var element = state.elements[name];
  5135. var attributes = state.attributes[name] || {};
  5136. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
  5137. var style = styleProperties.reduce(function(style2, property) {
  5138. style2[property] = "";
  5139. return style2;
  5140. }, {});
  5141. if (!isHTMLElement(element) || !getNodeName(element)) {
  5142. return;
  5143. }
  5144. Object.assign(element.style, style);
  5145. Object.keys(attributes).forEach(function(attribute) {
  5146. element.removeAttribute(attribute);
  5147. });
  5148. });
  5149. };
  5150. }
  5151. var applyStyles$1 = {
  5152. name: "applyStyles",
  5153. enabled: true,
  5154. phase: "write",
  5155. fn: applyStyles,
  5156. effect: effect$2,
  5157. requires: ["computeStyles"]
  5158. };
  5159. function getBasePlacement(placement) {
  5160. return placement.split("-")[0];
  5161. }
  5162. var max = Math.max;
  5163. var min = Math.min;
  5164. var round = Math.round;
  5165. function getUAString() {
  5166. var uaData = navigator.userAgentData;
  5167. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  5168. return uaData.brands.map(function(item) {
  5169. return item.brand + "/" + item.version;
  5170. }).join(" ");
  5171. }
  5172. return navigator.userAgent;
  5173. }
  5174. function isLayoutViewport() {
  5175. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  5176. }
  5177. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  5178. if (includeScale === void 0) {
  5179. includeScale = false;
  5180. }
  5181. if (isFixedStrategy === void 0) {
  5182. isFixedStrategy = false;
  5183. }
  5184. var clientRect = element.getBoundingClientRect();
  5185. var scaleX = 1;
  5186. var scaleY = 1;
  5187. if (includeScale && isHTMLElement(element)) {
  5188. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  5189. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  5190. }
  5191. var _ref = isElement(element) ? getWindow(element) : window, visualViewport = _ref.visualViewport;
  5192. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  5193. var x2 = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  5194. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  5195. var width = clientRect.width / scaleX;
  5196. var height = clientRect.height / scaleY;
  5197. return {
  5198. width,
  5199. height,
  5200. top: y,
  5201. right: x2 + width,
  5202. bottom: y + height,
  5203. left: x2,
  5204. x: x2,
  5205. y
  5206. };
  5207. }
  5208. function getLayoutRect(element) {
  5209. var clientRect = getBoundingClientRect(element);
  5210. var width = element.offsetWidth;
  5211. var height = element.offsetHeight;
  5212. if (Math.abs(clientRect.width - width) <= 1) {
  5213. width = clientRect.width;
  5214. }
  5215. if (Math.abs(clientRect.height - height) <= 1) {
  5216. height = clientRect.height;
  5217. }
  5218. return {
  5219. x: element.offsetLeft,
  5220. y: element.offsetTop,
  5221. width,
  5222. height
  5223. };
  5224. }
  5225. function contains(parent, child) {
  5226. var rootNode = child.getRootNode && child.getRootNode();
  5227. if (parent.contains(child)) {
  5228. return true;
  5229. } else if (rootNode && isShadowRoot(rootNode)) {
  5230. var next = child;
  5231. do {
  5232. if (next && parent.isSameNode(next)) {
  5233. return true;
  5234. }
  5235. next = next.parentNode || next.host;
  5236. } while (next);
  5237. }
  5238. return false;
  5239. }
  5240. function getComputedStyle$1(element) {
  5241. return getWindow(element).getComputedStyle(element);
  5242. }
  5243. function isTableElement(element) {
  5244. return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
  5245. }
  5246. function getDocumentElement(element) {
  5247. return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
  5248. }
  5249. function getParentNode(element) {
  5250. if (getNodeName(element) === "html") {
  5251. return element;
  5252. }
  5253. return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
  5254. }
  5255. function getTrueOffsetParent(element) {
  5256. if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
  5257. return null;
  5258. }
  5259. return element.offsetParent;
  5260. }
  5261. function getContainingBlock(element) {
  5262. var isFirefox2 = /firefox/i.test(getUAString());
  5263. var isIE = /Trident/i.test(getUAString());
  5264. if (isIE && isHTMLElement(element)) {
  5265. var elementCss = getComputedStyle$1(element);
  5266. if (elementCss.position === "fixed") {
  5267. return null;
  5268. }
  5269. }
  5270. var currentNode = getParentNode(element);
  5271. if (isShadowRoot(currentNode)) {
  5272. currentNode = currentNode.host;
  5273. }
  5274. while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
  5275. var css = getComputedStyle$1(currentNode);
  5276. 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") {
  5277. return currentNode;
  5278. } else {
  5279. currentNode = currentNode.parentNode;
  5280. }
  5281. }
  5282. return null;
  5283. }
  5284. function getOffsetParent(element) {
  5285. var window2 = getWindow(element);
  5286. var offsetParent = getTrueOffsetParent(element);
  5287. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
  5288. offsetParent = getTrueOffsetParent(offsetParent);
  5289. }
  5290. if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
  5291. return window2;
  5292. }
  5293. return offsetParent || getContainingBlock(element) || window2;
  5294. }
  5295. function getMainAxisFromPlacement(placement) {
  5296. return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
  5297. }
  5298. function within(min$1, value, max$1) {
  5299. return max(min$1, min(value, max$1));
  5300. }
  5301. function withinMaxClamp(min2, value, max2) {
  5302. var v2 = within(min2, value, max2);
  5303. return v2 > max2 ? max2 : v2;
  5304. }
  5305. function getFreshSideObject() {
  5306. return {
  5307. top: 0,
  5308. right: 0,
  5309. bottom: 0,
  5310. left: 0
  5311. };
  5312. }
  5313. function mergePaddingObject(paddingObject) {
  5314. return Object.assign({}, getFreshSideObject(), paddingObject);
  5315. }
  5316. function expandToHashMap(value, keys2) {
  5317. return keys2.reduce(function(hashMap, key) {
  5318. hashMap[key] = value;
  5319. return hashMap;
  5320. }, {});
  5321. }
  5322. var toPaddingObject = function toPaddingObject2(padding, state) {
  5323. padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
  5324. placement: state.placement
  5325. })) : padding;
  5326. return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5327. };
  5328. function arrow(_ref) {
  5329. var _state$modifiersData$;
  5330. var state = _ref.state, name = _ref.name, options = _ref.options;
  5331. var arrowElement = state.elements.arrow;
  5332. var popperOffsets2 = state.modifiersData.popperOffsets;
  5333. var basePlacement = getBasePlacement(state.placement);
  5334. var axis = getMainAxisFromPlacement(basePlacement);
  5335. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  5336. var len = isVertical ? "height" : "width";
  5337. if (!arrowElement || !popperOffsets2) {
  5338. return;
  5339. }
  5340. var paddingObject = toPaddingObject(options.padding, state);
  5341. var arrowRect = getLayoutRect(arrowElement);
  5342. var minProp = axis === "y" ? top : left;
  5343. var maxProp = axis === "y" ? bottom : right;
  5344. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
  5345. var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
  5346. var arrowOffsetParent = getOffsetParent(arrowElement);
  5347. var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  5348. var centerToReference = endDiff / 2 - startDiff / 2;
  5349. var min2 = paddingObject[minProp];
  5350. var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
  5351. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  5352. var offset2 = within(min2, center, max2);
  5353. var axisProp = axis;
  5354. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
  5355. }
  5356. function effect$1(_ref2) {
  5357. var state = _ref2.state, options = _ref2.options;
  5358. var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
  5359. if (arrowElement == null) {
  5360. return;
  5361. }
  5362. if (typeof arrowElement === "string") {
  5363. arrowElement = state.elements.popper.querySelector(arrowElement);
  5364. if (!arrowElement) {
  5365. return;
  5366. }
  5367. }
  5368. if (!contains(state.elements.popper, arrowElement)) {
  5369. return;
  5370. }
  5371. state.elements.arrow = arrowElement;
  5372. }
  5373. var arrow$1 = {
  5374. name: "arrow",
  5375. enabled: true,
  5376. phase: "main",
  5377. fn: arrow,
  5378. effect: effect$1,
  5379. requires: ["popperOffsets"],
  5380. requiresIfExists: ["preventOverflow"]
  5381. };
  5382. function getVariation(placement) {
  5383. return placement.split("-")[1];
  5384. }
  5385. var unsetSides = {
  5386. top: "auto",
  5387. right: "auto",
  5388. bottom: "auto",
  5389. left: "auto"
  5390. };
  5391. function roundOffsetsByDPR(_ref, win) {
  5392. var x2 = _ref.x, y = _ref.y;
  5393. var dpr = win.devicePixelRatio || 1;
  5394. return {
  5395. x: round(x2 * dpr) / dpr || 0,
  5396. y: round(y * dpr) / dpr || 0
  5397. };
  5398. }
  5399. function mapToStyles(_ref2) {
  5400. var _Object$assign2;
  5401. 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;
  5402. 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;
  5403. var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
  5404. x: x2,
  5405. y
  5406. }) : {
  5407. x: x2,
  5408. y
  5409. };
  5410. x2 = _ref3.x;
  5411. y = _ref3.y;
  5412. var hasX = offsets.hasOwnProperty("x");
  5413. var hasY = offsets.hasOwnProperty("y");
  5414. var sideX = left;
  5415. var sideY = top;
  5416. var win = window;
  5417. if (adaptive) {
  5418. var offsetParent = getOffsetParent(popper2);
  5419. var heightProp = "clientHeight";
  5420. var widthProp = "clientWidth";
  5421. if (offsetParent === getWindow(popper2)) {
  5422. offsetParent = getDocumentElement(popper2);
  5423. if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
  5424. heightProp = "scrollHeight";
  5425. widthProp = "scrollWidth";
  5426. }
  5427. }
  5428. offsetParent = offsetParent;
  5429. if (placement === top || (placement === left || placement === right) && variation === end) {
  5430. sideY = bottom;
  5431. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
  5432. y -= offsetY - popperRect.height;
  5433. y *= gpuAcceleration ? 1 : -1;
  5434. }
  5435. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  5436. sideX = right;
  5437. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
  5438. x2 -= offsetX - popperRect.width;
  5439. x2 *= gpuAcceleration ? 1 : -1;
  5440. }
  5441. }
  5442. var commonStyles = Object.assign({
  5443. position
  5444. }, adaptive && unsetSides);
  5445. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  5446. x: x2,
  5447. y
  5448. }, getWindow(popper2)) : {
  5449. x: x2,
  5450. y
  5451. };
  5452. x2 = _ref4.x;
  5453. y = _ref4.y;
  5454. if (gpuAcceleration) {
  5455. var _Object$assign;
  5456. 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));
  5457. }
  5458. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x2 + "px" : "", _Object$assign2.transform = "", _Object$assign2));
  5459. }
  5460. function computeStyles(_ref5) {
  5461. var state = _ref5.state, options = _ref5.options;
  5462. 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;
  5463. var commonStyles = {
  5464. placement: getBasePlacement(state.placement),
  5465. variation: getVariation(state.placement),
  5466. popper: state.elements.popper,
  5467. popperRect: state.rects.popper,
  5468. gpuAcceleration,
  5469. isFixed: state.options.strategy === "fixed"
  5470. };
  5471. if (state.modifiersData.popperOffsets != null) {
  5472. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  5473. offsets: state.modifiersData.popperOffsets,
  5474. position: state.options.strategy,
  5475. adaptive,
  5476. roundOffsets
  5477. })));
  5478. }
  5479. if (state.modifiersData.arrow != null) {
  5480. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  5481. offsets: state.modifiersData.arrow,
  5482. position: "absolute",
  5483. adaptive: false,
  5484. roundOffsets
  5485. })));
  5486. }
  5487. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5488. "data-popper-placement": state.placement
  5489. });
  5490. }
  5491. var computeStyles$1 = {
  5492. name: "computeStyles",
  5493. enabled: true,
  5494. phase: "beforeWrite",
  5495. fn: computeStyles,
  5496. data: {}
  5497. };
  5498. var passive = {
  5499. passive: true
  5500. };
  5501. function effect(_ref) {
  5502. var state = _ref.state, instance = _ref.instance, options = _ref.options;
  5503. 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;
  5504. var window2 = getWindow(state.elements.popper);
  5505. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  5506. if (scroll) {
  5507. scrollParents.forEach(function(scrollParent) {
  5508. scrollParent.addEventListener("scroll", instance.update, passive);
  5509. });
  5510. }
  5511. if (resize) {
  5512. window2.addEventListener("resize", instance.update, passive);
  5513. }
  5514. return function() {
  5515. if (scroll) {
  5516. scrollParents.forEach(function(scrollParent) {
  5517. scrollParent.removeEventListener("scroll", instance.update, passive);
  5518. });
  5519. }
  5520. if (resize) {
  5521. window2.removeEventListener("resize", instance.update, passive);
  5522. }
  5523. };
  5524. }
  5525. var eventListeners = {
  5526. name: "eventListeners",
  5527. enabled: true,
  5528. phase: "write",
  5529. fn: function fn() {
  5530. },
  5531. effect,
  5532. data: {}
  5533. };
  5534. var hash$1 = {
  5535. left: "right",
  5536. right: "left",
  5537. bottom: "top",
  5538. top: "bottom"
  5539. };
  5540. function getOppositePlacement(placement) {
  5541. return placement.replace(/left|right|bottom|top/g, function(matched) {
  5542. return hash$1[matched];
  5543. });
  5544. }
  5545. var hash = {
  5546. start: "end",
  5547. end: "start"
  5548. };
  5549. function getOppositeVariationPlacement(placement) {
  5550. return placement.replace(/start|end/g, function(matched) {
  5551. return hash[matched];
  5552. });
  5553. }
  5554. function getWindowScroll(node) {
  5555. var win = getWindow(node);
  5556. var scrollLeft = win.pageXOffset;
  5557. var scrollTop = win.pageYOffset;
  5558. return {
  5559. scrollLeft,
  5560. scrollTop
  5561. };
  5562. }
  5563. function getWindowScrollBarX(element) {
  5564. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  5565. }
  5566. function getViewportRect(element, strategy) {
  5567. var win = getWindow(element);
  5568. var html = getDocumentElement(element);
  5569. var visualViewport = win.visualViewport;
  5570. var width = html.clientWidth;
  5571. var height = html.clientHeight;
  5572. var x2 = 0;
  5573. var y = 0;
  5574. if (visualViewport) {
  5575. width = visualViewport.width;
  5576. height = visualViewport.height;
  5577. var layoutViewport = isLayoutViewport();
  5578. if (layoutViewport || !layoutViewport && strategy === "fixed") {
  5579. x2 = visualViewport.offsetLeft;
  5580. y = visualViewport.offsetTop;
  5581. }
  5582. }
  5583. return {
  5584. width,
  5585. height,
  5586. x: x2 + getWindowScrollBarX(element),
  5587. y
  5588. };
  5589. }
  5590. function getDocumentRect(element) {
  5591. var _element$ownerDocumen;
  5592. var html = getDocumentElement(element);
  5593. var winScroll = getWindowScroll(element);
  5594. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  5595. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  5596. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  5597. var x2 = -winScroll.scrollLeft + getWindowScrollBarX(element);
  5598. var y = -winScroll.scrollTop;
  5599. if (getComputedStyle$1(body || html).direction === "rtl") {
  5600. x2 += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  5601. }
  5602. return {
  5603. width,
  5604. height,
  5605. x: x2,
  5606. y
  5607. };
  5608. }
  5609. function isScrollParent(element) {
  5610. var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
  5611. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  5612. }
  5613. function getScrollParent(node) {
  5614. if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
  5615. return node.ownerDocument.body;
  5616. }
  5617. if (isHTMLElement(node) && isScrollParent(node)) {
  5618. return node;
  5619. }
  5620. return getScrollParent(getParentNode(node));
  5621. }
  5622. function listScrollParents(element, list) {
  5623. var _element$ownerDocumen;
  5624. if (list === void 0) {
  5625. list = [];
  5626. }
  5627. var scrollParent = getScrollParent(element);
  5628. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  5629. var win = getWindow(scrollParent);
  5630. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  5631. var updatedList = list.concat(target);
  5632. return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
  5633. }
  5634. function rectToClientRect(rect) {
  5635. return Object.assign({}, rect, {
  5636. left: rect.x,
  5637. top: rect.y,
  5638. right: rect.x + rect.width,
  5639. bottom: rect.y + rect.height
  5640. });
  5641. }
  5642. function getInnerBoundingClientRect(element, strategy) {
  5643. var rect = getBoundingClientRect(element, false, strategy === "fixed");
  5644. rect.top = rect.top + element.clientTop;
  5645. rect.left = rect.left + element.clientLeft;
  5646. rect.bottom = rect.top + element.clientHeight;
  5647. rect.right = rect.left + element.clientWidth;
  5648. rect.width = element.clientWidth;
  5649. rect.height = element.clientHeight;
  5650. rect.x = rect.left;
  5651. rect.y = rect.top;
  5652. return rect;
  5653. }
  5654. function getClientRectFromMixedType(element, clippingParent, strategy) {
  5655. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  5656. }
  5657. function getClippingParents(element) {
  5658. var clippingParents2 = listScrollParents(getParentNode(element));
  5659. var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$1(element).position) >= 0;
  5660. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  5661. if (!isElement(clipperElement)) {
  5662. return [];
  5663. }
  5664. return clippingParents2.filter(function(clippingParent) {
  5665. return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
  5666. });
  5667. }
  5668. function getClippingRect(element, boundary, rootBoundary, strategy) {
  5669. var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
  5670. var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
  5671. var firstClippingParent = clippingParents2[0];
  5672. var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
  5673. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  5674. accRect.top = max(rect.top, accRect.top);
  5675. accRect.right = min(rect.right, accRect.right);
  5676. accRect.bottom = min(rect.bottom, accRect.bottom);
  5677. accRect.left = max(rect.left, accRect.left);
  5678. return accRect;
  5679. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  5680. clippingRect.width = clippingRect.right - clippingRect.left;
  5681. clippingRect.height = clippingRect.bottom - clippingRect.top;
  5682. clippingRect.x = clippingRect.left;
  5683. clippingRect.y = clippingRect.top;
  5684. return clippingRect;
  5685. }
  5686. function computeOffsets(_ref) {
  5687. var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
  5688. var basePlacement = placement ? getBasePlacement(placement) : null;
  5689. var variation = placement ? getVariation(placement) : null;
  5690. var commonX = reference2.x + reference2.width / 2 - element.width / 2;
  5691. var commonY = reference2.y + reference2.height / 2 - element.height / 2;
  5692. var offsets;
  5693. switch (basePlacement) {
  5694. case top:
  5695. offsets = {
  5696. x: commonX,
  5697. y: reference2.y - element.height
  5698. };
  5699. break;
  5700. case bottom:
  5701. offsets = {
  5702. x: commonX,
  5703. y: reference2.y + reference2.height
  5704. };
  5705. break;
  5706. case right:
  5707. offsets = {
  5708. x: reference2.x + reference2.width,
  5709. y: commonY
  5710. };
  5711. break;
  5712. case left:
  5713. offsets = {
  5714. x: reference2.x - element.width,
  5715. y: commonY
  5716. };
  5717. break;
  5718. default:
  5719. offsets = {
  5720. x: reference2.x,
  5721. y: reference2.y
  5722. };
  5723. }
  5724. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  5725. if (mainAxis != null) {
  5726. var len = mainAxis === "y" ? "height" : "width";
  5727. switch (variation) {
  5728. case start:
  5729. offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
  5730. break;
  5731. case end:
  5732. offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
  5733. break;
  5734. }
  5735. }
  5736. return offsets;
  5737. }
  5738. function detectOverflow(state, options) {
  5739. if (options === void 0) {
  5740. options = {};
  5741. }
  5742. var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
  5743. var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
  5744. var altContext = elementContext === popper ? reference : popper;
  5745. var popperRect = state.rects.popper;
  5746. var element = state.elements[altBoundary ? altContext : elementContext];
  5747. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  5748. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  5749. var popperOffsets2 = computeOffsets({
  5750. reference: referenceClientRect,
  5751. element: popperRect,
  5752. strategy: "absolute",
  5753. placement
  5754. });
  5755. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
  5756. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
  5757. var overflowOffsets = {
  5758. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  5759. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  5760. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  5761. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  5762. };
  5763. var offsetData = state.modifiersData.offset;
  5764. if (elementContext === popper && offsetData) {
  5765. var offset2 = offsetData[placement];
  5766. Object.keys(overflowOffsets).forEach(function(key) {
  5767. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  5768. var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
  5769. overflowOffsets[key] += offset2[axis] * multiply;
  5770. });
  5771. }
  5772. return overflowOffsets;
  5773. }
  5774. function computeAutoPlacement(state, options) {
  5775. if (options === void 0) {
  5776. options = {};
  5777. }
  5778. 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;
  5779. var variation = getVariation(placement);
  5780. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
  5781. return getVariation(placement2) === variation;
  5782. }) : basePlacements;
  5783. var allowedPlacements = placements$1.filter(function(placement2) {
  5784. return allowedAutoPlacements.indexOf(placement2) >= 0;
  5785. });
  5786. if (allowedPlacements.length === 0) {
  5787. allowedPlacements = placements$1;
  5788. }
  5789. var overflows = allowedPlacements.reduce(function(acc, placement2) {
  5790. acc[placement2] = detectOverflow(state, {
  5791. placement: placement2,
  5792. boundary,
  5793. rootBoundary,
  5794. padding
  5795. })[getBasePlacement(placement2)];
  5796. return acc;
  5797. }, {});
  5798. return Object.keys(overflows).sort(function(a2, b2) {
  5799. return overflows[a2] - overflows[b2];
  5800. });
  5801. }
  5802. function getExpandedFallbackPlacements(placement) {
  5803. if (getBasePlacement(placement) === auto) {
  5804. return [];
  5805. }
  5806. var oppositePlacement = getOppositePlacement(placement);
  5807. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  5808. }
  5809. function flip(_ref) {
  5810. var state = _ref.state, options = _ref.options, name = _ref.name;
  5811. if (state.modifiersData[name]._skip) {
  5812. return;
  5813. }
  5814. 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;
  5815. var preferredPlacement = state.options.placement;
  5816. var basePlacement = getBasePlacement(preferredPlacement);
  5817. var isBasePlacement = basePlacement === preferredPlacement;
  5818. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  5819. var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
  5820. return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
  5821. placement: placement2,
  5822. boundary,
  5823. rootBoundary,
  5824. padding,
  5825. flipVariations,
  5826. allowedAutoPlacements
  5827. }) : placement2);
  5828. }, []);
  5829. var referenceRect = state.rects.reference;
  5830. var popperRect = state.rects.popper;
  5831. var checksMap = /* @__PURE__ */ new Map();
  5832. var makeFallbackChecks = true;
  5833. var firstFittingPlacement = placements2[0];
  5834. for (var i = 0; i < placements2.length; i++) {
  5835. var placement = placements2[i];
  5836. var _basePlacement = getBasePlacement(placement);
  5837. var isStartVariation = getVariation(placement) === start;
  5838. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  5839. var len = isVertical ? "width" : "height";
  5840. var overflow = detectOverflow(state, {
  5841. placement,
  5842. boundary,
  5843. rootBoundary,
  5844. altBoundary,
  5845. padding
  5846. });
  5847. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  5848. if (referenceRect[len] > popperRect[len]) {
  5849. mainVariationSide = getOppositePlacement(mainVariationSide);
  5850. }
  5851. var altVariationSide = getOppositePlacement(mainVariationSide);
  5852. var checks = [];
  5853. if (checkMainAxis) {
  5854. checks.push(overflow[_basePlacement] <= 0);
  5855. }
  5856. if (checkAltAxis) {
  5857. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  5858. }
  5859. if (checks.every(function(check2) {
  5860. return check2;
  5861. })) {
  5862. firstFittingPlacement = placement;
  5863. makeFallbackChecks = false;
  5864. break;
  5865. }
  5866. checksMap.set(placement, checks);
  5867. }
  5868. if (makeFallbackChecks) {
  5869. var numberOfChecks = flipVariations ? 3 : 1;
  5870. var _loop = function _loop2(_i2) {
  5871. var fittingPlacement = placements2.find(function(placement2) {
  5872. var checks2 = checksMap.get(placement2);
  5873. if (checks2) {
  5874. return checks2.slice(0, _i2).every(function(check2) {
  5875. return check2;
  5876. });
  5877. }
  5878. });
  5879. if (fittingPlacement) {
  5880. firstFittingPlacement = fittingPlacement;
  5881. return "break";
  5882. }
  5883. };
  5884. for (var _i = numberOfChecks; _i > 0; _i--) {
  5885. var _ret = _loop(_i);
  5886. if (_ret === "break")
  5887. break;
  5888. }
  5889. }
  5890. if (state.placement !== firstFittingPlacement) {
  5891. state.modifiersData[name]._skip = true;
  5892. state.placement = firstFittingPlacement;
  5893. state.reset = true;
  5894. }
  5895. }
  5896. var flip$1 = {
  5897. name: "flip",
  5898. enabled: true,
  5899. phase: "main",
  5900. fn: flip,
  5901. requiresIfExists: ["offset"],
  5902. data: {
  5903. _skip: false
  5904. }
  5905. };
  5906. function getSideOffsets(overflow, rect, preventedOffsets) {
  5907. if (preventedOffsets === void 0) {
  5908. preventedOffsets = {
  5909. x: 0,
  5910. y: 0
  5911. };
  5912. }
  5913. return {
  5914. top: overflow.top - rect.height - preventedOffsets.y,
  5915. right: overflow.right - rect.width + preventedOffsets.x,
  5916. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  5917. left: overflow.left - rect.width - preventedOffsets.x
  5918. };
  5919. }
  5920. function isAnySideFullyClipped(overflow) {
  5921. return [top, right, bottom, left].some(function(side) {
  5922. return overflow[side] >= 0;
  5923. });
  5924. }
  5925. function hide(_ref) {
  5926. var state = _ref.state, name = _ref.name;
  5927. var referenceRect = state.rects.reference;
  5928. var popperRect = state.rects.popper;
  5929. var preventedOffsets = state.modifiersData.preventOverflow;
  5930. var referenceOverflow = detectOverflow(state, {
  5931. elementContext: "reference"
  5932. });
  5933. var popperAltOverflow = detectOverflow(state, {
  5934. altBoundary: true
  5935. });
  5936. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  5937. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  5938. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  5939. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  5940. state.modifiersData[name] = {
  5941. referenceClippingOffsets,
  5942. popperEscapeOffsets,
  5943. isReferenceHidden,
  5944. hasPopperEscaped
  5945. };
  5946. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  5947. "data-popper-reference-hidden": isReferenceHidden,
  5948. "data-popper-escaped": hasPopperEscaped
  5949. });
  5950. }
  5951. var hide$1 = {
  5952. name: "hide",
  5953. enabled: true,
  5954. phase: "main",
  5955. requiresIfExists: ["preventOverflow"],
  5956. fn: hide
  5957. };
  5958. function distanceAndSkiddingToXY(placement, rects, offset2) {
  5959. var basePlacement = getBasePlacement(placement);
  5960. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  5961. var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
  5962. placement
  5963. })) : offset2, skidding = _ref[0], distance = _ref[1];
  5964. skidding = skidding || 0;
  5965. distance = (distance || 0) * invertDistance;
  5966. return [left, right].indexOf(basePlacement) >= 0 ? {
  5967. x: distance,
  5968. y: skidding
  5969. } : {
  5970. x: skidding,
  5971. y: distance
  5972. };
  5973. }
  5974. function offset(_ref2) {
  5975. var state = _ref2.state, options = _ref2.options, name = _ref2.name;
  5976. var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
  5977. var data2 = placements.reduce(function(acc, placement) {
  5978. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
  5979. return acc;
  5980. }, {});
  5981. var _data$state$placement = data2[state.placement], x2 = _data$state$placement.x, y = _data$state$placement.y;
  5982. if (state.modifiersData.popperOffsets != null) {
  5983. state.modifiersData.popperOffsets.x += x2;
  5984. state.modifiersData.popperOffsets.y += y;
  5985. }
  5986. state.modifiersData[name] = data2;
  5987. }
  5988. var offset$1 = {
  5989. name: "offset",
  5990. enabled: true,
  5991. phase: "main",
  5992. requires: ["popperOffsets"],
  5993. fn: offset
  5994. };
  5995. function popperOffsets(_ref) {
  5996. var state = _ref.state, name = _ref.name;
  5997. state.modifiersData[name] = computeOffsets({
  5998. reference: state.rects.reference,
  5999. element: state.rects.popper,
  6000. strategy: "absolute",
  6001. placement: state.placement
  6002. });
  6003. }
  6004. var popperOffsets$1 = {
  6005. name: "popperOffsets",
  6006. enabled: true,
  6007. phase: "read",
  6008. fn: popperOffsets,
  6009. data: {}
  6010. };
  6011. function getAltAxis(axis) {
  6012. return axis === "x" ? "y" : "x";
  6013. }
  6014. function preventOverflow(_ref) {
  6015. var state = _ref.state, options = _ref.options, name = _ref.name;
  6016. 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;
  6017. var overflow = detectOverflow(state, {
  6018. boundary,
  6019. rootBoundary,
  6020. padding,
  6021. altBoundary
  6022. });
  6023. var basePlacement = getBasePlacement(state.placement);
  6024. var variation = getVariation(state.placement);
  6025. var isBasePlacement = !variation;
  6026. var mainAxis = getMainAxisFromPlacement(basePlacement);
  6027. var altAxis = getAltAxis(mainAxis);
  6028. var popperOffsets2 = state.modifiersData.popperOffsets;
  6029. var referenceRect = state.rects.reference;
  6030. var popperRect = state.rects.popper;
  6031. var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
  6032. placement: state.placement
  6033. })) : tetherOffset;
  6034. var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
  6035. mainAxis: tetherOffsetValue,
  6036. altAxis: tetherOffsetValue
  6037. } : Object.assign({
  6038. mainAxis: 0,
  6039. altAxis: 0
  6040. }, tetherOffsetValue);
  6041. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  6042. var data2 = {
  6043. x: 0,
  6044. y: 0
  6045. };
  6046. if (!popperOffsets2) {
  6047. return;
  6048. }
  6049. if (checkMainAxis) {
  6050. var _offsetModifierState$;
  6051. var mainSide = mainAxis === "y" ? top : left;
  6052. var altSide = mainAxis === "y" ? bottom : right;
  6053. var len = mainAxis === "y" ? "height" : "width";
  6054. var offset2 = popperOffsets2[mainAxis];
  6055. var min$1 = offset2 + overflow[mainSide];
  6056. var max$1 = offset2 - overflow[altSide];
  6057. var additive = tether ? -popperRect[len] / 2 : 0;
  6058. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  6059. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
  6060. var arrowElement = state.elements.arrow;
  6061. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  6062. width: 0,
  6063. height: 0
  6064. };
  6065. var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
  6066. var arrowPaddingMin = arrowPaddingObject[mainSide];
  6067. var arrowPaddingMax = arrowPaddingObject[altSide];
  6068. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  6069. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  6070. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  6071. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  6072. var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  6073. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  6074. var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
  6075. var tetherMax = offset2 + maxOffset - offsetModifierValue;
  6076. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
  6077. popperOffsets2[mainAxis] = preventedOffset;
  6078. data2[mainAxis] = preventedOffset - offset2;
  6079. }
  6080. if (checkAltAxis) {
  6081. var _offsetModifierState$2;
  6082. var _mainSide = mainAxis === "x" ? top : left;
  6083. var _altSide = mainAxis === "x" ? bottom : right;
  6084. var _offset = popperOffsets2[altAxis];
  6085. var _len = altAxis === "y" ? "height" : "width";
  6086. var _min = _offset + overflow[_mainSide];
  6087. var _max = _offset - overflow[_altSide];
  6088. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  6089. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  6090. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  6091. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  6092. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  6093. popperOffsets2[altAxis] = _preventedOffset;
  6094. data2[altAxis] = _preventedOffset - _offset;
  6095. }
  6096. state.modifiersData[name] = data2;
  6097. }
  6098. var preventOverflow$1 = {
  6099. name: "preventOverflow",
  6100. enabled: true,
  6101. phase: "main",
  6102. fn: preventOverflow,
  6103. requiresIfExists: ["offset"]
  6104. };
  6105. function getHTMLElementScroll(element) {
  6106. return {
  6107. scrollLeft: element.scrollLeft,
  6108. scrollTop: element.scrollTop
  6109. };
  6110. }
  6111. function getNodeScroll(node) {
  6112. if (node === getWindow(node) || !isHTMLElement(node)) {
  6113. return getWindowScroll(node);
  6114. } else {
  6115. return getHTMLElementScroll(node);
  6116. }
  6117. }
  6118. function isElementScaled(element) {
  6119. var rect = element.getBoundingClientRect();
  6120. var scaleX = round(rect.width) / element.offsetWidth || 1;
  6121. var scaleY = round(rect.height) / element.offsetHeight || 1;
  6122. return scaleX !== 1 || scaleY !== 1;
  6123. }
  6124. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  6125. if (isFixed === void 0) {
  6126. isFixed = false;
  6127. }
  6128. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  6129. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  6130. var documentElement = getDocumentElement(offsetParent);
  6131. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  6132. var scroll = {
  6133. scrollLeft: 0,
  6134. scrollTop: 0
  6135. };
  6136. var offsets = {
  6137. x: 0,
  6138. y: 0
  6139. };
  6140. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  6141. if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
  6142. scroll = getNodeScroll(offsetParent);
  6143. }
  6144. if (isHTMLElement(offsetParent)) {
  6145. offsets = getBoundingClientRect(offsetParent, true);
  6146. offsets.x += offsetParent.clientLeft;
  6147. offsets.y += offsetParent.clientTop;
  6148. } else if (documentElement) {
  6149. offsets.x = getWindowScrollBarX(documentElement);
  6150. }
  6151. }
  6152. return {
  6153. x: rect.left + scroll.scrollLeft - offsets.x,
  6154. y: rect.top + scroll.scrollTop - offsets.y,
  6155. width: rect.width,
  6156. height: rect.height
  6157. };
  6158. }
  6159. function order(modifiers) {
  6160. var map = /* @__PURE__ */ new Map();
  6161. var visited = /* @__PURE__ */ new Set();
  6162. var result = [];
  6163. modifiers.forEach(function(modifier) {
  6164. map.set(modifier.name, modifier);
  6165. });
  6166. function sort(modifier) {
  6167. visited.add(modifier.name);
  6168. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  6169. requires.forEach(function(dep) {
  6170. if (!visited.has(dep)) {
  6171. var depModifier = map.get(dep);
  6172. if (depModifier) {
  6173. sort(depModifier);
  6174. }
  6175. }
  6176. });
  6177. result.push(modifier);
  6178. }
  6179. modifiers.forEach(function(modifier) {
  6180. if (!visited.has(modifier.name)) {
  6181. sort(modifier);
  6182. }
  6183. });
  6184. return result;
  6185. }
  6186. function orderModifiers(modifiers) {
  6187. var orderedModifiers = order(modifiers);
  6188. return modifierPhases.reduce(function(acc, phase) {
  6189. return acc.concat(orderedModifiers.filter(function(modifier) {
  6190. return modifier.phase === phase;
  6191. }));
  6192. }, []);
  6193. }
  6194. function debounce(fn2) {
  6195. var pending;
  6196. return function() {
  6197. if (!pending) {
  6198. pending = new Promise(function(resolve) {
  6199. Promise.resolve().then(function() {
  6200. pending = void 0;
  6201. resolve(fn2());
  6202. });
  6203. });
  6204. }
  6205. return pending;
  6206. };
  6207. }
  6208. function mergeByName(modifiers) {
  6209. var merged = modifiers.reduce(function(merged2, current) {
  6210. var existing = merged2[current.name];
  6211. merged2[current.name] = existing ? Object.assign({}, existing, current, {
  6212. options: Object.assign({}, existing.options, current.options),
  6213. data: Object.assign({}, existing.data, current.data)
  6214. }) : current;
  6215. return merged2;
  6216. }, {});
  6217. return Object.keys(merged).map(function(key) {
  6218. return merged[key];
  6219. });
  6220. }
  6221. var DEFAULT_OPTIONS = {
  6222. placement: "bottom",
  6223. modifiers: [],
  6224. strategy: "absolute"
  6225. };
  6226. function areValidElements() {
  6227. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  6228. args[_key] = arguments[_key];
  6229. }
  6230. return !args.some(function(element) {
  6231. return !(element && typeof element.getBoundingClientRect === "function");
  6232. });
  6233. }
  6234. function popperGenerator(generatorOptions) {
  6235. if (generatorOptions === void 0) {
  6236. generatorOptions = {};
  6237. }
  6238. 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;
  6239. return function createPopper2(reference2, popper2, options) {
  6240. if (options === void 0) {
  6241. options = defaultOptions;
  6242. }
  6243. var state = {
  6244. placement: "bottom",
  6245. orderedModifiers: [],
  6246. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  6247. modifiersData: {},
  6248. elements: {
  6249. reference: reference2,
  6250. popper: popper2
  6251. },
  6252. attributes: {},
  6253. styles: {}
  6254. };
  6255. var effectCleanupFns = [];
  6256. var isDestroyed = false;
  6257. var instance = {
  6258. state,
  6259. setOptions: function setOptions(setOptionsAction) {
  6260. var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
  6261. cleanupModifierEffects();
  6262. state.options = Object.assign({}, defaultOptions, state.options, options2);
  6263. state.scrollParents = {
  6264. reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
  6265. popper: listScrollParents(popper2)
  6266. };
  6267. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
  6268. state.orderedModifiers = orderedModifiers.filter(function(m2) {
  6269. return m2.enabled;
  6270. });
  6271. runModifierEffects();
  6272. return instance.update();
  6273. },
  6274. forceUpdate: function forceUpdate() {
  6275. if (isDestroyed) {
  6276. return;
  6277. }
  6278. var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
  6279. if (!areValidElements(reference3, popper3)) {
  6280. return;
  6281. }
  6282. state.rects = {
  6283. reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
  6284. popper: getLayoutRect(popper3)
  6285. };
  6286. state.reset = false;
  6287. state.placement = state.options.placement;
  6288. state.orderedModifiers.forEach(function(modifier) {
  6289. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  6290. });
  6291. for (var index = 0; index < state.orderedModifiers.length; index++) {
  6292. if (state.reset === true) {
  6293. state.reset = false;
  6294. index = -1;
  6295. continue;
  6296. }
  6297. 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;
  6298. if (typeof fn2 === "function") {
  6299. state = fn2({
  6300. state,
  6301. options: _options,
  6302. name,
  6303. instance
  6304. }) || state;
  6305. }
  6306. }
  6307. },
  6308. update: debounce(function() {
  6309. return new Promise(function(resolve) {
  6310. instance.forceUpdate();
  6311. resolve(state);
  6312. });
  6313. }),
  6314. destroy: function destroy() {
  6315. cleanupModifierEffects();
  6316. isDestroyed = true;
  6317. }
  6318. };
  6319. if (!areValidElements(reference2, popper2)) {
  6320. return instance;
  6321. }
  6322. instance.setOptions(options).then(function(state2) {
  6323. if (!isDestroyed && options.onFirstUpdate) {
  6324. options.onFirstUpdate(state2);
  6325. }
  6326. });
  6327. function runModifierEffects() {
  6328. state.orderedModifiers.forEach(function(_ref) {
  6329. var name = _ref.name, _ref$options = _ref.options, options2 = _ref$options === void 0 ? {} : _ref$options, effect2 = _ref.effect;
  6330. if (typeof effect2 === "function") {
  6331. var cleanupFn = effect2({
  6332. state,
  6333. name,
  6334. instance,
  6335. options: options2
  6336. });
  6337. var noopFn = function noopFn2() {
  6338. };
  6339. effectCleanupFns.push(cleanupFn || noopFn);
  6340. }
  6341. });
  6342. }
  6343. function cleanupModifierEffects() {
  6344. effectCleanupFns.forEach(function(fn2) {
  6345. return fn2();
  6346. });
  6347. effectCleanupFns = [];
  6348. }
  6349. return instance;
  6350. };
  6351. }
  6352. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  6353. var createPopper = /* @__PURE__ */ popperGenerator({
  6354. defaultModifiers
  6355. });
  6356. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  6357. const usePopperCoreConfigProps = buildProps({
  6358. boundariesPadding: {
  6359. type: Number,
  6360. default: 0
  6361. },
  6362. fallbackPlacements: {
  6363. type: definePropType(Array),
  6364. default: () => []
  6365. },
  6366. gpuAcceleration: {
  6367. type: Boolean,
  6368. default: true
  6369. },
  6370. offset: {
  6371. type: Number,
  6372. default: 12
  6373. },
  6374. placement: {
  6375. type: String,
  6376. values: placements,
  6377. default: "bottom"
  6378. },
  6379. popperOptions: {
  6380. type: definePropType(Object),
  6381. default: () => ({})
  6382. },
  6383. strategy: {
  6384. type: String,
  6385. values: POSITIONING_STRATEGIES,
  6386. default: "absolute"
  6387. }
  6388. });
  6389. const usePopperContentProps = buildProps(__spreadProps(__spreadValues({}, usePopperCoreConfigProps), {
  6390. style: { type: definePropType([String, Array, Object]) },
  6391. className: { type: definePropType([String, Array, Object]) },
  6392. effect: {
  6393. type: String,
  6394. default: "dark"
  6395. },
  6396. visible: Boolean,
  6397. enterable: {
  6398. type: Boolean,
  6399. default: true
  6400. },
  6401. pure: Boolean,
  6402. popperClass: {
  6403. type: definePropType([String, Array, Object])
  6404. },
  6405. popperStyle: {
  6406. type: definePropType([String, Array, Object])
  6407. },
  6408. referenceEl: {
  6409. type: definePropType(Object)
  6410. },
  6411. stopPopperMouseEvent: {
  6412. type: Boolean,
  6413. default: true
  6414. },
  6415. zIndex: Number
  6416. }));
  6417. const buildPopperOptions = (props, arrowProps) => {
  6418. const { placement, strategy, popperOptions: popperOptions2 } = props;
  6419. const options = __spreadProps(__spreadValues({
  6420. placement,
  6421. strategy
  6422. }, popperOptions2), {
  6423. modifiers: genModifiers(props)
  6424. });
  6425. attachArrow(options, arrowProps);
  6426. deriveExtraModifiers(options, popperOptions2 == null ? void 0 : popperOptions2.modifiers);
  6427. return options;
  6428. };
  6429. const unwrapMeasurableEl = ($el) => {
  6430. if (!isClient)
  6431. return;
  6432. return unrefElement($el);
  6433. };
  6434. function genModifiers(options) {
  6435. const { offset: offset2, gpuAcceleration, fallbackPlacements } = options;
  6436. return [
  6437. {
  6438. name: "offset",
  6439. options: {
  6440. offset: [0, offset2 != null ? offset2 : 12]
  6441. }
  6442. },
  6443. {
  6444. name: "preventOverflow",
  6445. options: {
  6446. padding: {
  6447. top: 2,
  6448. bottom: 2,
  6449. left: 5,
  6450. right: 5
  6451. }
  6452. }
  6453. },
  6454. {
  6455. name: "flip",
  6456. options: {
  6457. padding: 5,
  6458. fallbackPlacements: fallbackPlacements != null ? fallbackPlacements : []
  6459. }
  6460. },
  6461. {
  6462. name: "computeStyles",
  6463. options: {
  6464. gpuAcceleration,
  6465. adaptive: gpuAcceleration
  6466. }
  6467. }
  6468. ];
  6469. }
  6470. function attachArrow(options, { arrowEl, arrowOffset }) {
  6471. options.modifiers.push({
  6472. name: "arrow",
  6473. options: {
  6474. element: arrowEl,
  6475. padding: arrowOffset != null ? arrowOffset : 5
  6476. }
  6477. });
  6478. }
  6479. function deriveExtraModifiers(options, modifiers) {
  6480. if (modifiers) {
  6481. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  6482. }
  6483. }
  6484. const __default__$g = {
  6485. name: "ElPopperContent"
  6486. };
  6487. const _sfc_main$12 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$g), {
  6488. props: usePopperContentProps,
  6489. emits: ["mouseenter", "mouseleave"],
  6490. setup(__props, { expose }) {
  6491. const props = __props;
  6492. const { popperInstanceRef, contentRef, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  6493. const { nextZIndex } = useZIndex();
  6494. const ns = useNamespace("popper");
  6495. const popperContentRef = ref();
  6496. const arrowRef = ref();
  6497. const arrowOffset = ref();
  6498. provide(POPPER_CONTENT_INJECTION_KEY, {
  6499. arrowRef,
  6500. arrowOffset
  6501. });
  6502. const contentZIndex = ref(props.zIndex || nextZIndex());
  6503. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
  6504. const contentStyle = computed(() => [{ zIndex: unref(contentZIndex) }, props.popperStyle]);
  6505. const contentClass = computed(() => [
  6506. ns.b(),
  6507. ns.is("pure", props.pure),
  6508. ns.is(props.effect),
  6509. props.popperClass
  6510. ]);
  6511. const createPopperInstance = ({ referenceEl, popperContentEl, arrowEl }) => {
  6512. const options = buildPopperOptions(props, {
  6513. arrowEl,
  6514. arrowOffset: unref(arrowOffset)
  6515. });
  6516. return createPopper(referenceEl, popperContentEl, options);
  6517. };
  6518. const updatePopper = (shouldUpdateZIndex = true) => {
  6519. var _a2;
  6520. (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.update();
  6521. shouldUpdateZIndex && (contentZIndex.value = props.zIndex || nextZIndex());
  6522. };
  6523. const togglePopperAlive = () => {
  6524. var _a2, _b2;
  6525. const monitorable = { name: "eventListeners", enabled: props.visible };
  6526. (_b2 = (_a2 = unref(popperInstanceRef)) == null ? void 0 : _a2.setOptions) == null ? void 0 : _b2.call(_a2, (options) => __spreadProps(__spreadValues({}, options), {
  6527. modifiers: [...options.modifiers || [], monitorable]
  6528. }));
  6529. updatePopper(false);
  6530. };
  6531. onMounted(() => {
  6532. let updateHandle;
  6533. watch(computedReference, (referenceEl) => {
  6534. var _a2;
  6535. updateHandle == null ? void 0 : updateHandle();
  6536. const popperInstance = unref(popperInstanceRef);
  6537. (_a2 = popperInstance == null ? void 0 : popperInstance.destroy) == null ? void 0 : _a2.call(popperInstance);
  6538. if (referenceEl) {
  6539. const popperContentEl = unref(popperContentRef);
  6540. contentRef.value = popperContentEl;
  6541. popperInstanceRef.value = createPopperInstance({
  6542. referenceEl,
  6543. popperContentEl,
  6544. arrowEl: unref(arrowRef)
  6545. });
  6546. updateHandle = watch(() => referenceEl.getBoundingClientRect(), () => updatePopper(), {
  6547. immediate: true
  6548. });
  6549. } else {
  6550. popperInstanceRef.value = void 0;
  6551. }
  6552. }, {
  6553. immediate: true
  6554. });
  6555. watch(() => props.visible, togglePopperAlive, { immediate: true });
  6556. watch(() => buildPopperOptions(props, {
  6557. arrowEl: unref(arrowRef),
  6558. arrowOffset: unref(arrowOffset)
  6559. }), (option) => {
  6560. var _a2;
  6561. return (_a2 = popperInstanceRef.value) == null ? void 0 : _a2.setOptions(option);
  6562. });
  6563. });
  6564. expose({
  6565. popperContentRef,
  6566. popperInstanceRef,
  6567. updatePopper,
  6568. contentStyle
  6569. });
  6570. return (_ctx, _cache) => {
  6571. return openBlock(), createElementBlock("div", {
  6572. ref_key: "popperContentRef",
  6573. ref: popperContentRef,
  6574. style: normalizeStyle(unref(contentStyle)),
  6575. class: normalizeClass(unref(contentClass)),
  6576. role: "tooltip",
  6577. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  6578. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  6579. }, [
  6580. renderSlot(_ctx.$slots, "default")
  6581. ], 38);
  6582. };
  6583. }
  6584. }));
  6585. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$12, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
  6586. function useDeprecateAppendToBody(scope, from) {
  6587. const vm = getCurrentInstance();
  6588. const compatTeleported = computed(() => {
  6589. return isBoolean(vm.props[from]) ? vm.props[from] : vm.props.teleported;
  6590. });
  6591. useDeprecated({
  6592. scope,
  6593. from,
  6594. replacement: "teleported",
  6595. version: "2.1.0",
  6596. ref: "https://element-plus.org/en-US/component/tooltip.html#attributes"
  6597. }, computed(() => isBoolean(vm.props[from])));
  6598. return {
  6599. compatTeleported
  6600. };
  6601. }
  6602. const ElPopper = withInstall(Popper);
  6603. const _sfc_main$11 = defineComponent({
  6604. name: "ElVisuallyHidden",
  6605. props: {
  6606. style: {
  6607. type: [String, Object, Array]
  6608. }
  6609. },
  6610. setup(props) {
  6611. return {
  6612. computedStyle: computed(() => {
  6613. return [
  6614. props.style,
  6615. {
  6616. position: "absolute",
  6617. border: 0,
  6618. width: 1,
  6619. height: 1,
  6620. padding: 0,
  6621. margin: -1,
  6622. overflow: "hidden",
  6623. clip: "rect(0, 0, 0, 0)",
  6624. whiteSpace: "nowrap",
  6625. wordWrap: "normal"
  6626. }
  6627. ];
  6628. })
  6629. };
  6630. }
  6631. });
  6632. function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
  6633. return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, { style: _ctx.computedStyle }), [
  6634. renderSlot(_ctx.$slots, "default")
  6635. ], 16);
  6636. }
  6637. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc$1(_sfc_main$11, [["render", _sfc_render$D], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/visual-hidden/src/visual-hidden.vue"]]);
  6638. const useTooltipContentProps = buildProps(__spreadProps(__spreadValues(__spreadValues({}, useDelayedToggleProps), usePopperContentProps), {
  6639. appendTo: {
  6640. type: definePropType([String, Object]),
  6641. default: POPPER_CONTAINER_SELECTOR
  6642. },
  6643. content: {
  6644. type: String,
  6645. default: ""
  6646. },
  6647. rawContent: {
  6648. type: Boolean,
  6649. default: false
  6650. },
  6651. persistent: Boolean,
  6652. ariaLabel: String,
  6653. visible: {
  6654. type: definePropType(Boolean),
  6655. default: null
  6656. },
  6657. transition: {
  6658. type: String,
  6659. default: "el-fade-in-linear"
  6660. },
  6661. teleported: {
  6662. type: Boolean,
  6663. default: true
  6664. },
  6665. disabled: {
  6666. type: Boolean
  6667. }
  6668. }));
  6669. const useTooltipTriggerProps = buildProps(__spreadProps(__spreadValues({}, usePopperTriggerProps), {
  6670. disabled: Boolean,
  6671. trigger: {
  6672. type: definePropType([String, Array]),
  6673. default: "hover"
  6674. }
  6675. }));
  6676. const useTooltipProps = buildProps({
  6677. openDelay: {
  6678. type: Number
  6679. },
  6680. visibleArrow: {
  6681. type: Boolean,
  6682. default: void 0
  6683. },
  6684. hideAfter: {
  6685. type: Number,
  6686. default: 200
  6687. },
  6688. showArrow: {
  6689. type: Boolean,
  6690. default: true
  6691. }
  6692. });
  6693. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  6694. const _sfc_main$10 = defineComponent({
  6695. name: "ElTooltipContent",
  6696. components: {
  6697. ElPopperContent,
  6698. ElVisuallyHidden
  6699. },
  6700. inheritAttrs: false,
  6701. props: useTooltipContentProps,
  6702. setup(props) {
  6703. const contentRef = ref(null);
  6704. const intermediateOpen = ref(false);
  6705. const entering = ref(false);
  6706. const leaving = ref(false);
  6707. const destroyed = ref(false);
  6708. const {
  6709. controlled,
  6710. id,
  6711. open,
  6712. trigger,
  6713. onClose,
  6714. onOpen,
  6715. onShow,
  6716. onHide,
  6717. onBeforeShow,
  6718. onBeforeHide
  6719. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6720. const persistentRef = computed(() => {
  6721. return props.persistent;
  6722. });
  6723. onBeforeUnmount(() => {
  6724. destroyed.value = true;
  6725. });
  6726. const shouldRender = computed(() => {
  6727. return unref(persistentRef) ? true : unref(open);
  6728. });
  6729. const shouldShow = computed(() => {
  6730. return props.disabled ? false : unref(open);
  6731. });
  6732. const contentStyle = computed(() => {
  6733. var _a2;
  6734. return (_a2 = props.style) != null ? _a2 : {};
  6735. });
  6736. const ariaHidden = computed(() => !unref(open));
  6737. useEscapeKeydown(onClose);
  6738. const onTransitionLeave = () => {
  6739. onHide();
  6740. };
  6741. const stopWhenControlled = () => {
  6742. if (unref(controlled))
  6743. return true;
  6744. };
  6745. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  6746. if (props.enterable && unref(trigger) === "hover") {
  6747. onOpen();
  6748. }
  6749. });
  6750. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  6751. if (unref(trigger) === "hover") {
  6752. onClose();
  6753. }
  6754. });
  6755. const onBeforeEnter = () => {
  6756. var _a2, _b2;
  6757. (_b2 = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  6758. onBeforeShow == null ? void 0 : onBeforeShow();
  6759. };
  6760. const onBeforeLeave = () => {
  6761. onBeforeHide == null ? void 0 : onBeforeHide();
  6762. };
  6763. const onAfterShow = () => {
  6764. onShow();
  6765. };
  6766. let stopHandle;
  6767. watch(() => unref(open), (val) => {
  6768. if (val) {
  6769. stopHandle = onClickOutside(computed(() => {
  6770. var _a2;
  6771. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  6772. }), () => {
  6773. if (unref(controlled))
  6774. return;
  6775. const $trigger = unref(trigger);
  6776. if ($trigger !== "hover") {
  6777. onClose();
  6778. }
  6779. });
  6780. } else {
  6781. stopHandle == null ? void 0 : stopHandle();
  6782. }
  6783. }, {
  6784. flush: "post"
  6785. });
  6786. return {
  6787. ariaHidden,
  6788. entering,
  6789. leaving,
  6790. id,
  6791. intermediateOpen,
  6792. contentStyle,
  6793. contentRef,
  6794. destroyed,
  6795. shouldRender,
  6796. shouldShow,
  6797. open,
  6798. onAfterShow,
  6799. onBeforeEnter,
  6800. onBeforeLeave,
  6801. onContentEnter,
  6802. onContentLeave,
  6803. onTransitionLeave
  6804. };
  6805. }
  6806. });
  6807. function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
  6808. const _component_el_visually_hidden = resolveComponent("el-visually-hidden");
  6809. const _component_el_popper_content = resolveComponent("el-popper-content");
  6810. return openBlock(), createBlock(Teleport, {
  6811. disabled: !_ctx.teleported,
  6812. to: _ctx.appendTo
  6813. }, [
  6814. createVNode(Transition, {
  6815. name: _ctx.transition,
  6816. onAfterLeave: _ctx.onTransitionLeave,
  6817. onBeforeEnter: _ctx.onBeforeEnter,
  6818. onAfterEnter: _ctx.onAfterShow,
  6819. onBeforeLeave: _ctx.onBeforeLeave
  6820. }, {
  6821. default: withCtx(() => [
  6822. _ctx.shouldRender ? withDirectives((openBlock(), createBlock(_component_el_popper_content, mergeProps({
  6823. key: 0,
  6824. ref: "contentRef"
  6825. }, _ctx.$attrs, {
  6826. "aria-hidden": _ctx.ariaHidden,
  6827. "boundaries-padding": _ctx.boundariesPadding,
  6828. "fallback-placements": _ctx.fallbackPlacements,
  6829. "gpu-acceleration": _ctx.gpuAcceleration,
  6830. offset: _ctx.offset,
  6831. placement: _ctx.placement,
  6832. "popper-options": _ctx.popperOptions,
  6833. strategy: _ctx.strategy,
  6834. effect: _ctx.effect,
  6835. enterable: _ctx.enterable,
  6836. pure: _ctx.pure,
  6837. "popper-class": _ctx.popperClass,
  6838. "popper-style": [_ctx.popperStyle, _ctx.contentStyle],
  6839. "reference-el": _ctx.referenceEl,
  6840. visible: _ctx.shouldShow,
  6841. "z-index": _ctx.zIndex,
  6842. onMouseenter: _ctx.onContentEnter,
  6843. onMouseleave: _ctx.onContentLeave
  6844. }), {
  6845. default: withCtx(() => [
  6846. createCommentVNode(" Workaround bug #6378 "),
  6847. !_ctx.destroyed ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  6848. renderSlot(_ctx.$slots, "default"),
  6849. createVNode(_component_el_visually_hidden, {
  6850. id: _ctx.id,
  6851. role: "tooltip"
  6852. }, {
  6853. default: withCtx(() => [
  6854. createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
  6855. ]),
  6856. _: 1
  6857. }, 8, ["id"])
  6858. ], 64)) : createCommentVNode("v-if", true)
  6859. ]),
  6860. _: 3
  6861. }, 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"])), [
  6862. [vShow, _ctx.shouldShow]
  6863. ]) : createCommentVNode("v-if", true)
  6864. ]),
  6865. _: 3
  6866. }, 8, ["name", "onAfterLeave", "onBeforeEnter", "onAfterEnter", "onBeforeLeave"])
  6867. ], 8, ["disabled", "to"]);
  6868. }
  6869. var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$10, [["render", _sfc_render$C], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
  6870. const isTriggerType = (trigger, type4) => {
  6871. if (isArray(trigger)) {
  6872. return trigger.includes(type4);
  6873. }
  6874. return trigger === type4;
  6875. };
  6876. const whenTrigger = (trigger, type4, handler3) => {
  6877. return (e) => {
  6878. isTriggerType(unref(trigger), type4) && handler3(e);
  6879. };
  6880. };
  6881. const _sfc_main$$ = defineComponent({
  6882. name: "ElTooltipTrigger",
  6883. components: {
  6884. ElPopperTrigger
  6885. },
  6886. props: useTooltipTriggerProps,
  6887. setup(props) {
  6888. const ns = useNamespace("tooltip");
  6889. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  6890. const triggerRef2 = ref(null);
  6891. const stopWhenControlledOrDisabled = () => {
  6892. if (unref(controlled) || props.disabled) {
  6893. return true;
  6894. }
  6895. };
  6896. const trigger = toRef(props, "trigger");
  6897. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  6898. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  6899. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  6900. if (e.button === 0) {
  6901. onToggle(e);
  6902. }
  6903. }));
  6904. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  6905. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  6906. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  6907. e.preventDefault();
  6908. onToggle(e);
  6909. }));
  6910. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  6911. const { code } = e;
  6912. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  6913. onToggle(e);
  6914. }
  6915. });
  6916. return {
  6917. onBlur,
  6918. onContextMenu,
  6919. onFocus,
  6920. onMouseenter,
  6921. onMouseleave,
  6922. onClick,
  6923. onKeydown,
  6924. open,
  6925. id,
  6926. triggerRef: triggerRef2,
  6927. ns
  6928. };
  6929. }
  6930. });
  6931. function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
  6932. const _component_el_popper_trigger = resolveComponent("el-popper-trigger");
  6933. return openBlock(), createBlock(_component_el_popper_trigger, {
  6934. id: _ctx.id,
  6935. "virtual-ref": _ctx.virtualRef,
  6936. open: _ctx.open,
  6937. "virtual-triggering": _ctx.virtualTriggering,
  6938. class: normalizeClass(_ctx.ns.e("trigger")),
  6939. onBlur: _ctx.onBlur,
  6940. onClick: _ctx.onClick,
  6941. onContextmenu: _ctx.onContextMenu,
  6942. onFocus: _ctx.onFocus,
  6943. onMouseenter: _ctx.onMouseenter,
  6944. onMouseleave: _ctx.onMouseleave,
  6945. onKeydown: _ctx.onKeydown
  6946. }, {
  6947. default: withCtx(() => [
  6948. renderSlot(_ctx.$slots, "default")
  6949. ]),
  6950. _: 3
  6951. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  6952. }
  6953. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$$, [["render", _sfc_render$B], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
  6954. const { useModelToggleProps, useModelToggle, useModelToggleEmits } = createModelToggleComposable("visible");
  6955. const _sfc_main$_ = defineComponent({
  6956. name: "ElTooltip",
  6957. components: {
  6958. ElPopper,
  6959. ElPopperArrow,
  6960. ElTooltipContent,
  6961. ElTooltipTrigger
  6962. },
  6963. props: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, useModelToggleProps), useTooltipContentProps), useTooltipTriggerProps), usePopperArrowProps), useTooltipProps),
  6964. emits: [...useModelToggleEmits, "before-show", "before-hide", "show", "hide"],
  6965. setup(props, { emit }) {
  6966. usePopperContainer();
  6967. const compatShowAfter = computed(() => {
  6968. if (!isUndefined(props.openDelay))
  6969. ;
  6970. return props.openDelay || props.showAfter;
  6971. });
  6972. const compatShowArrow = computed(() => {
  6973. if (!isUndefined(props.visibleArrow))
  6974. ;
  6975. return isBoolean(props.visibleArrow) ? props.visibleArrow : props.showArrow;
  6976. });
  6977. const id = useId();
  6978. const popperRef = ref(null);
  6979. const updatePopper = () => {
  6980. var _a2;
  6981. const popperComponent = unref(popperRef);
  6982. if (popperComponent) {
  6983. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  6984. }
  6985. };
  6986. const open = ref(false);
  6987. const { show, hide: hide2 } = useModelToggle({
  6988. indicator: open
  6989. });
  6990. const { onOpen, onClose } = useDelayedToggle({
  6991. showAfter: compatShowAfter,
  6992. hideAfter: toRef(props, "hideAfter"),
  6993. open: show,
  6994. close: hide2
  6995. });
  6996. const controlled = computed(() => isBoolean(props.visible));
  6997. provide(TOOLTIP_INJECTION_KEY, {
  6998. controlled,
  6999. id,
  7000. open: readonly(open),
  7001. trigger: toRef(props, "trigger"),
  7002. onOpen,
  7003. onClose,
  7004. onToggle: () => {
  7005. if (unref(open)) {
  7006. onClose();
  7007. } else {
  7008. onOpen();
  7009. }
  7010. },
  7011. onShow: () => {
  7012. emit("show");
  7013. },
  7014. onHide: () => {
  7015. emit("hide");
  7016. },
  7017. onBeforeShow: () => {
  7018. emit("before-show");
  7019. },
  7020. onBeforeHide: () => {
  7021. emit("before-hide");
  7022. },
  7023. updatePopper
  7024. });
  7025. watch(() => props.disabled, (disabled) => {
  7026. if (disabled && open.value) {
  7027. open.value = false;
  7028. }
  7029. });
  7030. return {
  7031. compatShowAfter,
  7032. compatShowArrow,
  7033. popperRef,
  7034. open,
  7035. hide: hide2,
  7036. updatePopper,
  7037. onOpen,
  7038. onClose
  7039. };
  7040. }
  7041. });
  7042. const _hoisted_1$E = ["innerHTML"];
  7043. const _hoisted_2$u = { key: 1 };
  7044. function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
  7045. const _component_el_tooltip_trigger = resolveComponent("el-tooltip-trigger");
  7046. const _component_el_popper_arrow = resolveComponent("el-popper-arrow");
  7047. const _component_el_tooltip_content = resolveComponent("el-tooltip-content");
  7048. const _component_el_popper = resolveComponent("el-popper");
  7049. return openBlock(), createBlock(_component_el_popper, { ref: "popperRef" }, {
  7050. default: withCtx(() => [
  7051. createVNode(_component_el_tooltip_trigger, {
  7052. disabled: _ctx.disabled,
  7053. trigger: _ctx.trigger,
  7054. "virtual-ref": _ctx.virtualRef,
  7055. "virtual-triggering": _ctx.virtualTriggering
  7056. }, {
  7057. default: withCtx(() => [
  7058. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  7059. ]),
  7060. _: 3
  7061. }, 8, ["disabled", "trigger", "virtual-ref", "virtual-triggering"]),
  7062. createVNode(_component_el_tooltip_content, {
  7063. "aria-label": _ctx.ariaLabel,
  7064. "boundaries-padding": _ctx.boundariesPadding,
  7065. content: _ctx.content,
  7066. disabled: _ctx.disabled,
  7067. effect: _ctx.effect,
  7068. enterable: _ctx.enterable,
  7069. "fallback-placements": _ctx.fallbackPlacements,
  7070. "hide-after": _ctx.hideAfter,
  7071. "gpu-acceleration": _ctx.gpuAcceleration,
  7072. offset: _ctx.offset,
  7073. persistent: _ctx.persistent,
  7074. "popper-class": _ctx.popperClass,
  7075. "popper-style": _ctx.popperStyle,
  7076. placement: _ctx.placement,
  7077. "popper-options": _ctx.popperOptions,
  7078. pure: _ctx.pure,
  7079. "raw-content": _ctx.rawContent,
  7080. "reference-el": _ctx.referenceEl,
  7081. "show-after": _ctx.compatShowAfter,
  7082. strategy: _ctx.strategy,
  7083. teleported: _ctx.teleported,
  7084. transition: _ctx.transition,
  7085. "z-index": _ctx.zIndex,
  7086. "append-to": _ctx.appendTo
  7087. }, {
  7088. default: withCtx(() => [
  7089. renderSlot(_ctx.$slots, "content", {}, () => [
  7090. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  7091. key: 0,
  7092. innerHTML: _ctx.content
  7093. }, null, 8, _hoisted_1$E)) : (openBlock(), createElementBlock("span", _hoisted_2$u, toDisplayString(_ctx.content), 1))
  7094. ]),
  7095. _ctx.compatShowArrow ? (openBlock(), createBlock(_component_el_popper_arrow, {
  7096. key: 0,
  7097. "arrow-offset": _ctx.arrowOffset
  7098. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  7099. ]),
  7100. _: 3
  7101. }, 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"])
  7102. ]),
  7103. _: 3
  7104. }, 512);
  7105. }
  7106. var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$_, [["render", _sfc_render$A], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
  7107. const ElTooltip = withInstall(Tooltip);
  7108. const buttonTypes = [
  7109. "default",
  7110. "primary",
  7111. "success",
  7112. "warning",
  7113. "info",
  7114. "danger",
  7115. "text",
  7116. ""
  7117. ];
  7118. const buttonNativeTypes = ["button", "submit", "reset"];
  7119. const buttonProps = buildProps({
  7120. size: useSizeProp,
  7121. disabled: Boolean,
  7122. type: {
  7123. type: String,
  7124. values: buttonTypes,
  7125. default: ""
  7126. },
  7127. icon: {
  7128. type: iconPropType,
  7129. default: ""
  7130. },
  7131. nativeType: {
  7132. type: String,
  7133. values: buttonNativeTypes,
  7134. default: "button"
  7135. },
  7136. loading: Boolean,
  7137. loadingIcon: {
  7138. type: iconPropType,
  7139. default: () => loading
  7140. },
  7141. plain: Boolean,
  7142. autofocus: Boolean,
  7143. round: Boolean,
  7144. circle: Boolean,
  7145. color: String,
  7146. dark: Boolean,
  7147. autoInsertSpace: {
  7148. type: Boolean,
  7149. default: void 0
  7150. }
  7151. });
  7152. const buttonEmits = {
  7153. click: (evt) => evt instanceof MouseEvent
  7154. };
  7155. function bound01(n, max2) {
  7156. if (isOnePointZero(n)) {
  7157. n = "100%";
  7158. }
  7159. var isPercent = isPercentage(n);
  7160. n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
  7161. if (isPercent) {
  7162. n = parseInt(String(n * max2), 10) / 100;
  7163. }
  7164. if (Math.abs(n - max2) < 1e-6) {
  7165. return 1;
  7166. }
  7167. if (max2 === 360) {
  7168. n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
  7169. } else {
  7170. n = n % max2 / parseFloat(String(max2));
  7171. }
  7172. return n;
  7173. }
  7174. function clamp01(val) {
  7175. return Math.min(1, Math.max(0, val));
  7176. }
  7177. function isOnePointZero(n) {
  7178. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  7179. }
  7180. function isPercentage(n) {
  7181. return typeof n === "string" && n.indexOf("%") !== -1;
  7182. }
  7183. function boundAlpha(a2) {
  7184. a2 = parseFloat(a2);
  7185. if (isNaN(a2) || a2 < 0 || a2 > 1) {
  7186. a2 = 1;
  7187. }
  7188. return a2;
  7189. }
  7190. function convertToPercentage(n) {
  7191. if (n <= 1) {
  7192. return "".concat(Number(n) * 100, "%");
  7193. }
  7194. return n;
  7195. }
  7196. function pad2(c2) {
  7197. return c2.length === 1 ? "0" + c2 : String(c2);
  7198. }
  7199. function rgbToRgb(r, g, b2) {
  7200. return {
  7201. r: bound01(r, 255) * 255,
  7202. g: bound01(g, 255) * 255,
  7203. b: bound01(b2, 255) * 255
  7204. };
  7205. }
  7206. function rgbToHsl(r, g, b2) {
  7207. r = bound01(r, 255);
  7208. g = bound01(g, 255);
  7209. b2 = bound01(b2, 255);
  7210. var max2 = Math.max(r, g, b2);
  7211. var min2 = Math.min(r, g, b2);
  7212. var h2 = 0;
  7213. var s2 = 0;
  7214. var l2 = (max2 + min2) / 2;
  7215. if (max2 === min2) {
  7216. s2 = 0;
  7217. h2 = 0;
  7218. } else {
  7219. var d2 = max2 - min2;
  7220. s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
  7221. switch (max2) {
  7222. case r:
  7223. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7224. break;
  7225. case g:
  7226. h2 = (b2 - r) / d2 + 2;
  7227. break;
  7228. case b2:
  7229. h2 = (r - g) / d2 + 4;
  7230. break;
  7231. }
  7232. h2 /= 6;
  7233. }
  7234. return { h: h2, s: s2, l: l2 };
  7235. }
  7236. function hue2rgb(p2, q, t) {
  7237. if (t < 0) {
  7238. t += 1;
  7239. }
  7240. if (t > 1) {
  7241. t -= 1;
  7242. }
  7243. if (t < 1 / 6) {
  7244. return p2 + (q - p2) * (6 * t);
  7245. }
  7246. if (t < 1 / 2) {
  7247. return q;
  7248. }
  7249. if (t < 2 / 3) {
  7250. return p2 + (q - p2) * (2 / 3 - t) * 6;
  7251. }
  7252. return p2;
  7253. }
  7254. function hslToRgb(h2, s2, l2) {
  7255. var r;
  7256. var g;
  7257. var b2;
  7258. h2 = bound01(h2, 360);
  7259. s2 = bound01(s2, 100);
  7260. l2 = bound01(l2, 100);
  7261. if (s2 === 0) {
  7262. g = l2;
  7263. b2 = l2;
  7264. r = l2;
  7265. } else {
  7266. var q = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
  7267. var p2 = 2 * l2 - q;
  7268. r = hue2rgb(p2, q, h2 + 1 / 3);
  7269. g = hue2rgb(p2, q, h2);
  7270. b2 = hue2rgb(p2, q, h2 - 1 / 3);
  7271. }
  7272. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7273. }
  7274. function rgbToHsv(r, g, b2) {
  7275. r = bound01(r, 255);
  7276. g = bound01(g, 255);
  7277. b2 = bound01(b2, 255);
  7278. var max2 = Math.max(r, g, b2);
  7279. var min2 = Math.min(r, g, b2);
  7280. var h2 = 0;
  7281. var v2 = max2;
  7282. var d2 = max2 - min2;
  7283. var s2 = max2 === 0 ? 0 : d2 / max2;
  7284. if (max2 === min2) {
  7285. h2 = 0;
  7286. } else {
  7287. switch (max2) {
  7288. case r:
  7289. h2 = (g - b2) / d2 + (g < b2 ? 6 : 0);
  7290. break;
  7291. case g:
  7292. h2 = (b2 - r) / d2 + 2;
  7293. break;
  7294. case b2:
  7295. h2 = (r - g) / d2 + 4;
  7296. break;
  7297. }
  7298. h2 /= 6;
  7299. }
  7300. return { h: h2, s: s2, v: v2 };
  7301. }
  7302. function hsvToRgb(h2, s2, v2) {
  7303. h2 = bound01(h2, 360) * 6;
  7304. s2 = bound01(s2, 100);
  7305. v2 = bound01(v2, 100);
  7306. var i = Math.floor(h2);
  7307. var f2 = h2 - i;
  7308. var p2 = v2 * (1 - s2);
  7309. var q = v2 * (1 - f2 * s2);
  7310. var t = v2 * (1 - (1 - f2) * s2);
  7311. var mod = i % 6;
  7312. var r = [v2, q, p2, p2, t, v2][mod];
  7313. var g = [t, v2, v2, q, p2, p2][mod];
  7314. var b2 = [p2, p2, t, v2, v2, q][mod];
  7315. return { r: r * 255, g: g * 255, b: b2 * 255 };
  7316. }
  7317. function rgbToHex(r, g, b2, allow3Char) {
  7318. var hex2 = [
  7319. pad2(Math.round(r).toString(16)),
  7320. pad2(Math.round(g).toString(16)),
  7321. pad2(Math.round(b2).toString(16))
  7322. ];
  7323. if (allow3Char && hex2[0].startsWith(hex2[0].charAt(1)) && hex2[1].startsWith(hex2[1].charAt(1)) && hex2[2].startsWith(hex2[2].charAt(1))) {
  7324. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0);
  7325. }
  7326. return hex2.join("");
  7327. }
  7328. function rgbaToHex(r, g, b2, a2, allow4Char) {
  7329. var hex2 = [
  7330. pad2(Math.round(r).toString(16)),
  7331. pad2(Math.round(g).toString(16)),
  7332. pad2(Math.round(b2).toString(16)),
  7333. pad2(convertDecimalToHex(a2))
  7334. ];
  7335. 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))) {
  7336. return hex2[0].charAt(0) + hex2[1].charAt(0) + hex2[2].charAt(0) + hex2[3].charAt(0);
  7337. }
  7338. return hex2.join("");
  7339. }
  7340. function convertDecimalToHex(d2) {
  7341. return Math.round(parseFloat(d2) * 255).toString(16);
  7342. }
  7343. function convertHexToDecimal(h2) {
  7344. return parseIntFromHex(h2) / 255;
  7345. }
  7346. function parseIntFromHex(val) {
  7347. return parseInt(val, 16);
  7348. }
  7349. function numberInputToObject(color) {
  7350. return {
  7351. r: color >> 16,
  7352. g: (color & 65280) >> 8,
  7353. b: color & 255
  7354. };
  7355. }
  7356. var names = {
  7357. aliceblue: "#f0f8ff",
  7358. antiquewhite: "#faebd7",
  7359. aqua: "#00ffff",
  7360. aquamarine: "#7fffd4",
  7361. azure: "#f0ffff",
  7362. beige: "#f5f5dc",
  7363. bisque: "#ffe4c4",
  7364. black: "#000000",
  7365. blanchedalmond: "#ffebcd",
  7366. blue: "#0000ff",
  7367. blueviolet: "#8a2be2",
  7368. brown: "#a52a2a",
  7369. burlywood: "#deb887",
  7370. cadetblue: "#5f9ea0",
  7371. chartreuse: "#7fff00",
  7372. chocolate: "#d2691e",
  7373. coral: "#ff7f50",
  7374. cornflowerblue: "#6495ed",
  7375. cornsilk: "#fff8dc",
  7376. crimson: "#dc143c",
  7377. cyan: "#00ffff",
  7378. darkblue: "#00008b",
  7379. darkcyan: "#008b8b",
  7380. darkgoldenrod: "#b8860b",
  7381. darkgray: "#a9a9a9",
  7382. darkgreen: "#006400",
  7383. darkgrey: "#a9a9a9",
  7384. darkkhaki: "#bdb76b",
  7385. darkmagenta: "#8b008b",
  7386. darkolivegreen: "#556b2f",
  7387. darkorange: "#ff8c00",
  7388. darkorchid: "#9932cc",
  7389. darkred: "#8b0000",
  7390. darksalmon: "#e9967a",
  7391. darkseagreen: "#8fbc8f",
  7392. darkslateblue: "#483d8b",
  7393. darkslategray: "#2f4f4f",
  7394. darkslategrey: "#2f4f4f",
  7395. darkturquoise: "#00ced1",
  7396. darkviolet: "#9400d3",
  7397. deeppink: "#ff1493",
  7398. deepskyblue: "#00bfff",
  7399. dimgray: "#696969",
  7400. dimgrey: "#696969",
  7401. dodgerblue: "#1e90ff",
  7402. firebrick: "#b22222",
  7403. floralwhite: "#fffaf0",
  7404. forestgreen: "#228b22",
  7405. fuchsia: "#ff00ff",
  7406. gainsboro: "#dcdcdc",
  7407. ghostwhite: "#f8f8ff",
  7408. goldenrod: "#daa520",
  7409. gold: "#ffd700",
  7410. gray: "#808080",
  7411. green: "#008000",
  7412. greenyellow: "#adff2f",
  7413. grey: "#808080",
  7414. honeydew: "#f0fff0",
  7415. hotpink: "#ff69b4",
  7416. indianred: "#cd5c5c",
  7417. indigo: "#4b0082",
  7418. ivory: "#fffff0",
  7419. khaki: "#f0e68c",
  7420. lavenderblush: "#fff0f5",
  7421. lavender: "#e6e6fa",
  7422. lawngreen: "#7cfc00",
  7423. lemonchiffon: "#fffacd",
  7424. lightblue: "#add8e6",
  7425. lightcoral: "#f08080",
  7426. lightcyan: "#e0ffff",
  7427. lightgoldenrodyellow: "#fafad2",
  7428. lightgray: "#d3d3d3",
  7429. lightgreen: "#90ee90",
  7430. lightgrey: "#d3d3d3",
  7431. lightpink: "#ffb6c1",
  7432. lightsalmon: "#ffa07a",
  7433. lightseagreen: "#20b2aa",
  7434. lightskyblue: "#87cefa",
  7435. lightslategray: "#778899",
  7436. lightslategrey: "#778899",
  7437. lightsteelblue: "#b0c4de",
  7438. lightyellow: "#ffffe0",
  7439. lime: "#00ff00",
  7440. limegreen: "#32cd32",
  7441. linen: "#faf0e6",
  7442. magenta: "#ff00ff",
  7443. maroon: "#800000",
  7444. mediumaquamarine: "#66cdaa",
  7445. mediumblue: "#0000cd",
  7446. mediumorchid: "#ba55d3",
  7447. mediumpurple: "#9370db",
  7448. mediumseagreen: "#3cb371",
  7449. mediumslateblue: "#7b68ee",
  7450. mediumspringgreen: "#00fa9a",
  7451. mediumturquoise: "#48d1cc",
  7452. mediumvioletred: "#c71585",
  7453. midnightblue: "#191970",
  7454. mintcream: "#f5fffa",
  7455. mistyrose: "#ffe4e1",
  7456. moccasin: "#ffe4b5",
  7457. navajowhite: "#ffdead",
  7458. navy: "#000080",
  7459. oldlace: "#fdf5e6",
  7460. olive: "#808000",
  7461. olivedrab: "#6b8e23",
  7462. orange: "#ffa500",
  7463. orangered: "#ff4500",
  7464. orchid: "#da70d6",
  7465. palegoldenrod: "#eee8aa",
  7466. palegreen: "#98fb98",
  7467. paleturquoise: "#afeeee",
  7468. palevioletred: "#db7093",
  7469. papayawhip: "#ffefd5",
  7470. peachpuff: "#ffdab9",
  7471. peru: "#cd853f",
  7472. pink: "#ffc0cb",
  7473. plum: "#dda0dd",
  7474. powderblue: "#b0e0e6",
  7475. purple: "#800080",
  7476. rebeccapurple: "#663399",
  7477. red: "#ff0000",
  7478. rosybrown: "#bc8f8f",
  7479. royalblue: "#4169e1",
  7480. saddlebrown: "#8b4513",
  7481. salmon: "#fa8072",
  7482. sandybrown: "#f4a460",
  7483. seagreen: "#2e8b57",
  7484. seashell: "#fff5ee",
  7485. sienna: "#a0522d",
  7486. silver: "#c0c0c0",
  7487. skyblue: "#87ceeb",
  7488. slateblue: "#6a5acd",
  7489. slategray: "#708090",
  7490. slategrey: "#708090",
  7491. snow: "#fffafa",
  7492. springgreen: "#00ff7f",
  7493. steelblue: "#4682b4",
  7494. tan: "#d2b48c",
  7495. teal: "#008080",
  7496. thistle: "#d8bfd8",
  7497. tomato: "#ff6347",
  7498. turquoise: "#40e0d0",
  7499. violet: "#ee82ee",
  7500. wheat: "#f5deb3",
  7501. white: "#ffffff",
  7502. whitesmoke: "#f5f5f5",
  7503. yellow: "#ffff00",
  7504. yellowgreen: "#9acd32"
  7505. };
  7506. function inputToRGB(color) {
  7507. var rgb = { r: 0, g: 0, b: 0 };
  7508. var a2 = 1;
  7509. var s2 = null;
  7510. var v2 = null;
  7511. var l2 = null;
  7512. var ok = false;
  7513. var format2 = false;
  7514. if (typeof color === "string") {
  7515. color = stringInputToObject(color);
  7516. }
  7517. if (typeof color === "object") {
  7518. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  7519. rgb = rgbToRgb(color.r, color.g, color.b);
  7520. ok = true;
  7521. format2 = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  7522. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  7523. s2 = convertToPercentage(color.s);
  7524. v2 = convertToPercentage(color.v);
  7525. rgb = hsvToRgb(color.h, s2, v2);
  7526. ok = true;
  7527. format2 = "hsv";
  7528. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  7529. s2 = convertToPercentage(color.s);
  7530. l2 = convertToPercentage(color.l);
  7531. rgb = hslToRgb(color.h, s2, l2);
  7532. ok = true;
  7533. format2 = "hsl";
  7534. }
  7535. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  7536. a2 = color.a;
  7537. }
  7538. }
  7539. a2 = boundAlpha(a2);
  7540. return {
  7541. ok,
  7542. format: color.format || format2,
  7543. r: Math.min(255, Math.max(rgb.r, 0)),
  7544. g: Math.min(255, Math.max(rgb.g, 0)),
  7545. b: Math.min(255, Math.max(rgb.b, 0)),
  7546. a: a2
  7547. };
  7548. }
  7549. var CSS_INTEGER = "[-\\+]?\\d+%?";
  7550. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  7551. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  7552. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7553. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  7554. var matchers = {
  7555. CSS_UNIT: new RegExp(CSS_UNIT),
  7556. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  7557. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  7558. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  7559. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  7560. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  7561. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  7562. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7563. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  7564. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  7565. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  7566. };
  7567. function stringInputToObject(color) {
  7568. color = color.trim().toLowerCase();
  7569. if (color.length === 0) {
  7570. return false;
  7571. }
  7572. var named = false;
  7573. if (names[color]) {
  7574. color = names[color];
  7575. named = true;
  7576. } else if (color === "transparent") {
  7577. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  7578. }
  7579. var match = matchers.rgb.exec(color);
  7580. if (match) {
  7581. return { r: match[1], g: match[2], b: match[3] };
  7582. }
  7583. match = matchers.rgba.exec(color);
  7584. if (match) {
  7585. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  7586. }
  7587. match = matchers.hsl.exec(color);
  7588. if (match) {
  7589. return { h: match[1], s: match[2], l: match[3] };
  7590. }
  7591. match = matchers.hsla.exec(color);
  7592. if (match) {
  7593. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  7594. }
  7595. match = matchers.hsv.exec(color);
  7596. if (match) {
  7597. return { h: match[1], s: match[2], v: match[3] };
  7598. }
  7599. match = matchers.hsva.exec(color);
  7600. if (match) {
  7601. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  7602. }
  7603. match = matchers.hex8.exec(color);
  7604. if (match) {
  7605. return {
  7606. r: parseIntFromHex(match[1]),
  7607. g: parseIntFromHex(match[2]),
  7608. b: parseIntFromHex(match[3]),
  7609. a: convertHexToDecimal(match[4]),
  7610. format: named ? "name" : "hex8"
  7611. };
  7612. }
  7613. match = matchers.hex6.exec(color);
  7614. if (match) {
  7615. return {
  7616. r: parseIntFromHex(match[1]),
  7617. g: parseIntFromHex(match[2]),
  7618. b: parseIntFromHex(match[3]),
  7619. format: named ? "name" : "hex"
  7620. };
  7621. }
  7622. match = matchers.hex4.exec(color);
  7623. if (match) {
  7624. return {
  7625. r: parseIntFromHex(match[1] + match[1]),
  7626. g: parseIntFromHex(match[2] + match[2]),
  7627. b: parseIntFromHex(match[3] + match[3]),
  7628. a: convertHexToDecimal(match[4] + match[4]),
  7629. format: named ? "name" : "hex8"
  7630. };
  7631. }
  7632. match = matchers.hex3.exec(color);
  7633. if (match) {
  7634. return {
  7635. r: parseIntFromHex(match[1] + match[1]),
  7636. g: parseIntFromHex(match[2] + match[2]),
  7637. b: parseIntFromHex(match[3] + match[3]),
  7638. format: named ? "name" : "hex"
  7639. };
  7640. }
  7641. return false;
  7642. }
  7643. function isValidCSSUnit(color) {
  7644. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  7645. }
  7646. var TinyColor = function() {
  7647. function TinyColor2(color, opts) {
  7648. if (color === void 0) {
  7649. color = "";
  7650. }
  7651. if (opts === void 0) {
  7652. opts = {};
  7653. }
  7654. var _a2;
  7655. if (color instanceof TinyColor2) {
  7656. return color;
  7657. }
  7658. if (typeof color === "number") {
  7659. color = numberInputToObject(color);
  7660. }
  7661. this.originalInput = color;
  7662. var rgb = inputToRGB(color);
  7663. this.originalInput = color;
  7664. this.r = rgb.r;
  7665. this.g = rgb.g;
  7666. this.b = rgb.b;
  7667. this.a = rgb.a;
  7668. this.roundA = Math.round(100 * this.a) / 100;
  7669. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  7670. this.gradientType = opts.gradientType;
  7671. if (this.r < 1) {
  7672. this.r = Math.round(this.r);
  7673. }
  7674. if (this.g < 1) {
  7675. this.g = Math.round(this.g);
  7676. }
  7677. if (this.b < 1) {
  7678. this.b = Math.round(this.b);
  7679. }
  7680. this.isValid = rgb.ok;
  7681. }
  7682. TinyColor2.prototype.isDark = function() {
  7683. return this.getBrightness() < 128;
  7684. };
  7685. TinyColor2.prototype.isLight = function() {
  7686. return !this.isDark();
  7687. };
  7688. TinyColor2.prototype.getBrightness = function() {
  7689. var rgb = this.toRgb();
  7690. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  7691. };
  7692. TinyColor2.prototype.getLuminance = function() {
  7693. var rgb = this.toRgb();
  7694. var R;
  7695. var G;
  7696. var B;
  7697. var RsRGB = rgb.r / 255;
  7698. var GsRGB = rgb.g / 255;
  7699. var BsRGB = rgb.b / 255;
  7700. if (RsRGB <= 0.03928) {
  7701. R = RsRGB / 12.92;
  7702. } else {
  7703. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  7704. }
  7705. if (GsRGB <= 0.03928) {
  7706. G = GsRGB / 12.92;
  7707. } else {
  7708. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  7709. }
  7710. if (BsRGB <= 0.03928) {
  7711. B = BsRGB / 12.92;
  7712. } else {
  7713. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  7714. }
  7715. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  7716. };
  7717. TinyColor2.prototype.getAlpha = function() {
  7718. return this.a;
  7719. };
  7720. TinyColor2.prototype.setAlpha = function(alpha) {
  7721. this.a = boundAlpha(alpha);
  7722. this.roundA = Math.round(100 * this.a) / 100;
  7723. return this;
  7724. };
  7725. TinyColor2.prototype.toHsv = function() {
  7726. var hsv = rgbToHsv(this.r, this.g, this.b);
  7727. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  7728. };
  7729. TinyColor2.prototype.toHsvString = function() {
  7730. var hsv = rgbToHsv(this.r, this.g, this.b);
  7731. var h2 = Math.round(hsv.h * 360);
  7732. var s2 = Math.round(hsv.s * 100);
  7733. var v2 = Math.round(hsv.v * 100);
  7734. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%)") : "hsva(".concat(h2, ", ").concat(s2, "%, ").concat(v2, "%, ").concat(this.roundA, ")");
  7735. };
  7736. TinyColor2.prototype.toHsl = function() {
  7737. var hsl = rgbToHsl(this.r, this.g, this.b);
  7738. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  7739. };
  7740. TinyColor2.prototype.toHslString = function() {
  7741. var hsl = rgbToHsl(this.r, this.g, this.b);
  7742. var h2 = Math.round(hsl.h * 360);
  7743. var s2 = Math.round(hsl.s * 100);
  7744. var l2 = Math.round(hsl.l * 100);
  7745. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%)") : "hsla(".concat(h2, ", ").concat(s2, "%, ").concat(l2, "%, ").concat(this.roundA, ")");
  7746. };
  7747. TinyColor2.prototype.toHex = function(allow3Char) {
  7748. if (allow3Char === void 0) {
  7749. allow3Char = false;
  7750. }
  7751. return rgbToHex(this.r, this.g, this.b, allow3Char);
  7752. };
  7753. TinyColor2.prototype.toHexString = function(allow3Char) {
  7754. if (allow3Char === void 0) {
  7755. allow3Char = false;
  7756. }
  7757. return "#" + this.toHex(allow3Char);
  7758. };
  7759. TinyColor2.prototype.toHex8 = function(allow4Char) {
  7760. if (allow4Char === void 0) {
  7761. allow4Char = false;
  7762. }
  7763. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  7764. };
  7765. TinyColor2.prototype.toHex8String = function(allow4Char) {
  7766. if (allow4Char === void 0) {
  7767. allow4Char = false;
  7768. }
  7769. return "#" + this.toHex8(allow4Char);
  7770. };
  7771. TinyColor2.prototype.toRgb = function() {
  7772. return {
  7773. r: Math.round(this.r),
  7774. g: Math.round(this.g),
  7775. b: Math.round(this.b),
  7776. a: this.a
  7777. };
  7778. };
  7779. TinyColor2.prototype.toRgbString = function() {
  7780. var r = Math.round(this.r);
  7781. var g = Math.round(this.g);
  7782. var b2 = Math.round(this.b);
  7783. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b2, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b2, ", ").concat(this.roundA, ")");
  7784. };
  7785. TinyColor2.prototype.toPercentageRgb = function() {
  7786. var fmt = function(x2) {
  7787. return "".concat(Math.round(bound01(x2, 255) * 100), "%");
  7788. };
  7789. return {
  7790. r: fmt(this.r),
  7791. g: fmt(this.g),
  7792. b: fmt(this.b),
  7793. a: this.a
  7794. };
  7795. };
  7796. TinyColor2.prototype.toPercentageRgbString = function() {
  7797. var rnd = function(x2) {
  7798. return Math.round(bound01(x2, 255) * 100);
  7799. };
  7800. 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, ")");
  7801. };
  7802. TinyColor2.prototype.toName = function() {
  7803. if (this.a === 0) {
  7804. return "transparent";
  7805. }
  7806. if (this.a < 1) {
  7807. return false;
  7808. }
  7809. var hex2 = "#" + rgbToHex(this.r, this.g, this.b, false);
  7810. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  7811. var _b2 = _a2[_i], key = _b2[0], value = _b2[1];
  7812. if (hex2 === value) {
  7813. return key;
  7814. }
  7815. }
  7816. return false;
  7817. };
  7818. TinyColor2.prototype.toString = function(format2) {
  7819. var formatSet = Boolean(format2);
  7820. format2 = format2 !== null && format2 !== void 0 ? format2 : this.format;
  7821. var formattedString = false;
  7822. var hasAlpha = this.a < 1 && this.a >= 0;
  7823. var needsAlphaFormat = !formatSet && hasAlpha && (format2.startsWith("hex") || format2 === "name");
  7824. if (needsAlphaFormat) {
  7825. if (format2 === "name" && this.a === 0) {
  7826. return this.toName();
  7827. }
  7828. return this.toRgbString();
  7829. }
  7830. if (format2 === "rgb") {
  7831. formattedString = this.toRgbString();
  7832. }
  7833. if (format2 === "prgb") {
  7834. formattedString = this.toPercentageRgbString();
  7835. }
  7836. if (format2 === "hex" || format2 === "hex6") {
  7837. formattedString = this.toHexString();
  7838. }
  7839. if (format2 === "hex3") {
  7840. formattedString = this.toHexString(true);
  7841. }
  7842. if (format2 === "hex4") {
  7843. formattedString = this.toHex8String(true);
  7844. }
  7845. if (format2 === "hex8") {
  7846. formattedString = this.toHex8String();
  7847. }
  7848. if (format2 === "name") {
  7849. formattedString = this.toName();
  7850. }
  7851. if (format2 === "hsl") {
  7852. formattedString = this.toHslString();
  7853. }
  7854. if (format2 === "hsv") {
  7855. formattedString = this.toHsvString();
  7856. }
  7857. return formattedString || this.toHexString();
  7858. };
  7859. TinyColor2.prototype.toNumber = function() {
  7860. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  7861. };
  7862. TinyColor2.prototype.clone = function() {
  7863. return new TinyColor2(this.toString());
  7864. };
  7865. TinyColor2.prototype.lighten = function(amount) {
  7866. if (amount === void 0) {
  7867. amount = 10;
  7868. }
  7869. var hsl = this.toHsl();
  7870. hsl.l += amount / 100;
  7871. hsl.l = clamp01(hsl.l);
  7872. return new TinyColor2(hsl);
  7873. };
  7874. TinyColor2.prototype.brighten = function(amount) {
  7875. if (amount === void 0) {
  7876. amount = 10;
  7877. }
  7878. var rgb = this.toRgb();
  7879. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  7880. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  7881. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  7882. return new TinyColor2(rgb);
  7883. };
  7884. TinyColor2.prototype.darken = function(amount) {
  7885. if (amount === void 0) {
  7886. amount = 10;
  7887. }
  7888. var hsl = this.toHsl();
  7889. hsl.l -= amount / 100;
  7890. hsl.l = clamp01(hsl.l);
  7891. return new TinyColor2(hsl);
  7892. };
  7893. TinyColor2.prototype.tint = function(amount) {
  7894. if (amount === void 0) {
  7895. amount = 10;
  7896. }
  7897. return this.mix("white", amount);
  7898. };
  7899. TinyColor2.prototype.shade = function(amount) {
  7900. if (amount === void 0) {
  7901. amount = 10;
  7902. }
  7903. return this.mix("black", amount);
  7904. };
  7905. TinyColor2.prototype.desaturate = function(amount) {
  7906. if (amount === void 0) {
  7907. amount = 10;
  7908. }
  7909. var hsl = this.toHsl();
  7910. hsl.s -= amount / 100;
  7911. hsl.s = clamp01(hsl.s);
  7912. return new TinyColor2(hsl);
  7913. };
  7914. TinyColor2.prototype.saturate = function(amount) {
  7915. if (amount === void 0) {
  7916. amount = 10;
  7917. }
  7918. var hsl = this.toHsl();
  7919. hsl.s += amount / 100;
  7920. hsl.s = clamp01(hsl.s);
  7921. return new TinyColor2(hsl);
  7922. };
  7923. TinyColor2.prototype.greyscale = function() {
  7924. return this.desaturate(100);
  7925. };
  7926. TinyColor2.prototype.spin = function(amount) {
  7927. var hsl = this.toHsl();
  7928. var hue = (hsl.h + amount) % 360;
  7929. hsl.h = hue < 0 ? 360 + hue : hue;
  7930. return new TinyColor2(hsl);
  7931. };
  7932. TinyColor2.prototype.mix = function(color, amount) {
  7933. if (amount === void 0) {
  7934. amount = 50;
  7935. }
  7936. var rgb1 = this.toRgb();
  7937. var rgb2 = new TinyColor2(color).toRgb();
  7938. var p2 = amount / 100;
  7939. var rgba = {
  7940. r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
  7941. g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
  7942. b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
  7943. a: (rgb2.a - rgb1.a) * p2 + rgb1.a
  7944. };
  7945. return new TinyColor2(rgba);
  7946. };
  7947. TinyColor2.prototype.analogous = function(results, slices) {
  7948. if (results === void 0) {
  7949. results = 6;
  7950. }
  7951. if (slices === void 0) {
  7952. slices = 30;
  7953. }
  7954. var hsl = this.toHsl();
  7955. var part = 360 / slices;
  7956. var ret = [this];
  7957. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  7958. hsl.h = (hsl.h + part) % 360;
  7959. ret.push(new TinyColor2(hsl));
  7960. }
  7961. return ret;
  7962. };
  7963. TinyColor2.prototype.complement = function() {
  7964. var hsl = this.toHsl();
  7965. hsl.h = (hsl.h + 180) % 360;
  7966. return new TinyColor2(hsl);
  7967. };
  7968. TinyColor2.prototype.monochromatic = function(results) {
  7969. if (results === void 0) {
  7970. results = 6;
  7971. }
  7972. var hsv = this.toHsv();
  7973. var h2 = hsv.h;
  7974. var s2 = hsv.s;
  7975. var v2 = hsv.v;
  7976. var res = [];
  7977. var modification = 1 / results;
  7978. while (results--) {
  7979. res.push(new TinyColor2({ h: h2, s: s2, v: v2 }));
  7980. v2 = (v2 + modification) % 1;
  7981. }
  7982. return res;
  7983. };
  7984. TinyColor2.prototype.splitcomplement = function() {
  7985. var hsl = this.toHsl();
  7986. var h2 = hsl.h;
  7987. return [
  7988. this,
  7989. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  7990. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  7991. ];
  7992. };
  7993. TinyColor2.prototype.onBackground = function(background) {
  7994. var fg = this.toRgb();
  7995. var bg = new TinyColor2(background).toRgb();
  7996. return new TinyColor2({
  7997. r: bg.r + (fg.r - bg.r) * fg.a,
  7998. g: bg.g + (fg.g - bg.g) * fg.a,
  7999. b: bg.b + (fg.b - bg.b) * fg.a
  8000. });
  8001. };
  8002. TinyColor2.prototype.triad = function() {
  8003. return this.polyad(3);
  8004. };
  8005. TinyColor2.prototype.tetrad = function() {
  8006. return this.polyad(4);
  8007. };
  8008. TinyColor2.prototype.polyad = function(n) {
  8009. var hsl = this.toHsl();
  8010. var h2 = hsl.h;
  8011. var result = [this];
  8012. var increment = 360 / n;
  8013. for (var i = 1; i < n; i++) {
  8014. result.push(new TinyColor2({ h: (h2 + i * increment) % 360, s: hsl.s, l: hsl.l }));
  8015. }
  8016. return result;
  8017. };
  8018. TinyColor2.prototype.equals = function(color) {
  8019. return this.toRgbString() === new TinyColor2(color).toRgbString();
  8020. };
  8021. return TinyColor2;
  8022. }();
  8023. function darken(color, amount = 20) {
  8024. return color.mix("#141414", amount).toString();
  8025. }
  8026. function useButtonCustomStyle(props) {
  8027. const _disabled = useDisabled$1();
  8028. return computed(() => {
  8029. let styles = {};
  8030. const buttonColor = props.color;
  8031. if (buttonColor) {
  8032. const color = new TinyColor(buttonColor);
  8033. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  8034. if (props.plain) {
  8035. styles = {
  8036. "--el-button-bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  8037. "--el-button-text-color": buttonColor,
  8038. "--el-button-border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  8039. "--el-button-hover-text-color": "var(--el-color-white)",
  8040. "--el-button-hover-bg-color": buttonColor,
  8041. "--el-button-hover-border-color": buttonColor,
  8042. "--el-button-active-bg-color": activeBgColor,
  8043. "--el-button-active-text-color": "var(--el-color-white)",
  8044. "--el-button-active-border-color": activeBgColor
  8045. };
  8046. if (_disabled.value) {
  8047. styles["--el-button-disabled-bg-color"] = props.dark ? darken(color, 90) : color.tint(90).toString();
  8048. styles["--el-button-disabled-text-color"] = props.dark ? darken(color, 50) : color.tint(50).toString();
  8049. styles["--el-button-disabled-border-color"] = props.dark ? darken(color, 80) : color.tint(80).toString();
  8050. }
  8051. } else {
  8052. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  8053. const textColor = color.isDark() ? "var(--el-color-white)" : "var(--el-color-black)";
  8054. styles = {
  8055. "--el-button-bg-color": buttonColor,
  8056. "--el-button-text-color": textColor,
  8057. "--el-button-border-color": buttonColor,
  8058. "--el-button-hover-bg-color": hoverBgColor,
  8059. "--el-button-hover-text-color": textColor,
  8060. "--el-button-hover-border-color": hoverBgColor,
  8061. "--el-button-active-bg-color": activeBgColor,
  8062. "--el-button-active-border-color": activeBgColor
  8063. };
  8064. if (_disabled.value) {
  8065. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  8066. styles["--el-button-disabled-bg-color"] = disabledButtonColor;
  8067. styles["--el-button-disabled-text-color"] = props.dark ? "rgba(255, 255, 255, 0.5)" : "var(--el-color-white)";
  8068. styles["--el-button-disabled-border-color"] = disabledButtonColor;
  8069. }
  8070. }
  8071. }
  8072. return styles;
  8073. });
  8074. }
  8075. const _hoisted_1$D = ["disabled", "autofocus", "type"];
  8076. const __default__$f = {
  8077. name: "ElButton"
  8078. };
  8079. const _sfc_main$Z = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$f), {
  8080. props: buttonProps,
  8081. emits: buttonEmits,
  8082. setup(__props, { expose, emit }) {
  8083. const props = __props;
  8084. const slots = useSlots();
  8085. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  8086. const globalConfig2 = useGlobalConfig("button");
  8087. const ns = useNamespace("button");
  8088. const { form } = useFormItem();
  8089. const _size = useSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  8090. const _disabled = useDisabled$1();
  8091. const _ref = ref();
  8092. const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  8093. const autoInsertSpace = computed(() => {
  8094. var _a2, _b2, _c;
  8095. return (_c = (_b2 = props.autoInsertSpace) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  8096. });
  8097. const shouldAddSpace = computed(() => {
  8098. var _a2;
  8099. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  8100. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  8101. const slot = defaultSlot[0];
  8102. if ((slot == null ? void 0 : slot.type) === Text) {
  8103. const text = slot.children;
  8104. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  8105. }
  8106. }
  8107. return false;
  8108. });
  8109. const buttonStyle = useButtonCustomStyle(props);
  8110. const handleClick = (evt) => {
  8111. if (props.nativeType === "reset") {
  8112. form == null ? void 0 : form.resetFields();
  8113. }
  8114. emit("click", evt);
  8115. };
  8116. expose({
  8117. ref: _ref,
  8118. size: _size,
  8119. type: _type,
  8120. disabled: _disabled,
  8121. shouldAddSpace
  8122. });
  8123. return (_ctx, _cache) => {
  8124. return openBlock(), createElementBlock("button", {
  8125. ref_key: "_ref",
  8126. ref: _ref,
  8127. class: normalizeClass([
  8128. unref(ns).b(),
  8129. unref(ns).m(unref(_type)),
  8130. unref(ns).m(unref(_size)),
  8131. unref(ns).is("disabled", unref(_disabled)),
  8132. unref(ns).is("loading", _ctx.loading),
  8133. unref(ns).is("plain", _ctx.plain),
  8134. unref(ns).is("round", _ctx.round),
  8135. unref(ns).is("circle", _ctx.circle)
  8136. ]),
  8137. disabled: unref(_disabled) || _ctx.loading,
  8138. autofocus: _ctx.autofocus,
  8139. type: _ctx.nativeType,
  8140. style: normalizeStyle(unref(buttonStyle)),
  8141. onClick: handleClick
  8142. }, [
  8143. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  8144. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  8145. key: 1,
  8146. class: normalizeClass(unref(ns).is("loading"))
  8147. }, {
  8148. default: withCtx(() => [
  8149. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  8150. ]),
  8151. _: 1
  8152. }, 8, ["class"]))
  8153. ], 2112)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  8154. default: withCtx(() => [
  8155. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  8156. ]),
  8157. _: 3
  8158. })) : createCommentVNode("v-if", true),
  8159. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  8160. key: 2,
  8161. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  8162. }, [
  8163. renderSlot(_ctx.$slots, "default")
  8164. ], 2)) : createCommentVNode("v-if", true)
  8165. ], 14, _hoisted_1$D);
  8166. };
  8167. }
  8168. }));
  8169. var Button = /* @__PURE__ */ _export_sfc$1(_sfc_main$Z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
  8170. const buttonGroupProps = {
  8171. size: buttonProps.size,
  8172. type: buttonProps.type
  8173. };
  8174. const __default__$e = {
  8175. name: "ElButtonGroup"
  8176. };
  8177. const _sfc_main$Y = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$e), {
  8178. props: buttonGroupProps,
  8179. setup(__props) {
  8180. const props = __props;
  8181. provide(buttonGroupContextKey, reactive({
  8182. size: toRef(props, "size"),
  8183. type: toRef(props, "type")
  8184. }));
  8185. const ns = useNamespace("button");
  8186. return (_ctx, _cache) => {
  8187. return openBlock(), createElementBlock("div", {
  8188. class: normalizeClass(`${unref(ns).b("group")}`)
  8189. }, [
  8190. renderSlot(_ctx.$slots, "default")
  8191. ], 2);
  8192. };
  8193. }
  8194. }));
  8195. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$Y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
  8196. const ElButton = withInstall(Button, {
  8197. ButtonGroup
  8198. });
  8199. withNoopInstall(ButtonGroup);
  8200. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  8201. var dayjs_min = { exports: {} };
  8202. (function(module2, exports2) {
  8203. !function(t, e) {
  8204. module2.exports = e();
  8205. }(commonjsGlobal, function() {
  8206. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c2 = "month", f2 = "quarter", h2 = "year", d2 = "date", l2 = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
  8207. var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
  8208. return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
  8209. } }, m2 = function(t2, e2, n2) {
  8210. var r2 = String(t2);
  8211. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  8212. }, v2 = { s: m2, z: function(t2) {
  8213. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  8214. return (e2 <= 0 ? "+" : "-") + m2(r2, 2, "0") + ":" + m2(i2, 2, "0");
  8215. }, m: function t2(e2, n2) {
  8216. if (e2.date() < n2.date())
  8217. return -t2(n2, e2);
  8218. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c2), s3 = n2 - i2 < 0, u3 = e2.clone().add(r2 + (s3 ? -1 : 1), c2);
  8219. return +(-(r2 + (n2 - i2) / (s3 ? i2 - u3 : u3 - i2)) || 0);
  8220. }, a: function(t2) {
  8221. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  8222. }, p: function(t2) {
  8223. return { M: c2, y: h2, w: o2, d: a2, D: d2, h: u2, m: s2, s: i, ms: r, Q: f2 }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  8224. }, u: function(t2) {
  8225. return t2 === void 0;
  8226. } }, g = "en", D2 = {};
  8227. D2[g] = M2;
  8228. var p2 = "$isDayjsObject", S2 = function(t2) {
  8229. return t2 instanceof _2 || !(!t2 || !t2[p2]);
  8230. }, w2 = function t2(e2, n2, r2) {
  8231. var i2;
  8232. if (!e2)
  8233. return g;
  8234. if (typeof e2 == "string") {
  8235. var s3 = e2.toLowerCase();
  8236. D2[s3] && (i2 = s3), n2 && (D2[s3] = n2, i2 = s3);
  8237. var u3 = e2.split("-");
  8238. if (!i2 && u3.length > 1)
  8239. return t2(u3[0]);
  8240. } else {
  8241. var a3 = e2.name;
  8242. D2[a3] = e2, i2 = a3;
  8243. }
  8244. return !r2 && i2 && (g = i2), i2 || !r2 && g;
  8245. }, O2 = function(t2, e2) {
  8246. if (S2(t2))
  8247. return t2.clone();
  8248. var n2 = typeof e2 == "object" ? e2 : {};
  8249. return n2.date = t2, n2.args = arguments, new _2(n2);
  8250. }, b2 = v2;
  8251. b2.l = w2, b2.i = S2, b2.w = function(t2, e2) {
  8252. return O2(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  8253. };
  8254. var _2 = function() {
  8255. function M3(t2) {
  8256. this.$L = w2(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p2] = true;
  8257. }
  8258. var m3 = M3.prototype;
  8259. return m3.parse = function(t2) {
  8260. this.$d = function(t3) {
  8261. var e2 = t3.date, n2 = t3.utc;
  8262. if (e2 === null)
  8263. return new Date(NaN);
  8264. if (b2.u(e2))
  8265. return new Date();
  8266. if (e2 instanceof Date)
  8267. return new Date(e2);
  8268. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  8269. var r2 = e2.match($);
  8270. if (r2) {
  8271. var i2 = r2[2] - 1 || 0, s3 = (r2[7] || "0").substring(0, 3);
  8272. 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);
  8273. }
  8274. }
  8275. return new Date(e2);
  8276. }(t2), this.init();
  8277. }, m3.init = function() {
  8278. var t2 = this.$d;
  8279. 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();
  8280. }, m3.$utils = function() {
  8281. return b2;
  8282. }, m3.isValid = function() {
  8283. return !(this.$d.toString() === l2);
  8284. }, m3.isSame = function(t2, e2) {
  8285. var n2 = O2(t2);
  8286. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  8287. }, m3.isAfter = function(t2, e2) {
  8288. return O2(t2) < this.startOf(e2);
  8289. }, m3.isBefore = function(t2, e2) {
  8290. return this.endOf(e2) < O2(t2);
  8291. }, m3.$g = function(t2, e2, n2) {
  8292. return b2.u(t2) ? this[e2] : this.set(n2, t2);
  8293. }, m3.unix = function() {
  8294. return Math.floor(this.valueOf() / 1e3);
  8295. }, m3.valueOf = function() {
  8296. return this.$d.getTime();
  8297. }, m3.startOf = function(t2, e2) {
  8298. var n2 = this, r2 = !!b2.u(e2) || e2, f3 = b2.p(t2), l3 = function(t3, e3) {
  8299. var i2 = b2.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  8300. return r2 ? i2 : i2.endOf(a2);
  8301. }, $2 = function(t3, e3) {
  8302. return b2.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  8303. }, y2 = this.$W, M4 = this.$M, m4 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
  8304. switch (f3) {
  8305. case h2:
  8306. return r2 ? l3(1, 0) : l3(31, 11);
  8307. case c2:
  8308. return r2 ? l3(1, M4) : l3(0, M4 + 1);
  8309. case o2:
  8310. var g2 = this.$locale().weekStart || 0, D3 = (y2 < g2 ? y2 + 7 : y2) - g2;
  8311. return l3(r2 ? m4 - D3 : m4 + (6 - D3), M4);
  8312. case a2:
  8313. case d2:
  8314. return $2(v3 + "Hours", 0);
  8315. case u2:
  8316. return $2(v3 + "Minutes", 1);
  8317. case s2:
  8318. return $2(v3 + "Seconds", 2);
  8319. case i:
  8320. return $2(v3 + "Milliseconds", 3);
  8321. default:
  8322. return this.clone();
  8323. }
  8324. }, m3.endOf = function(t2) {
  8325. return this.startOf(t2, false);
  8326. }, m3.$set = function(t2, e2) {
  8327. var n2, o3 = b2.p(t2), f3 = "set" + (this.$u ? "UTC" : ""), l3 = (n2 = {}, n2[a2] = f3 + "Date", n2[d2] = f3 + "Date", n2[c2] = f3 + "Month", n2[h2] = f3 + "FullYear", n2[u2] = f3 + "Hours", n2[s2] = f3 + "Minutes", n2[i] = f3 + "Seconds", n2[r] = f3 + "Milliseconds", n2)[o3], $2 = o3 === a2 ? this.$D + (e2 - this.$W) : e2;
  8328. if (o3 === c2 || o3 === h2) {
  8329. var y2 = this.clone().set(d2, 1);
  8330. y2.$d[l3]($2), y2.init(), this.$d = y2.set(d2, Math.min(this.$D, y2.daysInMonth())).$d;
  8331. } else
  8332. l3 && this.$d[l3]($2);
  8333. return this.init(), this;
  8334. }, m3.set = function(t2, e2) {
  8335. return this.clone().$set(t2, e2);
  8336. }, m3.get = function(t2) {
  8337. return this[b2.p(t2)]();
  8338. }, m3.add = function(r2, f3) {
  8339. var d3, l3 = this;
  8340. r2 = Number(r2);
  8341. var $2 = b2.p(f3), y2 = function(t2) {
  8342. var e2 = O2(l3);
  8343. return b2.w(e2.date(e2.date() + Math.round(t2 * r2)), l3);
  8344. };
  8345. if ($2 === c2)
  8346. return this.set(c2, this.$M + r2);
  8347. if ($2 === h2)
  8348. return this.set(h2, this.$y + r2);
  8349. if ($2 === a2)
  8350. return y2(1);
  8351. if ($2 === o2)
  8352. return y2(7);
  8353. var M4 = (d3 = {}, d3[s2] = e, d3[u2] = n, d3[i] = t, d3)[$2] || 1, m4 = this.$d.getTime() + r2 * M4;
  8354. return b2.w(m4, this);
  8355. }, m3.subtract = function(t2, e2) {
  8356. return this.add(-1 * t2, e2);
  8357. }, m3.format = function(t2) {
  8358. var e2 = this, n2 = this.$locale();
  8359. if (!this.isValid())
  8360. return n2.invalidDate || l2;
  8361. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n2.weekdays, c3 = n2.months, f3 = n2.meridiem, h3 = function(t3, n3, i3, s4) {
  8362. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s4);
  8363. }, d3 = function(t3) {
  8364. return b2.s(s3 % 12 || 12, t3, "0");
  8365. }, $2 = f3 || function(t3, e3, n3) {
  8366. var r3 = t3 < 12 ? "AM" : "PM";
  8367. return n3 ? r3.toLowerCase() : r3;
  8368. };
  8369. return r2.replace(y, function(t3, r3) {
  8370. return r3 || function(t4) {
  8371. switch (t4) {
  8372. case "YY":
  8373. return String(e2.$y).slice(-2);
  8374. case "YYYY":
  8375. return b2.s(e2.$y, 4, "0");
  8376. case "M":
  8377. return a3 + 1;
  8378. case "MM":
  8379. return b2.s(a3 + 1, 2, "0");
  8380. case "MMM":
  8381. return h3(n2.monthsShort, a3, c3, 3);
  8382. case "MMMM":
  8383. return h3(c3, a3);
  8384. case "D":
  8385. return e2.$D;
  8386. case "DD":
  8387. return b2.s(e2.$D, 2, "0");
  8388. case "d":
  8389. return String(e2.$W);
  8390. case "dd":
  8391. return h3(n2.weekdaysMin, e2.$W, o3, 2);
  8392. case "ddd":
  8393. return h3(n2.weekdaysShort, e2.$W, o3, 3);
  8394. case "dddd":
  8395. return o3[e2.$W];
  8396. case "H":
  8397. return String(s3);
  8398. case "HH":
  8399. return b2.s(s3, 2, "0");
  8400. case "h":
  8401. return d3(1);
  8402. case "hh":
  8403. return d3(2);
  8404. case "a":
  8405. return $2(s3, u3, true);
  8406. case "A":
  8407. return $2(s3, u3, false);
  8408. case "m":
  8409. return String(u3);
  8410. case "mm":
  8411. return b2.s(u3, 2, "0");
  8412. case "s":
  8413. return String(e2.$s);
  8414. case "ss":
  8415. return b2.s(e2.$s, 2, "0");
  8416. case "SSS":
  8417. return b2.s(e2.$ms, 3, "0");
  8418. case "Z":
  8419. return i2;
  8420. }
  8421. return null;
  8422. }(t3) || i2.replace(":", "");
  8423. });
  8424. }, m3.utcOffset = function() {
  8425. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  8426. }, m3.diff = function(r2, d3, l3) {
  8427. var $2, y2 = this, M4 = b2.p(d3), m4 = O2(r2), v3 = (m4.utcOffset() - this.utcOffset()) * e, g2 = this - m4, D3 = function() {
  8428. return b2.m(y2, m4);
  8429. };
  8430. switch (M4) {
  8431. case h2:
  8432. $2 = D3() / 12;
  8433. break;
  8434. case c2:
  8435. $2 = D3();
  8436. break;
  8437. case f2:
  8438. $2 = D3() / 3;
  8439. break;
  8440. case o2:
  8441. $2 = (g2 - v3) / 6048e5;
  8442. break;
  8443. case a2:
  8444. $2 = (g2 - v3) / 864e5;
  8445. break;
  8446. case u2:
  8447. $2 = g2 / n;
  8448. break;
  8449. case s2:
  8450. $2 = g2 / e;
  8451. break;
  8452. case i:
  8453. $2 = g2 / t;
  8454. break;
  8455. default:
  8456. $2 = g2;
  8457. }
  8458. return l3 ? $2 : b2.a($2);
  8459. }, m3.daysInMonth = function() {
  8460. return this.endOf(c2).$D;
  8461. }, m3.$locale = function() {
  8462. return D2[this.$L];
  8463. }, m3.locale = function(t2, e2) {
  8464. if (!t2)
  8465. return this.$L;
  8466. var n2 = this.clone(), r2 = w2(t2, e2, true);
  8467. return r2 && (n2.$L = r2), n2;
  8468. }, m3.clone = function() {
  8469. return b2.w(this.$d, this);
  8470. }, m3.toDate = function() {
  8471. return new Date(this.valueOf());
  8472. }, m3.toJSON = function() {
  8473. return this.isValid() ? this.toISOString() : null;
  8474. }, m3.toISOString = function() {
  8475. return this.$d.toISOString();
  8476. }, m3.toString = function() {
  8477. return this.$d.toUTCString();
  8478. }, M3;
  8479. }(), k = _2.prototype;
  8480. return O2.prototype = k, [["$ms", r], ["$s", i], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c2], ["$y", h2], ["$D", d2]].forEach(function(t2) {
  8481. k[t2[1]] = function(e2) {
  8482. return this.$g(e2, t2[0], t2[1]);
  8483. };
  8484. }), O2.extend = function(t2, e2) {
  8485. return t2.$i || (t2(e2, _2, O2), t2.$i = true), O2;
  8486. }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t2) {
  8487. return O2(1e3 * t2);
  8488. }, O2.en = D2[g], O2.Ls = D2, O2.p = {}, O2;
  8489. });
  8490. })(dayjs_min);
  8491. var dayjs = dayjs_min.exports;
  8492. var localeData$1 = { exports: {} };
  8493. (function(module2, exports2) {
  8494. !function(n, e) {
  8495. module2.exports = e();
  8496. }(commonjsGlobal, function() {
  8497. return function(n, e, t) {
  8498. var r = e.prototype, o2 = function(n2) {
  8499. return n2 && (n2.indexOf ? n2 : n2.s);
  8500. }, u2 = function(n2, e2, t2, r2, u3) {
  8501. var i2 = n2.name ? n2 : n2.$locale(), a3 = o2(i2[e2]), s3 = o2(i2[t2]), f2 = a3 || s3.map(function(n3) {
  8502. return n3.slice(0, r2);
  8503. });
  8504. if (!u3)
  8505. return f2;
  8506. var d2 = i2.weekStart;
  8507. return f2.map(function(n3, e3) {
  8508. return f2[(e3 + (d2 || 0)) % 7];
  8509. });
  8510. }, i = function() {
  8511. return t.Ls[t.locale()];
  8512. }, a2 = function(n2, e2) {
  8513. return n2.formats[e2] || function(n3) {
  8514. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  8515. return e3 || t2.slice(1);
  8516. });
  8517. }(n2.formats[e2.toUpperCase()]);
  8518. }, s2 = function() {
  8519. var n2 = this;
  8520. return { months: function(e2) {
  8521. return e2 ? e2.format("MMMM") : u2(n2, "months");
  8522. }, monthsShort: function(e2) {
  8523. return e2 ? e2.format("MMM") : u2(n2, "monthsShort", "months", 3);
  8524. }, firstDayOfWeek: function() {
  8525. return n2.$locale().weekStart || 0;
  8526. }, weekdays: function(e2) {
  8527. return e2 ? e2.format("dddd") : u2(n2, "weekdays");
  8528. }, weekdaysMin: function(e2) {
  8529. return e2 ? e2.format("dd") : u2(n2, "weekdaysMin", "weekdays", 2);
  8530. }, weekdaysShort: function(e2) {
  8531. return e2 ? e2.format("ddd") : u2(n2, "weekdaysShort", "weekdays", 3);
  8532. }, longDateFormat: function(e2) {
  8533. return a2(n2.$locale(), e2);
  8534. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  8535. };
  8536. r.localeData = function() {
  8537. return s2.bind(this)();
  8538. }, t.localeData = function() {
  8539. var n2 = i();
  8540. return { firstDayOfWeek: function() {
  8541. return n2.weekStart || 0;
  8542. }, weekdays: function() {
  8543. return t.weekdays();
  8544. }, weekdaysShort: function() {
  8545. return t.weekdaysShort();
  8546. }, weekdaysMin: function() {
  8547. return t.weekdaysMin();
  8548. }, months: function() {
  8549. return t.months();
  8550. }, monthsShort: function() {
  8551. return t.monthsShort();
  8552. }, longDateFormat: function(e2) {
  8553. return a2(n2, e2);
  8554. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  8555. }, t.months = function() {
  8556. return u2(i(), "months");
  8557. }, t.monthsShort = function() {
  8558. return u2(i(), "monthsShort", "months", 3);
  8559. }, t.weekdays = function(n2) {
  8560. return u2(i(), "weekdays", null, null, n2);
  8561. }, t.weekdaysShort = function(n2) {
  8562. return u2(i(), "weekdaysShort", "weekdays", 3, n2);
  8563. }, t.weekdaysMin = function(n2) {
  8564. return u2(i(), "weekdaysMin", "weekdays", 2, n2);
  8565. };
  8566. };
  8567. });
  8568. })(localeData$1);
  8569. var localeData = localeData$1.exports;
  8570. var customParseFormat$1 = { exports: {} };
  8571. (function(module2, exports2) {
  8572. !function(e, t) {
  8573. module2.exports = t();
  8574. }(commonjsGlobal, function() {
  8575. var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o2 = /\d*[^-_:/,()\s\d]+/, s2 = {}, a2 = function(e2) {
  8576. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  8577. };
  8578. var f2 = function(e2) {
  8579. return function(t2) {
  8580. this[e2] = +t2;
  8581. };
  8582. }, h2 = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  8583. (this.zone || (this.zone = {})).offset = function(e3) {
  8584. if (!e3)
  8585. return 0;
  8586. if (e3 === "Z")
  8587. return 0;
  8588. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  8589. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  8590. }(e2);
  8591. }], u2 = function(e2) {
  8592. var t2 = s2[e2];
  8593. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  8594. }, d2 = function(e2, t2) {
  8595. var n2, r2 = s2.meridiem;
  8596. if (r2) {
  8597. for (var i2 = 1; i2 <= 24; i2 += 1)
  8598. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  8599. n2 = i2 > 12;
  8600. break;
  8601. }
  8602. } else
  8603. n2 = e2 === (t2 ? "pm" : "PM");
  8604. return n2;
  8605. }, c2 = { A: [o2, function(e2) {
  8606. this.afternoon = d2(e2, false);
  8607. }], a: [o2, function(e2) {
  8608. this.afternoon = d2(e2, true);
  8609. }], Q: [n, function(e2) {
  8610. this.month = 3 * (e2 - 1) + 1;
  8611. }], S: [n, function(e2) {
  8612. this.milliseconds = 100 * +e2;
  8613. }], SS: [r, function(e2) {
  8614. this.milliseconds = 10 * +e2;
  8615. }], SSS: [/\d{3}/, function(e2) {
  8616. this.milliseconds = +e2;
  8617. }], s: [i, f2("seconds")], ss: [i, f2("seconds")], m: [i, f2("minutes")], mm: [i, f2("minutes")], H: [i, f2("hours")], h: [i, f2("hours")], HH: [i, f2("hours")], hh: [i, f2("hours")], D: [i, f2("day")], DD: [r, f2("day")], Do: [o2, function(e2) {
  8618. var t2 = s2.ordinal, n2 = e2.match(/\d+/);
  8619. if (this.day = n2[0], t2)
  8620. for (var r2 = 1; r2 <= 31; r2 += 1)
  8621. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  8622. }], w: [i, f2("week")], ww: [r, f2("week")], M: [i, f2("month")], MM: [r, f2("month")], MMM: [o2, function(e2) {
  8623. var t2 = u2("months"), n2 = (u2("monthsShort") || t2.map(function(e3) {
  8624. return e3.slice(0, 3);
  8625. })).indexOf(e2) + 1;
  8626. if (n2 < 1)
  8627. throw new Error();
  8628. this.month = n2 % 12 || n2;
  8629. }], MMMM: [o2, function(e2) {
  8630. var t2 = u2("months").indexOf(e2) + 1;
  8631. if (t2 < 1)
  8632. throw new Error();
  8633. this.month = t2 % 12 || t2;
  8634. }], Y: [/[+-]?\d+/, f2("year")], YY: [r, function(e2) {
  8635. this.year = a2(e2);
  8636. }], YYYY: [/\d{4}/, f2("year")], Z: h2, ZZ: h2 };
  8637. function l2(n2) {
  8638. var r2, i2;
  8639. r2 = n2, i2 = s2 && s2.formats;
  8640. for (var o3 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  8641. var o4 = r3 && r3.toUpperCase();
  8642. return n3 || i2[r3] || e[r3] || i2[o4].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  8643. return t3 || n4.slice(1);
  8644. });
  8645. })).match(t), a3 = o3.length, f3 = 0; f3 < a3; f3 += 1) {
  8646. var h3 = o3[f3], u3 = c2[h3], d3 = u3 && u3[0], l3 = u3 && u3[1];
  8647. o3[f3] = l3 ? { regex: d3, parser: l3 } : h3.replace(/^\[|\]$/g, "");
  8648. }
  8649. return function(e2) {
  8650. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a3; n3 += 1) {
  8651. var i3 = o3[n3];
  8652. if (typeof i3 == "string")
  8653. r3 += i3.length;
  8654. else {
  8655. var s3 = i3.regex, f4 = i3.parser, h4 = e2.slice(r3), u4 = s3.exec(h4)[0];
  8656. f4.call(t2, u4), e2 = e2.replace(u4, "");
  8657. }
  8658. }
  8659. return function(e3) {
  8660. var t3 = e3.afternoon;
  8661. if (t3 !== void 0) {
  8662. var n4 = e3.hours;
  8663. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  8664. }
  8665. }(t2), t2;
  8666. };
  8667. }
  8668. return function(e2, t2, n2) {
  8669. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a2 = e2.parseTwoDigitYear);
  8670. var r2 = t2.prototype, i2 = r2.parse;
  8671. r2.parse = function(e3) {
  8672. var t3 = e3.date, r3 = e3.utc, o3 = e3.args;
  8673. this.$u = r3;
  8674. var a3 = o3[1];
  8675. if (typeof a3 == "string") {
  8676. var f3 = o3[2] === true, h3 = o3[3] === true, u3 = f3 || h3, d3 = o3[2];
  8677. h3 && (d3 = o3[2]), s2 = this.$locale(), !f3 && d3 && (s2 = n2.Ls[d3]), this.$d = function(e4, t4, n3, r4) {
  8678. try {
  8679. if (["x", "X"].indexOf(t4) > -1)
  8680. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  8681. var i3 = l2(t4)(e4), o4 = i3.year, s3 = i3.month, a4 = i3.day, f4 = i3.hours, h4 = i3.minutes, u4 = i3.seconds, d4 = i3.milliseconds, c4 = i3.zone, m3 = i3.week, M3 = new Date(), Y2 = a4 || (o4 || s3 ? 1 : M3.getDate()), p2 = o4 || M3.getFullYear(), v2 = 0;
  8682. o4 && !s3 || (v2 = s3 > 0 ? s3 - 1 : M3.getMonth());
  8683. var D2, w2 = f4 || 0, g = h4 || 0, y = u4 || 0, L = d4 || 0;
  8684. return c4 ? new Date(Date.UTC(p2, v2, Y2, w2, g, y, L + 60 * c4.offset * 1e3)) : n3 ? new Date(Date.UTC(p2, v2, Y2, w2, g, y, L)) : (D2 = new Date(p2, v2, Y2, w2, g, y, L), m3 && (D2 = r4(D2).week(m3).toDate()), D2);
  8685. } catch (e5) {
  8686. return new Date("");
  8687. }
  8688. }(t3, a3, r3, n2), this.init(), d3 && d3 !== true && (this.$L = this.locale(d3).$L), u3 && t3 != this.format(a3) && (this.$d = new Date("")), s2 = {};
  8689. } else if (a3 instanceof Array)
  8690. for (var c3 = a3.length, m2 = 1; m2 <= c3; m2 += 1) {
  8691. o3[1] = a3[m2 - 1];
  8692. var M2 = n2.apply(this, o3);
  8693. if (M2.isValid()) {
  8694. this.$d = M2.$d, this.$L = M2.$L, this.init();
  8695. break;
  8696. }
  8697. m2 === c3 && (this.$d = new Date(""));
  8698. }
  8699. else
  8700. i2.call(this, e3);
  8701. };
  8702. };
  8703. });
  8704. })(customParseFormat$1);
  8705. var customParseFormat = customParseFormat$1.exports;
  8706. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  8707. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  8708. const DEFAULT_FORMATS_DATEPICKER = {
  8709. date: DEFAULT_FORMATS_DATE,
  8710. week: "gggg[w]ww",
  8711. year: "YYYY",
  8712. month: "YYYY-MM",
  8713. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  8714. monthrange: "YYYY-MM",
  8715. daterange: DEFAULT_FORMATS_DATE,
  8716. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  8717. };
  8718. const timePickerDefaultProps = {
  8719. id: {
  8720. type: [Array, String]
  8721. },
  8722. name: {
  8723. type: [Array, String],
  8724. default: ""
  8725. },
  8726. popperClass: {
  8727. type: String,
  8728. default: ""
  8729. },
  8730. format: {
  8731. type: String
  8732. },
  8733. valueFormat: {
  8734. type: String
  8735. },
  8736. type: {
  8737. type: String,
  8738. default: ""
  8739. },
  8740. clearable: {
  8741. type: Boolean,
  8742. default: true
  8743. },
  8744. clearIcon: {
  8745. type: [String, Object],
  8746. default: circleClose
  8747. },
  8748. editable: {
  8749. type: Boolean,
  8750. default: true
  8751. },
  8752. prefixIcon: {
  8753. type: [String, Object],
  8754. default: ""
  8755. },
  8756. size: {
  8757. type: String,
  8758. validator: isValidComponentSize
  8759. },
  8760. readonly: {
  8761. type: Boolean,
  8762. default: false
  8763. },
  8764. disabled: {
  8765. type: Boolean,
  8766. default: false
  8767. },
  8768. placeholder: {
  8769. type: String,
  8770. default: ""
  8771. },
  8772. popperOptions: {
  8773. type: Object,
  8774. default: () => ({})
  8775. },
  8776. modelValue: {
  8777. type: [Date, Array, String, Number],
  8778. default: ""
  8779. },
  8780. rangeSeparator: {
  8781. type: String,
  8782. default: "-"
  8783. },
  8784. startPlaceholder: String,
  8785. endPlaceholder: String,
  8786. defaultValue: {
  8787. type: [Date, Array]
  8788. },
  8789. defaultTime: {
  8790. type: [Date, Array]
  8791. },
  8792. isRange: {
  8793. type: Boolean,
  8794. default: false
  8795. },
  8796. disabledHours: {
  8797. type: Function
  8798. },
  8799. disabledMinutes: {
  8800. type: Function
  8801. },
  8802. disabledSeconds: {
  8803. type: Function
  8804. },
  8805. disabledDate: {
  8806. type: Function
  8807. },
  8808. cellClassName: {
  8809. type: Function
  8810. },
  8811. shortcuts: {
  8812. type: Array,
  8813. default: () => []
  8814. },
  8815. arrowControl: {
  8816. type: Boolean,
  8817. default: false
  8818. },
  8819. validateEvent: {
  8820. type: Boolean,
  8821. default: true
  8822. },
  8823. unlinkPanels: Boolean
  8824. };
  8825. const dateEquals = function(a2, b2) {
  8826. const aIsDate = a2 instanceof Date;
  8827. const bIsDate = b2 instanceof Date;
  8828. if (aIsDate && bIsDate) {
  8829. return a2.getTime() === b2.getTime();
  8830. }
  8831. if (!aIsDate && !bIsDate) {
  8832. return a2 === b2;
  8833. }
  8834. return false;
  8835. };
  8836. const valueEquals = function(a2, b2) {
  8837. const aIsArray = Array.isArray(a2);
  8838. const bIsArray = Array.isArray(b2);
  8839. if (aIsArray && bIsArray) {
  8840. if (a2.length !== b2.length) {
  8841. return false;
  8842. }
  8843. return a2.every((item, index) => dateEquals(item, b2[index]));
  8844. }
  8845. if (!aIsArray && !bIsArray) {
  8846. return dateEquals(a2, b2);
  8847. }
  8848. return false;
  8849. };
  8850. const parser = function(date4, format2, lang) {
  8851. const day = isEmpty(format2) || format2 === "x" ? dayjs(date4).locale(lang) : dayjs(date4, format2).locale(lang);
  8852. return day.isValid() ? day : void 0;
  8853. };
  8854. const formatter = function(date4, format2, lang) {
  8855. if (isEmpty(format2))
  8856. return date4;
  8857. if (format2 === "x")
  8858. return +date4;
  8859. return dayjs(date4).locale(lang).format(format2);
  8860. };
  8861. const _sfc_main$X = defineComponent({
  8862. name: "Picker",
  8863. components: {
  8864. ElInput,
  8865. ElTooltip,
  8866. ElIcon
  8867. },
  8868. props: timePickerDefaultProps,
  8869. emits: [
  8870. "update:modelValue",
  8871. "change",
  8872. "focus",
  8873. "blur",
  8874. "calendar-change",
  8875. "panel-change",
  8876. "visible-change"
  8877. ],
  8878. setup(props, ctx) {
  8879. const { lang } = useLocale();
  8880. const nsDate = useNamespace("date");
  8881. const nsInput = useNamespace("input");
  8882. const nsRange = useNamespace("range");
  8883. const elForm2 = inject(formContextKey, {});
  8884. const elFormItem2 = inject(formItemContextKey, {});
  8885. const elPopperOptions = inject("ElPopperOptions", {});
  8886. const refPopper = ref();
  8887. const inputRef = ref();
  8888. const pickerVisible = ref(false);
  8889. const pickerActualVisible = ref(false);
  8890. const valueOnOpen = ref(null);
  8891. watch(pickerVisible, (val) => {
  8892. var _a2;
  8893. if (!val) {
  8894. userInput.value = null;
  8895. nextTick(() => {
  8896. emitChange(props.modelValue);
  8897. });
  8898. ctx.emit("blur");
  8899. blurInput();
  8900. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "blur").catch((err) => debugWarn()));
  8901. } else {
  8902. valueOnOpen.value = props.modelValue;
  8903. }
  8904. });
  8905. const emitChange = (val, isClear) => {
  8906. var _a2;
  8907. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  8908. ctx.emit("change", val);
  8909. props.validateEvent && ((_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn()));
  8910. }
  8911. };
  8912. const emitInput = (val) => {
  8913. if (!valueEquals(props.modelValue, val)) {
  8914. let formatValue;
  8915. if (Array.isArray(val)) {
  8916. formatValue = val.map((_2) => formatter(_2, props.valueFormat, lang.value));
  8917. } else if (val) {
  8918. formatValue = formatter(val, props.valueFormat, lang.value);
  8919. }
  8920. ctx.emit("update:modelValue", val ? formatValue : val, lang.value);
  8921. }
  8922. };
  8923. const refInput = computed(() => {
  8924. if (inputRef.value) {
  8925. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  8926. return Array.from(_r.querySelectorAll("input"));
  8927. }
  8928. return [];
  8929. });
  8930. const refStartInput = computed(() => {
  8931. return refInput == null ? void 0 : refInput.value[0];
  8932. });
  8933. const refEndInput = computed(() => {
  8934. return refInput == null ? void 0 : refInput.value[1];
  8935. });
  8936. const setSelectionRange = (start2, end2, pos) => {
  8937. const _inputs = refInput.value;
  8938. if (!_inputs.length)
  8939. return;
  8940. if (!pos || pos === "min") {
  8941. _inputs[0].setSelectionRange(start2, end2);
  8942. _inputs[0].focus();
  8943. } else if (pos === "max") {
  8944. _inputs[1].setSelectionRange(start2, end2);
  8945. _inputs[1].focus();
  8946. }
  8947. };
  8948. const onPick = (date4 = "", visible = false) => {
  8949. pickerVisible.value = visible;
  8950. let result;
  8951. if (Array.isArray(date4)) {
  8952. result = date4.map((_2) => _2.toDate());
  8953. } else {
  8954. result = date4 ? date4.toDate() : date4;
  8955. }
  8956. userInput.value = null;
  8957. emitInput(result);
  8958. };
  8959. const onBeforeShow = () => {
  8960. pickerActualVisible.value = true;
  8961. };
  8962. const onShow = () => {
  8963. ctx.emit("visible-change", true);
  8964. };
  8965. const onHide = () => {
  8966. pickerActualVisible.value = false;
  8967. ctx.emit("visible-change", false);
  8968. };
  8969. const focus = (focusStartInput = true) => {
  8970. let input = refStartInput.value;
  8971. if (!focusStartInput && isRangeInput.value) {
  8972. input = refEndInput.value;
  8973. }
  8974. if (input) {
  8975. input.focus();
  8976. }
  8977. };
  8978. const handleFocus = (e) => {
  8979. if (props.readonly || pickerDisabled.value || pickerVisible.value)
  8980. return;
  8981. pickerVisible.value = true;
  8982. ctx.emit("focus", e);
  8983. };
  8984. const handleBlur = () => {
  8985. var _a2;
  8986. (_a2 = refPopper.value) == null ? void 0 : _a2.onClose();
  8987. blurInput();
  8988. };
  8989. const pickerDisabled = computed(() => {
  8990. return props.disabled || elForm2.disabled;
  8991. });
  8992. const parsedValue = computed(() => {
  8993. let result;
  8994. if (valueIsEmpty.value) {
  8995. if (pickerOptions.value.getDefaultValue) {
  8996. result = pickerOptions.value.getDefaultValue();
  8997. }
  8998. } else {
  8999. if (Array.isArray(props.modelValue)) {
  9000. result = props.modelValue.map((_2) => parser(_2, props.valueFormat, lang.value));
  9001. } else {
  9002. result = parser(props.modelValue, props.valueFormat, lang.value);
  9003. }
  9004. }
  9005. if (pickerOptions.value.getRangeAvailableTime) {
  9006. const availableResult = pickerOptions.value.getRangeAvailableTime(result);
  9007. if (!isEqual$1(availableResult, result)) {
  9008. result = availableResult;
  9009. emitInput(Array.isArray(result) ? result.map((_2) => _2.toDate()) : result.toDate());
  9010. }
  9011. }
  9012. if (Array.isArray(result) && result.some((_2) => !_2)) {
  9013. result = [];
  9014. }
  9015. return result;
  9016. });
  9017. const displayValue = computed(() => {
  9018. if (!pickerOptions.value.panelReady)
  9019. return;
  9020. const formattedValue = formatDayjsToString(parsedValue.value);
  9021. if (Array.isArray(userInput.value)) {
  9022. return [
  9023. userInput.value[0] || formattedValue && formattedValue[0] || "",
  9024. userInput.value[1] || formattedValue && formattedValue[1] || ""
  9025. ];
  9026. } else if (userInput.value !== null) {
  9027. return userInput.value;
  9028. }
  9029. if (!isTimePicker.value && valueIsEmpty.value)
  9030. return;
  9031. if (!pickerVisible.value && valueIsEmpty.value)
  9032. return;
  9033. if (formattedValue) {
  9034. return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
  9035. }
  9036. return "";
  9037. });
  9038. const isTimeLikePicker = computed(() => props.type.includes("time"));
  9039. const isTimePicker = computed(() => props.type.startsWith("time"));
  9040. const isDatesPicker = computed(() => props.type === "dates");
  9041. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock : calendar));
  9042. const showClose = ref(false);
  9043. const onClearIconClick = (event) => {
  9044. if (props.readonly || pickerDisabled.value)
  9045. return;
  9046. if (showClose.value) {
  9047. event.stopPropagation();
  9048. emitInput(null);
  9049. emitChange(null, true);
  9050. showClose.value = false;
  9051. pickerVisible.value = false;
  9052. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  9053. }
  9054. };
  9055. const valueIsEmpty = computed(() => {
  9056. return !props.modelValue || Array.isArray(props.modelValue) && !props.modelValue.length;
  9057. });
  9058. const onMouseEnter = () => {
  9059. if (props.readonly || pickerDisabled.value)
  9060. return;
  9061. if (!valueIsEmpty.value && props.clearable) {
  9062. showClose.value = true;
  9063. }
  9064. };
  9065. const onMouseLeave = () => {
  9066. showClose.value = false;
  9067. };
  9068. const isRangeInput = computed(() => {
  9069. return props.type.includes("range");
  9070. });
  9071. const pickerSize = useSize();
  9072. const popperPaneRef = computed(() => {
  9073. var _a2, _b2;
  9074. return (_b2 = (_a2 = refPopper.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  9075. });
  9076. const popperEl = computed(() => {
  9077. var _a2, _b2;
  9078. return (_b2 = (_a2 = unref(refPopper)) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  9079. });
  9080. const actualInputRef = computed(() => {
  9081. var _a2;
  9082. if (unref(isRangeInput)) {
  9083. return unref(inputRef);
  9084. }
  9085. return (_a2 = unref(inputRef)) == null ? void 0 : _a2.$el;
  9086. });
  9087. onClickOutside(actualInputRef, (e) => {
  9088. const unrefedPopperEl = unref(popperEl);
  9089. const inputEl = unref(actualInputRef);
  9090. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  9091. return;
  9092. pickerVisible.value = false;
  9093. });
  9094. const userInput = ref(null);
  9095. const handleChange2 = () => {
  9096. if (userInput.value) {
  9097. const value = parseUserInputToDayjs(displayValue.value);
  9098. if (value) {
  9099. if (isValidValue(value)) {
  9100. emitInput(Array.isArray(value) ? value.map((_2) => _2.toDate()) : value.toDate());
  9101. userInput.value = null;
  9102. }
  9103. }
  9104. }
  9105. if (userInput.value === "") {
  9106. emitInput(null);
  9107. emitChange(null);
  9108. userInput.value = null;
  9109. }
  9110. };
  9111. const blurInput = () => {
  9112. refInput.value.forEach((input) => input.blur());
  9113. };
  9114. const parseUserInputToDayjs = (value) => {
  9115. if (!value)
  9116. return null;
  9117. return pickerOptions.value.parseUserInput(value);
  9118. };
  9119. const formatDayjsToString = (value) => {
  9120. if (!value)
  9121. return null;
  9122. return pickerOptions.value.formatToString(value);
  9123. };
  9124. const isValidValue = (value) => {
  9125. return pickerOptions.value.isValidValue(value);
  9126. };
  9127. const handleKeydown = (event) => {
  9128. const code = event.code;
  9129. if (code === EVENT_CODE.esc) {
  9130. pickerVisible.value = false;
  9131. event.stopPropagation();
  9132. return;
  9133. }
  9134. if (code === EVENT_CODE.tab) {
  9135. if (!isRangeInput.value) {
  9136. handleChange2();
  9137. pickerVisible.value = false;
  9138. event.stopPropagation();
  9139. } else {
  9140. setTimeout(() => {
  9141. if (!refInput.value.includes(document.activeElement)) {
  9142. pickerVisible.value = false;
  9143. blurInput();
  9144. }
  9145. }, 0);
  9146. }
  9147. return;
  9148. }
  9149. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  9150. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  9151. handleChange2();
  9152. pickerVisible.value = false;
  9153. }
  9154. event.stopPropagation();
  9155. return;
  9156. }
  9157. if (userInput.value) {
  9158. event.stopPropagation();
  9159. return;
  9160. }
  9161. if (pickerOptions.value.handleKeydown) {
  9162. pickerOptions.value.handleKeydown(event);
  9163. }
  9164. };
  9165. const onUserInput = (e) => {
  9166. userInput.value = e;
  9167. };
  9168. const handleStartInput = (event) => {
  9169. if (userInput.value) {
  9170. userInput.value = [event.target.value, userInput.value[1]];
  9171. } else {
  9172. userInput.value = [event.target.value, null];
  9173. }
  9174. };
  9175. const handleEndInput = (event) => {
  9176. if (userInput.value) {
  9177. userInput.value = [userInput.value[0], event.target.value];
  9178. } else {
  9179. userInput.value = [null, event.target.value];
  9180. }
  9181. };
  9182. const handleStartChange = () => {
  9183. const value = parseUserInputToDayjs(userInput.value && userInput.value[0]);
  9184. if (value && value.isValid()) {
  9185. userInput.value = [formatDayjsToString(value), displayValue.value[1]];
  9186. const newValue = [value, parsedValue.value && parsedValue.value[1]];
  9187. if (isValidValue(newValue)) {
  9188. emitInput(newValue);
  9189. userInput.value = null;
  9190. }
  9191. }
  9192. };
  9193. const handleEndChange = () => {
  9194. const value = parseUserInputToDayjs(userInput.value && userInput.value[1]);
  9195. if (value && value.isValid()) {
  9196. userInput.value = [displayValue.value[0], formatDayjsToString(value)];
  9197. const newValue = [parsedValue.value && parsedValue.value[0], value];
  9198. if (isValidValue(newValue)) {
  9199. emitInput(newValue);
  9200. userInput.value = null;
  9201. }
  9202. }
  9203. };
  9204. const pickerOptions = ref({});
  9205. const onSetPickerOption = (e) => {
  9206. pickerOptions.value[e[0]] = e[1];
  9207. pickerOptions.value.panelReady = true;
  9208. };
  9209. const onCalendarChange = (e) => {
  9210. ctx.emit("calendar-change", e);
  9211. };
  9212. const onPanelChange = (value, mode, view2) => {
  9213. ctx.emit("panel-change", value, mode, view2);
  9214. };
  9215. provide("EP_PICKER_BASE", {
  9216. props
  9217. });
  9218. return {
  9219. nsDate,
  9220. nsInput,
  9221. nsRange,
  9222. elPopperOptions,
  9223. isDatesPicker,
  9224. handleEndChange,
  9225. handleStartChange,
  9226. handleStartInput,
  9227. handleEndInput,
  9228. onUserInput,
  9229. handleChange: handleChange2,
  9230. handleKeydown,
  9231. popperPaneRef,
  9232. onClickOutside,
  9233. pickerSize,
  9234. isRangeInput,
  9235. onMouseLeave,
  9236. onMouseEnter,
  9237. onClearIconClick,
  9238. showClose,
  9239. triggerIcon,
  9240. onPick,
  9241. handleFocus,
  9242. handleBlur,
  9243. pickerVisible,
  9244. pickerActualVisible,
  9245. displayValue,
  9246. parsedValue,
  9247. setSelectionRange,
  9248. refPopper,
  9249. inputRef,
  9250. pickerDisabled,
  9251. onSetPickerOption,
  9252. onCalendarChange,
  9253. onPanelChange,
  9254. focus,
  9255. onShow,
  9256. onBeforeShow,
  9257. onHide
  9258. };
  9259. }
  9260. });
  9261. const _hoisted_1$C = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9262. const _hoisted_2$t = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  9263. function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
  9264. const _component_el_icon = resolveComponent("el-icon");
  9265. const _component_el_input = resolveComponent("el-input");
  9266. const _component_el_tooltip = resolveComponent("el-tooltip");
  9267. return openBlock(), createBlock(_component_el_tooltip, mergeProps({
  9268. ref: "refPopper",
  9269. visible: _ctx.pickerVisible,
  9270. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.pickerVisible = $event),
  9271. effect: "light",
  9272. pure: "",
  9273. trigger: "click"
  9274. }, _ctx.$attrs, {
  9275. "append-to-body": "",
  9276. transition: `${_ctx.nsDate.namespace.value}-zoom-in-top`,
  9277. "popper-class": [`${_ctx.nsDate.namespace.value}-picker__popper`, _ctx.popperClass],
  9278. "popper-options": _ctx.elPopperOptions,
  9279. "fallback-placements": ["bottom", "top", "right", "left"],
  9280. "gpu-acceleration": false,
  9281. "stop-popper-mouse-event": false,
  9282. "hide-after": 0,
  9283. persistent: "",
  9284. onBeforeShow: _ctx.onBeforeShow,
  9285. onShow: _ctx.onShow,
  9286. onHide: _ctx.onHide
  9287. }), {
  9288. default: withCtx(() => [
  9289. !_ctx.isRangeInput ? (openBlock(), createBlock(_component_el_input, {
  9290. key: 0,
  9291. id: _ctx.id,
  9292. ref: "inputRef",
  9293. "model-value": _ctx.displayValue,
  9294. name: _ctx.name,
  9295. size: _ctx.pickerSize,
  9296. disabled: _ctx.pickerDisabled,
  9297. placeholder: _ctx.placeholder,
  9298. class: normalizeClass([_ctx.nsDate.b("editor"), _ctx.nsDate.bm("editor", _ctx.type), _ctx.$attrs.class]),
  9299. style: normalizeStyle(_ctx.$attrs.style),
  9300. readonly: !_ctx.editable || _ctx.readonly || _ctx.isDatesPicker || _ctx.type === "week",
  9301. onInput: _ctx.onUserInput,
  9302. onFocus: _ctx.handleFocus,
  9303. onKeydown: _ctx.handleKeydown,
  9304. onChange: _ctx.handleChange,
  9305. onMouseenter: _ctx.onMouseEnter,
  9306. onMouseleave: _ctx.onMouseLeave,
  9307. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  9308. }, ["stop"]))
  9309. }, {
  9310. prefix: withCtx(() => [
  9311. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9312. key: 0,
  9313. class: normalizeClass(_ctx.nsInput.e("icon")),
  9314. onClick: _ctx.handleFocus
  9315. }, {
  9316. default: withCtx(() => [
  9317. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9318. ]),
  9319. _: 1
  9320. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9321. ]),
  9322. suffix: withCtx(() => [
  9323. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9324. key: 0,
  9325. class: normalizeClass(`${_ctx.nsInput.e("icon")} clear-icon`),
  9326. onClick: _ctx.onClearIconClick
  9327. }, {
  9328. default: withCtx(() => [
  9329. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9330. ]),
  9331. _: 1
  9332. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9333. ]),
  9334. _: 1
  9335. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "onInput", "onFocus", "onKeydown", "onChange", "onMouseenter", "onMouseleave"])) : (openBlock(), createElementBlock("div", {
  9336. key: 1,
  9337. ref: "inputRef",
  9338. class: normalizeClass([
  9339. _ctx.nsDate.b("editor"),
  9340. _ctx.nsDate.bm("editor", _ctx.type),
  9341. _ctx.nsInput.e("inner"),
  9342. _ctx.nsDate.is("disabled", _ctx.pickerDisabled),
  9343. _ctx.nsDate.is("active", _ctx.pickerVisible),
  9344. _ctx.nsRange.b("editor"),
  9345. _ctx.pickerSize ? _ctx.nsRange.bm("editor", _ctx.pickerSize) : "",
  9346. _ctx.$attrs.class
  9347. ]),
  9348. style: normalizeStyle(_ctx.$attrs.style),
  9349. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9350. onMouseenter: _cache[8] || (_cache[8] = (...args) => _ctx.onMouseEnter && _ctx.onMouseEnter(...args)),
  9351. onMouseleave: _cache[9] || (_cache[9] = (...args) => _ctx.onMouseLeave && _ctx.onMouseLeave(...args)),
  9352. onKeydown: _cache[10] || (_cache[10] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  9353. }, [
  9354. _ctx.triggerIcon ? (openBlock(), createBlock(_component_el_icon, {
  9355. key: 0,
  9356. class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsRange.e("icon")]),
  9357. onClick: _ctx.handleFocus
  9358. }, {
  9359. default: withCtx(() => [
  9360. (openBlock(), createBlock(resolveDynamicComponent(_ctx.triggerIcon)))
  9361. ]),
  9362. _: 1
  9363. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  9364. createElementVNode("input", {
  9365. id: _ctx.id && _ctx.id[0],
  9366. autocomplete: "off",
  9367. name: _ctx.name && _ctx.name[0],
  9368. placeholder: _ctx.startPlaceholder,
  9369. value: _ctx.displayValue && _ctx.displayValue[0],
  9370. disabled: _ctx.pickerDisabled,
  9371. readonly: !_ctx.editable || _ctx.readonly,
  9372. class: normalizeClass(_ctx.nsRange.b("input")),
  9373. onInput: _cache[1] || (_cache[1] = (...args) => _ctx.handleStartInput && _ctx.handleStartInput(...args)),
  9374. onChange: _cache[2] || (_cache[2] = (...args) => _ctx.handleStartChange && _ctx.handleStartChange(...args)),
  9375. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args))
  9376. }, null, 42, _hoisted_1$C),
  9377. renderSlot(_ctx.$slots, "range-separator", {}, () => [
  9378. createElementVNode("span", {
  9379. class: normalizeClass(_ctx.nsRange.b("separator"))
  9380. }, toDisplayString(_ctx.rangeSeparator), 3)
  9381. ]),
  9382. createElementVNode("input", {
  9383. id: _ctx.id && _ctx.id[1],
  9384. autocomplete: "off",
  9385. name: _ctx.name && _ctx.name[1],
  9386. placeholder: _ctx.endPlaceholder,
  9387. value: _ctx.displayValue && _ctx.displayValue[1],
  9388. disabled: _ctx.pickerDisabled,
  9389. readonly: !_ctx.editable || _ctx.readonly,
  9390. class: normalizeClass(_ctx.nsRange.b("input")),
  9391. onFocus: _cache[4] || (_cache[4] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  9392. onInput: _cache[5] || (_cache[5] = (...args) => _ctx.handleEndInput && _ctx.handleEndInput(...args)),
  9393. onChange: _cache[6] || (_cache[6] = (...args) => _ctx.handleEndChange && _ctx.handleEndChange(...args))
  9394. }, null, 42, _hoisted_2$t),
  9395. _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  9396. key: 1,
  9397. class: normalizeClass([
  9398. _ctx.nsInput.e("icon"),
  9399. _ctx.nsRange.e("close-icon"),
  9400. {
  9401. [_ctx.nsRange.e("close-icon--hidden")]: !_ctx.showClose
  9402. }
  9403. ]),
  9404. onClick: _ctx.onClearIconClick
  9405. }, {
  9406. default: withCtx(() => [
  9407. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  9408. ]),
  9409. _: 1
  9410. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  9411. ], 38))
  9412. ]),
  9413. content: withCtx(() => [
  9414. renderSlot(_ctx.$slots, "default", {
  9415. visible: _ctx.pickerVisible,
  9416. actualVisible: _ctx.pickerActualVisible,
  9417. parsedValue: _ctx.parsedValue,
  9418. format: _ctx.format,
  9419. unlinkPanels: _ctx.unlinkPanels,
  9420. type: _ctx.type,
  9421. defaultValue: _ctx.defaultValue,
  9422. onPick: _cache[11] || (_cache[11] = (...args) => _ctx.onPick && _ctx.onPick(...args)),
  9423. onSelectRange: _cache[12] || (_cache[12] = (...args) => _ctx.setSelectionRange && _ctx.setSelectionRange(...args)),
  9424. onSetPickerOption: _cache[13] || (_cache[13] = (...args) => _ctx.onSetPickerOption && _ctx.onSetPickerOption(...args)),
  9425. onCalendarChange: _cache[14] || (_cache[14] = (...args) => _ctx.onCalendarChange && _ctx.onCalendarChange(...args)),
  9426. onPanelChange: _cache[15] || (_cache[15] = (...args) => _ctx.onPanelChange && _ctx.onPanelChange(...args)),
  9427. onMousedown: _cache[16] || (_cache[16] = withModifiers(() => {
  9428. }, ["stop"]))
  9429. })
  9430. ]),
  9431. _: 3
  9432. }, 16, ["visible", "transition", "popper-class", "popper-options", "onBeforeShow", "onShow", "onHide"]);
  9433. }
  9434. var CommonPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$X, [["render", _sfc_render$z], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/common/picker.vue"]]);
  9435. const nodeList = /* @__PURE__ */ new Map();
  9436. let startClick;
  9437. if (isClient) {
  9438. document.addEventListener("mousedown", (e) => startClick = e);
  9439. document.addEventListener("mouseup", (e) => {
  9440. for (const handlers of nodeList.values()) {
  9441. for (const { documentHandler } of handlers) {
  9442. documentHandler(e, startClick);
  9443. }
  9444. }
  9445. });
  9446. }
  9447. function createDocumentHandler(el, binding) {
  9448. let excludes = [];
  9449. if (Array.isArray(binding.arg)) {
  9450. excludes = binding.arg;
  9451. } else if (isElement$1(binding.arg)) {
  9452. excludes.push(binding.arg);
  9453. }
  9454. return function(mouseup, mousedown) {
  9455. const popperRef = binding.instance.popperRef;
  9456. const mouseUpTarget = mouseup.target;
  9457. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  9458. const isBound = !binding || !binding.instance;
  9459. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  9460. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  9461. const isSelf = el === mouseUpTarget;
  9462. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  9463. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  9464. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  9465. return;
  9466. }
  9467. binding.value(mouseup, mousedown);
  9468. };
  9469. }
  9470. const ClickOutside = {
  9471. beforeMount(el, binding) {
  9472. if (!nodeList.has(el)) {
  9473. nodeList.set(el, []);
  9474. }
  9475. nodeList.get(el).push({
  9476. documentHandler: createDocumentHandler(el, binding),
  9477. bindingFn: binding.value
  9478. });
  9479. },
  9480. updated(el, binding) {
  9481. if (!nodeList.has(el)) {
  9482. nodeList.set(el, []);
  9483. }
  9484. const handlers = nodeList.get(el);
  9485. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  9486. const newHandler = {
  9487. documentHandler: createDocumentHandler(el, binding),
  9488. bindingFn: binding.value
  9489. };
  9490. if (oldHandlerIndex >= 0) {
  9491. handlers.splice(oldHandlerIndex, 1, newHandler);
  9492. } else {
  9493. handlers.push(newHandler);
  9494. }
  9495. },
  9496. unmounted(el) {
  9497. nodeList.delete(el);
  9498. }
  9499. };
  9500. var RepeatClick = {
  9501. beforeMount(el, binding) {
  9502. let interval = null;
  9503. let startTime;
  9504. const handler3 = () => binding.value && binding.value();
  9505. const clear = () => {
  9506. if (Date.now() - startTime < 100) {
  9507. handler3();
  9508. }
  9509. clearInterval(interval);
  9510. interval = null;
  9511. };
  9512. on(el, "mousedown", (e) => {
  9513. if (e.button !== 0)
  9514. return;
  9515. startTime = Date.now();
  9516. once(document, "mouseup", clear);
  9517. clearInterval(interval);
  9518. interval = setInterval(handler3, 100);
  9519. });
  9520. }
  9521. };
  9522. var v = false, o, f, s, u, d, N, l, p, m, w, D, x, E, M, F;
  9523. function a() {
  9524. if (!v) {
  9525. v = true;
  9526. 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);
  9527. if (x = /\b(iPhone|iP[ao]d)/.exec(e), E = /\b(iP[ao]d)/.exec(e), w = /Android/i.exec(e), M = /FBAN\/\w+;/i.exec(e), F = /Mobile/i.exec(e), D = !!/Win64/.exec(e), n) {
  9528. o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
  9529. var r = /(?:Trident\/(\d+.\d+))/.exec(e);
  9530. N = r ? parseFloat(r[1]) + 4 : o, f = n[2] ? parseFloat(n[2]) : NaN, s = n[3] ? parseFloat(n[3]) : NaN, u = n[4] ? parseFloat(n[4]) : NaN, u ? (n = /(?:Chrome\/(\d+\.\d+))/.exec(e), d = n && n[1] ? parseFloat(n[1]) : NaN) : d = NaN;
  9531. } else
  9532. o = f = s = d = u = NaN;
  9533. if (i) {
  9534. if (i[1]) {
  9535. var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
  9536. l = t ? parseFloat(t[1].replace("_", ".")) : true;
  9537. } else
  9538. l = false;
  9539. p = !!i[2], m = !!i[3];
  9540. } else
  9541. l = p = m = false;
  9542. }
  9543. }
  9544. var _ = { ie: function() {
  9545. return a() || o;
  9546. }, ieCompatibilityMode: function() {
  9547. return a() || N > o;
  9548. }, ie64: function() {
  9549. return _.ie() && D;
  9550. }, firefox: function() {
  9551. return a() || f;
  9552. }, opera: function() {
  9553. return a() || s;
  9554. }, webkit: function() {
  9555. return a() || u;
  9556. }, safari: function() {
  9557. return _.webkit();
  9558. }, chrome: function() {
  9559. return a() || d;
  9560. }, windows: function() {
  9561. return a() || p;
  9562. }, osx: function() {
  9563. return a() || l;
  9564. }, linux: function() {
  9565. return a() || m;
  9566. }, iphone: function() {
  9567. return a() || x;
  9568. }, mobile: function() {
  9569. return a() || x || E || w || F;
  9570. }, nativeApp: function() {
  9571. return a() || M;
  9572. }, android: function() {
  9573. return a() || w;
  9574. }, ipad: function() {
  9575. return a() || E;
  9576. } }, A = _;
  9577. var c = !!(typeof window < "u" && window.document && window.document.createElement), U = { canUseDOM: c, canUseWorkers: typeof Worker < "u", canUseEventListeners: c && !!(window.addEventListener || window.attachEvent), canUseViewport: c && !!window.screen, isInWorker: !c }, h = U;
  9578. var X;
  9579. h.canUseDOM && (X = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true);
  9580. function S(e, n) {
  9581. if (!h.canUseDOM || n && !("addEventListener" in document))
  9582. return false;
  9583. var i = "on" + e, r = i in document;
  9584. if (!r) {
  9585. var t = document.createElement("div");
  9586. t.setAttribute(i, "return;"), r = typeof t[i] == "function";
  9587. }
  9588. return !r && X && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
  9589. }
  9590. var b = S;
  9591. var O = 10, I = 40, P = 800;
  9592. function T(e) {
  9593. var n = 0, i = 0, r = 0, t = 0;
  9594. return "detail" in e && (i = e.detail), "wheelDelta" in e && (i = -e.wheelDelta / 120), "wheelDeltaY" in e && (i = -e.wheelDeltaY / 120), "wheelDeltaX" in e && (n = -e.wheelDeltaX / 120), "axis" in e && e.axis === e.HORIZONTAL_AXIS && (n = i, i = 0), r = n * O, t = i * O, "deltaY" in e && (t = e.deltaY), "deltaX" in e && (r = e.deltaX), (r || t) && e.deltaMode && (e.deltaMode == 1 ? (r *= I, t *= I) : (r *= P, t *= P)), r && !n && (n = r < 1 ? -1 : 1), t && !i && (i = t < 1 ? -1 : 1), { spinX: n, spinY: i, pixelX: r, pixelY: t };
  9595. }
  9596. T.getEventType = function() {
  9597. return A.firefox() ? "DOMMouseScroll" : b("wheel") ? "wheel" : "mousewheel";
  9598. };
  9599. var Y = T;
  9600. /**
  9601. * Checks if an event is supported in the current execution environment.
  9602. *
  9603. * NOTE: This will not work correctly for non-generic events such as `change`,
  9604. * `reset`, `load`, `error`, and `select`.
  9605. *
  9606. * Borrows from Modernizr.
  9607. *
  9608. * @param {string} eventNameSuffix Event name, e.g. "click".
  9609. * @param {?boolean} capture Check if the capture phase is supported.
  9610. * @return {boolean} True if the event is supported.
  9611. * @internal
  9612. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  9613. */
  9614. const mousewheel = function(element, callback) {
  9615. if (element && element.addEventListener) {
  9616. const fn2 = function(event) {
  9617. const normalized = Y(event);
  9618. callback && Reflect.apply(callback, this, [event, normalized]);
  9619. };
  9620. if (isFirefox()) {
  9621. element.addEventListener("DOMMouseScroll", fn2);
  9622. } else {
  9623. element.onmousewheel = fn2;
  9624. }
  9625. }
  9626. };
  9627. const Mousewheel = {
  9628. beforeMount(el, binding) {
  9629. mousewheel(el, binding.value);
  9630. }
  9631. };
  9632. const makeList = (total2, method4, methodFunc) => {
  9633. const arr = [];
  9634. const disabledArr = method4 && methodFunc();
  9635. for (let i = 0; i < total2; i++) {
  9636. arr[i] = disabledArr ? disabledArr.includes(i) : false;
  9637. }
  9638. return arr;
  9639. };
  9640. const makeAvailableArr = (list) => {
  9641. return list.map((_2, index) => !_2 ? index : _2).filter((_2) => _2 !== true);
  9642. };
  9643. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  9644. const getHoursList = (role, compare) => {
  9645. return makeList(24, disabledHours, () => disabledHours(role, compare));
  9646. };
  9647. const getMinutesList = (hour, role, compare) => {
  9648. return makeList(60, disabledMinutes, () => disabledMinutes(hour, role, compare));
  9649. };
  9650. const getSecondsList = (hour, minute, role, compare) => {
  9651. return makeList(60, disabledSeconds, () => disabledSeconds(hour, minute, role, compare));
  9652. };
  9653. return {
  9654. getHoursList,
  9655. getMinutesList,
  9656. getSecondsList
  9657. };
  9658. };
  9659. const getAvailableArrs = (disabledHours, disabledMinutes, disabledSeconds) => {
  9660. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  9661. const getAvailableHours = (role, compare) => {
  9662. return makeAvailableArr(getHoursList(role, compare));
  9663. };
  9664. const getAvailableMinutes = (hour, role, compare) => {
  9665. return makeAvailableArr(getMinutesList(hour, role, compare));
  9666. };
  9667. const getAvailableSeconds = (hour, minute, role, compare) => {
  9668. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  9669. };
  9670. return {
  9671. getAvailableHours,
  9672. getAvailableMinutes,
  9673. getAvailableSeconds
  9674. };
  9675. };
  9676. const useOldValue = (props) => {
  9677. const oldValue = ref(props.parsedValue);
  9678. watch(() => props.visible, (val) => {
  9679. if (!val) {
  9680. oldValue.value = props.parsedValue;
  9681. }
  9682. });
  9683. return oldValue;
  9684. };
  9685. const _sfc_main$W = defineComponent({
  9686. directives: {
  9687. repeatClick: RepeatClick
  9688. },
  9689. components: {
  9690. ElScrollbar,
  9691. ElIcon,
  9692. ArrowUp: arrowUp,
  9693. ArrowDown: arrowDown
  9694. },
  9695. props: {
  9696. role: {
  9697. type: String,
  9698. required: true
  9699. },
  9700. spinnerDate: {
  9701. type: Object,
  9702. required: true
  9703. },
  9704. showSeconds: {
  9705. type: Boolean,
  9706. default: true
  9707. },
  9708. arrowControl: Boolean,
  9709. amPmMode: {
  9710. type: String,
  9711. default: ""
  9712. },
  9713. disabledHours: {
  9714. type: Function
  9715. },
  9716. disabledMinutes: {
  9717. type: Function
  9718. },
  9719. disabledSeconds: {
  9720. type: Function
  9721. }
  9722. },
  9723. emits: ["change", "select-range", "set-option"],
  9724. setup(props, ctx) {
  9725. const ns = useNamespace("time");
  9726. let isScrolling = false;
  9727. const debouncedResetScroll = debounce$1((type4) => {
  9728. isScrolling = false;
  9729. adjustCurrentSpinner(type4);
  9730. }, 200);
  9731. const currentScrollbar = ref(null);
  9732. const listHoursRef = ref(null);
  9733. const listMinutesRef = ref(null);
  9734. const listSecondsRef = ref(null);
  9735. const listRefsMap = {
  9736. hours: listHoursRef,
  9737. minutes: listMinutesRef,
  9738. seconds: listSecondsRef
  9739. };
  9740. const spinnerItems = computed(() => {
  9741. const arr = ["hours", "minutes", "seconds"];
  9742. return props.showSeconds ? arr : arr.slice(0, 2);
  9743. });
  9744. const hours = computed(() => {
  9745. return props.spinnerDate.hour();
  9746. });
  9747. const minutes = computed(() => {
  9748. return props.spinnerDate.minute();
  9749. });
  9750. const seconds = computed(() => {
  9751. return props.spinnerDate.second();
  9752. });
  9753. const timePartsMap = computed(() => ({
  9754. hours,
  9755. minutes,
  9756. seconds
  9757. }));
  9758. const hoursList = computed(() => {
  9759. return getHoursList(props.role);
  9760. });
  9761. const minutesList = computed(() => {
  9762. return getMinutesList(hours.value, props.role);
  9763. });
  9764. const secondsList = computed(() => {
  9765. return getSecondsList(hours.value, minutes.value, props.role);
  9766. });
  9767. const listMap = computed(() => ({
  9768. hours: hoursList,
  9769. minutes: minutesList,
  9770. seconds: secondsList
  9771. }));
  9772. const arrowHourList = computed(() => {
  9773. const hour = hours.value;
  9774. return [
  9775. hour > 0 ? hour - 1 : void 0,
  9776. hour,
  9777. hour < 23 ? hour + 1 : void 0
  9778. ];
  9779. });
  9780. const arrowMinuteList = computed(() => {
  9781. const minute = minutes.value;
  9782. return [
  9783. minute > 0 ? minute - 1 : void 0,
  9784. minute,
  9785. minute < 59 ? minute + 1 : void 0
  9786. ];
  9787. });
  9788. const arrowSecondList = computed(() => {
  9789. const second = seconds.value;
  9790. return [
  9791. second > 0 ? second - 1 : void 0,
  9792. second,
  9793. second < 59 ? second + 1 : void 0
  9794. ];
  9795. });
  9796. const arrowListMap = computed(() => ({
  9797. hours: arrowHourList,
  9798. minutes: arrowMinuteList,
  9799. seconds: arrowSecondList
  9800. }));
  9801. const getAmPmFlag = (hour) => {
  9802. const shouldShowAmPm = !!props.amPmMode;
  9803. if (!shouldShowAmPm)
  9804. return "";
  9805. const isCapital = props.amPmMode === "A";
  9806. let content2 = hour < 12 ? " am" : " pm";
  9807. if (isCapital)
  9808. content2 = content2.toUpperCase();
  9809. return content2;
  9810. };
  9811. const emitSelectRange = (type4) => {
  9812. if (type4 === "hours") {
  9813. ctx.emit("select-range", 0, 2);
  9814. } else if (type4 === "minutes") {
  9815. ctx.emit("select-range", 3, 5);
  9816. } else if (type4 === "seconds") {
  9817. ctx.emit("select-range", 6, 8);
  9818. }
  9819. currentScrollbar.value = type4;
  9820. };
  9821. const adjustCurrentSpinner = (type4) => {
  9822. adjustSpinner(type4, timePartsMap.value[type4].value);
  9823. };
  9824. const adjustSpinners = () => {
  9825. adjustCurrentSpinner("hours");
  9826. adjustCurrentSpinner("minutes");
  9827. adjustCurrentSpinner("seconds");
  9828. };
  9829. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  9830. const adjustSpinner = (type4, value) => {
  9831. if (props.arrowControl)
  9832. return;
  9833. const el = listRefsMap[type4];
  9834. if (el && el.$el) {
  9835. getScrollbarElement(el.$el).scrollTop = Math.max(0, value * typeItemHeight(type4));
  9836. }
  9837. };
  9838. const typeItemHeight = (type4) => {
  9839. const el = listRefsMap[type4];
  9840. return el.$el.querySelector("li").offsetHeight;
  9841. };
  9842. const onIncreaseClick = () => {
  9843. scrollDown(1);
  9844. };
  9845. const onDecreaseClick = () => {
  9846. scrollDown(-1);
  9847. };
  9848. const scrollDown = (step) => {
  9849. if (!currentScrollbar.value) {
  9850. emitSelectRange("hours");
  9851. }
  9852. const label = currentScrollbar.value;
  9853. let now2 = timePartsMap.value[label].value;
  9854. const total2 = currentScrollbar.value === "hours" ? 24 : 60;
  9855. now2 = (now2 + step + total2) % total2;
  9856. modifyDateField(label, now2);
  9857. adjustSpinner(label, now2);
  9858. nextTick(() => emitSelectRange(currentScrollbar.value));
  9859. };
  9860. const modifyDateField = (type4, value) => {
  9861. const list = listMap.value[type4].value;
  9862. const isDisabled = list[value];
  9863. if (isDisabled)
  9864. return;
  9865. switch (type4) {
  9866. case "hours":
  9867. ctx.emit("change", props.spinnerDate.hour(value).minute(minutes.value).second(seconds.value));
  9868. break;
  9869. case "minutes":
  9870. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(value).second(seconds.value));
  9871. break;
  9872. case "seconds":
  9873. ctx.emit("change", props.spinnerDate.hour(hours.value).minute(minutes.value).second(value));
  9874. break;
  9875. }
  9876. };
  9877. const handleClick = (type4, { value, disabled }) => {
  9878. if (!disabled) {
  9879. modifyDateField(type4, value);
  9880. emitSelectRange(type4);
  9881. adjustSpinner(type4, value);
  9882. }
  9883. };
  9884. const handleScroll = (type4) => {
  9885. isScrolling = true;
  9886. debouncedResetScroll(type4);
  9887. 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);
  9888. modifyDateField(type4, value);
  9889. };
  9890. const scrollBarHeight = (type4) => {
  9891. return listRefsMap[type4].$el.offsetHeight;
  9892. };
  9893. const bindScrollEvent = () => {
  9894. const bindFunction = (type4) => {
  9895. if (listRefsMap[type4] && listRefsMap[type4].$el) {
  9896. getScrollbarElement(listRefsMap[type4].$el).onscroll = () => {
  9897. handleScroll(type4);
  9898. };
  9899. }
  9900. };
  9901. bindFunction("hours");
  9902. bindFunction("minutes");
  9903. bindFunction("seconds");
  9904. };
  9905. onMounted(() => {
  9906. nextTick(() => {
  9907. !props.arrowControl && bindScrollEvent();
  9908. adjustSpinners();
  9909. if (props.role === "start")
  9910. emitSelectRange("hours");
  9911. });
  9912. });
  9913. const setRef = (scrollbar, type4) => {
  9914. listRefsMap[type4] = scrollbar;
  9915. };
  9916. ctx.emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  9917. ctx.emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  9918. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  9919. watch(() => props.spinnerDate, () => {
  9920. if (isScrolling)
  9921. return;
  9922. adjustSpinners();
  9923. });
  9924. return {
  9925. ns,
  9926. setRef,
  9927. spinnerItems,
  9928. currentScrollbar,
  9929. hours,
  9930. minutes,
  9931. seconds,
  9932. hoursList,
  9933. minutesList,
  9934. arrowHourList,
  9935. arrowMinuteList,
  9936. arrowSecondList,
  9937. getAmPmFlag,
  9938. emitSelectRange,
  9939. adjustCurrentSpinner,
  9940. typeItemHeight,
  9941. listHoursRef,
  9942. listMinutesRef,
  9943. listSecondsRef,
  9944. onIncreaseClick,
  9945. onDecreaseClick,
  9946. handleClick,
  9947. secondsList,
  9948. timePartsMap,
  9949. arrowListMap,
  9950. listMap
  9951. };
  9952. }
  9953. });
  9954. const _hoisted_1$B = ["onClick"];
  9955. const _hoisted_2$s = ["onMouseenter"];
  9956. function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
  9957. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  9958. const _component_arrow_up = resolveComponent("arrow-up");
  9959. const _component_el_icon = resolveComponent("el-icon");
  9960. const _component_arrow_down = resolveComponent("arrow-down");
  9961. const _directive_repeat_click = resolveDirective("repeat-click");
  9962. return openBlock(), createElementBlock("div", {
  9963. class: normalizeClass([_ctx.ns.b("spinner"), { "has-seconds": _ctx.showSeconds }])
  9964. }, [
  9965. !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.spinnerItems, (item) => {
  9966. return openBlock(), createBlock(_component_el_scrollbar, {
  9967. key: item,
  9968. ref_for: true,
  9969. ref: (scollbar) => _ctx.setRef(scollbar, item),
  9970. class: normalizeClass(_ctx.ns.be("spinner", "wrapper")),
  9971. "wrap-style": "max-height: inherit;",
  9972. "view-class": _ctx.ns.be("spinner", "list"),
  9973. noresize: "",
  9974. tag: "ul",
  9975. onMouseenter: ($event) => _ctx.emitSelectRange(item),
  9976. onMousemove: ($event) => _ctx.adjustCurrentSpinner(item)
  9977. }, {
  9978. default: withCtx(() => [
  9979. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listMap[item].value, (disabled, key) => {
  9980. return openBlock(), createElementBlock("li", {
  9981. key,
  9982. class: normalizeClass([
  9983. _ctx.ns.be("spinner", "item"),
  9984. _ctx.ns.is("active", key === _ctx.timePartsMap[item].value),
  9985. _ctx.ns.is("disabled", disabled)
  9986. ]),
  9987. onClick: ($event) => _ctx.handleClick(item, { value: key, disabled })
  9988. }, [
  9989. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  9990. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(key)), 1)
  9991. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  9992. createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
  9993. ], 2112))
  9994. ], 10, _hoisted_1$B);
  9995. }), 128))
  9996. ]),
  9997. _: 2
  9998. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  9999. }), 128)) : createCommentVNode("v-if", true),
  10000. _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.spinnerItems, (item) => {
  10001. return openBlock(), createElementBlock("div", {
  10002. key: item,
  10003. class: normalizeClass([_ctx.ns.be("spinner", "wrapper"), _ctx.ns.is("arrow")]),
  10004. onMouseenter: ($event) => _ctx.emitSelectRange(item)
  10005. }, [
  10006. withDirectives((openBlock(), createBlock(_component_el_icon, {
  10007. class: normalizeClass(["arrow-up", _ctx.ns.be("spinner", "arrow")])
  10008. }, {
  10009. default: withCtx(() => [
  10010. createVNode(_component_arrow_up)
  10011. ]),
  10012. _: 1
  10013. }, 8, ["class"])), [
  10014. [_directive_repeat_click, _ctx.onDecreaseClick]
  10015. ]),
  10016. withDirectives((openBlock(), createBlock(_component_el_icon, {
  10017. class: normalizeClass(["arrow-down", _ctx.ns.be("spinner", "arrow")])
  10018. }, {
  10019. default: withCtx(() => [
  10020. createVNode(_component_arrow_down)
  10021. ]),
  10022. _: 1
  10023. }, 8, ["class"])), [
  10024. [_directive_repeat_click, _ctx.onIncreaseClick]
  10025. ]),
  10026. createElementVNode("ul", {
  10027. class: normalizeClass(_ctx.ns.be("spinner", "list"))
  10028. }, [
  10029. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.arrowListMap[item].value, (time, key) => {
  10030. return openBlock(), createElementBlock("li", {
  10031. key,
  10032. class: normalizeClass([
  10033. _ctx.ns.be("spinner", "item"),
  10034. _ctx.ns.is("active", time === _ctx.timePartsMap[item].value),
  10035. _ctx.ns.is("disabled", _ctx.listMap[item].value[time])
  10036. ])
  10037. }, [
  10038. typeof time === "number" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10039. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10040. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(_ctx.getAmPmFlag(time)), 1)
  10041. ], 2112)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  10042. createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
  10043. ], 2112))
  10044. ], 2112)) : createCommentVNode("v-if", true)
  10045. ], 2);
  10046. }), 128))
  10047. ], 2)
  10048. ], 42, _hoisted_2$s);
  10049. }), 128)) : createCommentVNode("v-if", true)
  10050. ], 2);
  10051. }
  10052. var TimeSpinner = /* @__PURE__ */ _export_sfc$1(_sfc_main$W, [["render", _sfc_render$y], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue"]]);
  10053. const _sfc_main$V = defineComponent({
  10054. components: {
  10055. TimeSpinner
  10056. },
  10057. props: {
  10058. visible: Boolean,
  10059. actualVisible: {
  10060. type: Boolean,
  10061. default: void 0
  10062. },
  10063. datetimeRole: {
  10064. type: String
  10065. },
  10066. parsedValue: {
  10067. type: [Object, String]
  10068. },
  10069. format: {
  10070. type: String,
  10071. default: ""
  10072. }
  10073. },
  10074. emits: ["pick", "select-range", "set-picker-option"],
  10075. setup(props, ctx) {
  10076. const ns = useNamespace("time");
  10077. const { t, lang } = useLocale();
  10078. const selectionRange = ref([0, 2]);
  10079. const oldValue = useOldValue(props);
  10080. const transitionName = computed(() => {
  10081. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  10082. });
  10083. const showSeconds = computed(() => {
  10084. return props.format.includes("ss");
  10085. });
  10086. const amPmMode = computed(() => {
  10087. if (props.format.includes("A"))
  10088. return "A";
  10089. if (props.format.includes("a"))
  10090. return "a";
  10091. return "";
  10092. });
  10093. const isValidValue = (_date) => {
  10094. const parsedDate = dayjs(_date).locale(lang.value);
  10095. const result = getRangeAvailableTime(parsedDate);
  10096. return parsedDate.isSame(result);
  10097. };
  10098. const handleCancel = () => {
  10099. ctx.emit("pick", oldValue.value, false);
  10100. };
  10101. const handleConfirm = (visible = false, first = false) => {
  10102. if (first)
  10103. return;
  10104. ctx.emit("pick", props.parsedValue, visible);
  10105. };
  10106. const handleChange2 = (_date) => {
  10107. if (!props.visible) {
  10108. return;
  10109. }
  10110. const result = getRangeAvailableTime(_date).millisecond(0);
  10111. ctx.emit("pick", result, true);
  10112. };
  10113. const setSelectionRange = (start2, end2) => {
  10114. ctx.emit("select-range", start2, end2);
  10115. selectionRange.value = [start2, end2];
  10116. };
  10117. const changeSelectionRange = (step) => {
  10118. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  10119. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  10120. const index = list.indexOf(selectionRange.value[0]);
  10121. const next = (index + step + list.length) % list.length;
  10122. timePickerOptions["start_emitSelectRange"](mapping[next]);
  10123. };
  10124. const handleKeydown = (event) => {
  10125. const code = event.code;
  10126. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  10127. const step = code === EVENT_CODE.left ? -1 : 1;
  10128. changeSelectionRange(step);
  10129. event.preventDefault();
  10130. return;
  10131. }
  10132. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  10133. const step = code === EVENT_CODE.up ? -1 : 1;
  10134. timePickerOptions["start_scrollDown"](step);
  10135. event.preventDefault();
  10136. return;
  10137. }
  10138. };
  10139. const getRangeAvailableTime = (date4) => {
  10140. const availableMap = {
  10141. hour: getAvailableHours,
  10142. minute: getAvailableMinutes,
  10143. second: getAvailableSeconds
  10144. };
  10145. let result = date4;
  10146. ["hour", "minute", "second"].forEach((_2) => {
  10147. if (availableMap[_2]) {
  10148. let availableArr;
  10149. const method4 = availableMap[_2];
  10150. if (_2 === "minute") {
  10151. availableArr = method4(result.hour(), props.datetimeRole);
  10152. } else if (_2 === "second") {
  10153. availableArr = method4(result.hour(), result.minute(), props.datetimeRole);
  10154. } else {
  10155. availableArr = method4(props.datetimeRole);
  10156. }
  10157. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10158. result = result[_2](availableArr[0]);
  10159. }
  10160. }
  10161. });
  10162. return result;
  10163. };
  10164. const parseUserInput = (value) => {
  10165. if (!value)
  10166. return null;
  10167. return dayjs(value, props.format).locale(lang.value);
  10168. };
  10169. const formatToString = (value) => {
  10170. if (!value)
  10171. return null;
  10172. return value.format(props.format);
  10173. };
  10174. const getDefaultValue = () => {
  10175. return dayjs(defaultValue).locale(lang.value);
  10176. };
  10177. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10178. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10179. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10180. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10181. ctx.emit("set-picker-option", [
  10182. "getRangeAvailableTime",
  10183. getRangeAvailableTime
  10184. ]);
  10185. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10186. const timePickerOptions = {};
  10187. const onSetOption = (e) => {
  10188. timePickerOptions[e[0]] = e[1];
  10189. };
  10190. const pickerBase = inject("EP_PICKER_BASE");
  10191. const {
  10192. arrowControl,
  10193. disabledHours,
  10194. disabledMinutes,
  10195. disabledSeconds,
  10196. defaultValue
  10197. } = pickerBase.props;
  10198. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours, disabledMinutes, disabledSeconds);
  10199. return {
  10200. ns,
  10201. transitionName,
  10202. arrowControl,
  10203. onSetOption,
  10204. t,
  10205. handleConfirm,
  10206. handleChange: handleChange2,
  10207. setSelectionRange,
  10208. amPmMode,
  10209. showSeconds,
  10210. handleCancel,
  10211. disabledHours,
  10212. disabledMinutes,
  10213. disabledSeconds
  10214. };
  10215. }
  10216. });
  10217. function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
  10218. const _component_time_spinner = resolveComponent("time-spinner");
  10219. return openBlock(), createBlock(Transition, { name: _ctx.transitionName }, {
  10220. default: withCtx(() => [
  10221. _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  10222. key: 0,
  10223. class: normalizeClass(_ctx.ns.b("panel"))
  10224. }, [
  10225. createElementVNode("div", {
  10226. class: normalizeClass([_ctx.ns.be("panel", "content"), { "has-seconds": _ctx.showSeconds }])
  10227. }, [
  10228. createVNode(_component_time_spinner, {
  10229. ref: "spinner",
  10230. role: _ctx.datetimeRole || "start",
  10231. "arrow-control": _ctx.arrowControl,
  10232. "show-seconds": _ctx.showSeconds,
  10233. "am-pm-mode": _ctx.amPmMode,
  10234. "spinner-date": _ctx.parsedValue,
  10235. "disabled-hours": _ctx.disabledHours,
  10236. "disabled-minutes": _ctx.disabledMinutes,
  10237. "disabled-seconds": _ctx.disabledSeconds,
  10238. onChange: _ctx.handleChange,
  10239. onSetOption: _ctx.onSetOption,
  10240. onSelectRange: _ctx.setSelectionRange
  10241. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10242. ], 2),
  10243. createElementVNode("div", {
  10244. class: normalizeClass(_ctx.ns.be("panel", "footer"))
  10245. }, [
  10246. createElementVNode("button", {
  10247. type: "button",
  10248. class: normalizeClass([_ctx.ns.be("panel", "btn"), "cancel"]),
  10249. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleCancel && _ctx.handleCancel(...args))
  10250. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10251. createElementVNode("button", {
  10252. type: "button",
  10253. class: normalizeClass([_ctx.ns.be("panel", "btn"), "confirm"]),
  10254. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10255. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 3)
  10256. ], 2)
  10257. ], 2)) : createCommentVNode("v-if", true)
  10258. ]),
  10259. _: 1
  10260. }, 8, ["name"]);
  10261. }
  10262. var TimePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$V, [["render", _sfc_render$x], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-pick.vue"]]);
  10263. const makeSelectRange = (start2, end2) => {
  10264. const result = [];
  10265. for (let i = start2; i <= end2; i++) {
  10266. result.push(i);
  10267. }
  10268. return result;
  10269. };
  10270. const _sfc_main$U = defineComponent({
  10271. components: { TimeSpinner },
  10272. props: {
  10273. visible: Boolean,
  10274. actualVisible: Boolean,
  10275. parsedValue: {
  10276. type: [Array]
  10277. },
  10278. format: {
  10279. type: String,
  10280. default: ""
  10281. }
  10282. },
  10283. emits: ["pick", "select-range", "set-picker-option"],
  10284. setup(props, ctx) {
  10285. const { t, lang } = useLocale();
  10286. const nsTime = useNamespace("time");
  10287. const nsPicker = useNamespace("picker");
  10288. const minDate = computed(() => props.parsedValue[0]);
  10289. const maxDate = computed(() => props.parsedValue[1]);
  10290. const oldValue = useOldValue(props);
  10291. const handleCancel = () => {
  10292. ctx.emit("pick", oldValue.value, false);
  10293. };
  10294. const showSeconds = computed(() => {
  10295. return props.format.includes("ss");
  10296. });
  10297. const amPmMode = computed(() => {
  10298. if (props.format.includes("A"))
  10299. return "A";
  10300. if (props.format.includes("a"))
  10301. return "a";
  10302. return "";
  10303. });
  10304. const minSelectableRange = ref([]);
  10305. const maxSelectableRange = ref([]);
  10306. const handleConfirm = (visible = false) => {
  10307. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  10308. };
  10309. const handleMinChange = (date4) => {
  10310. handleChange2(date4.millisecond(0), maxDate.value);
  10311. };
  10312. const handleMaxChange = (date4) => {
  10313. handleChange2(minDate.value, date4.millisecond(0));
  10314. };
  10315. const isValidValue = (_date) => {
  10316. const parsedDate = _date.map((_2) => dayjs(_2).locale(lang.value));
  10317. const result = getRangeAvailableTime(parsedDate);
  10318. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  10319. };
  10320. const handleChange2 = (_minDate, _maxDate) => {
  10321. ctx.emit("pick", [_minDate, _maxDate], true);
  10322. };
  10323. const btnConfirmDisabled = computed(() => {
  10324. return minDate.value > maxDate.value;
  10325. });
  10326. const selectionRange = ref([0, 2]);
  10327. const setMinSelectionRange = (start2, end2) => {
  10328. ctx.emit("select-range", start2, end2, "min");
  10329. selectionRange.value = [start2, end2];
  10330. };
  10331. const offset2 = computed(() => showSeconds.value ? 11 : 8);
  10332. const setMaxSelectionRange = (start2, end2) => {
  10333. ctx.emit("select-range", start2, end2, "max");
  10334. selectionRange.value = [start2 + offset2.value, end2 + offset2.value];
  10335. };
  10336. const changeSelectionRange = (step) => {
  10337. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  10338. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  10339. const index = list.indexOf(selectionRange.value[0]);
  10340. const next = (index + step + list.length) % list.length;
  10341. const half = list.length / 2;
  10342. if (next < half) {
  10343. timePickerOptions["start_emitSelectRange"](mapping[next]);
  10344. } else {
  10345. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  10346. }
  10347. };
  10348. const handleKeydown = (event) => {
  10349. const code = event.code;
  10350. if (code === EVENT_CODE.left || code === EVENT_CODE.right) {
  10351. const step = code === EVENT_CODE.left ? -1 : 1;
  10352. changeSelectionRange(step);
  10353. event.preventDefault();
  10354. return;
  10355. }
  10356. if (code === EVENT_CODE.up || code === EVENT_CODE.down) {
  10357. const step = code === EVENT_CODE.up ? -1 : 1;
  10358. const role = selectionRange.value[0] < offset2.value ? "start" : "end";
  10359. timePickerOptions[`${role}_scrollDown`](step);
  10360. event.preventDefault();
  10361. return;
  10362. }
  10363. };
  10364. const disabledHours_ = (role, compare) => {
  10365. const defaultDisable = disabledHours ? disabledHours(role) : [];
  10366. const isStart = role === "start";
  10367. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10368. const compareHour = compareDate.hour();
  10369. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  10370. return union$1(defaultDisable, nextDisable);
  10371. };
  10372. const disabledMinutes_ = (hour, role, compare) => {
  10373. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  10374. const isStart = role === "start";
  10375. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10376. const compareHour = compareDate.hour();
  10377. if (hour !== compareHour) {
  10378. return defaultDisable;
  10379. }
  10380. const compareMinute = compareDate.minute();
  10381. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  10382. return union$1(defaultDisable, nextDisable);
  10383. };
  10384. const disabledSeconds_ = (hour, minute, role, compare) => {
  10385. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  10386. const isStart = role === "start";
  10387. const compareDate = compare || (isStart ? maxDate.value : minDate.value);
  10388. const compareHour = compareDate.hour();
  10389. const compareMinute = compareDate.minute();
  10390. if (hour !== compareHour || minute !== compareMinute) {
  10391. return defaultDisable;
  10392. }
  10393. const compareSecond = compareDate.second();
  10394. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  10395. return union$1(defaultDisable, nextDisable);
  10396. };
  10397. const getRangeAvailableTime = (dates) => {
  10398. return dates.map((_2, index) => getRangeAvailableTimeEach(dates[0], dates[1], index === 0 ? "start" : "end"));
  10399. };
  10400. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = getAvailableArrs(disabledHours_, disabledMinutes_, disabledSeconds_);
  10401. const getRangeAvailableTimeEach = (startDate, endDate, role) => {
  10402. const availableMap = {
  10403. hour: getAvailableHours,
  10404. minute: getAvailableMinutes,
  10405. second: getAvailableSeconds
  10406. };
  10407. const isStart = role === "start";
  10408. let result = isStart ? startDate : endDate;
  10409. const compareDate = isStart ? endDate : startDate;
  10410. ["hour", "minute", "second"].forEach((_2) => {
  10411. if (availableMap[_2]) {
  10412. let availableArr;
  10413. const method4 = availableMap[_2];
  10414. if (_2 === "minute") {
  10415. availableArr = method4(result.hour(), role, compareDate);
  10416. } else if (_2 === "second") {
  10417. availableArr = method4(result.hour(), result.minute(), role, compareDate);
  10418. } else {
  10419. availableArr = method4(role, compareDate);
  10420. }
  10421. if (availableArr && availableArr.length && !availableArr.includes(result[_2]())) {
  10422. const pos = isStart ? 0 : availableArr.length - 1;
  10423. result = result[_2](availableArr[pos]);
  10424. }
  10425. }
  10426. });
  10427. return result;
  10428. };
  10429. const parseUserInput = (value) => {
  10430. if (!value)
  10431. return null;
  10432. if (Array.isArray(value)) {
  10433. return value.map((_2) => dayjs(_2, props.format).locale(lang.value));
  10434. }
  10435. return dayjs(value, props.format).locale(lang.value);
  10436. };
  10437. const formatToString = (value) => {
  10438. if (!value)
  10439. return null;
  10440. if (Array.isArray(value)) {
  10441. return value.map((_2) => _2.format(props.format));
  10442. }
  10443. return value.format(props.format);
  10444. };
  10445. const getDefaultValue = () => {
  10446. if (Array.isArray(defaultValue)) {
  10447. return defaultValue.map((_2) => dayjs(_2).locale(lang.value));
  10448. }
  10449. const defaultDay = dayjs(defaultValue).locale(lang.value);
  10450. return [defaultDay, defaultDay.add(60, "m")];
  10451. };
  10452. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  10453. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  10454. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  10455. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  10456. ctx.emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  10457. ctx.emit("set-picker-option", [
  10458. "getRangeAvailableTime",
  10459. getRangeAvailableTime
  10460. ]);
  10461. const timePickerOptions = {};
  10462. const onSetOption = (e) => {
  10463. timePickerOptions[e[0]] = e[1];
  10464. };
  10465. const pickerBase = inject("EP_PICKER_BASE");
  10466. const {
  10467. arrowControl,
  10468. disabledHours,
  10469. disabledMinutes,
  10470. disabledSeconds,
  10471. defaultValue
  10472. } = pickerBase.props;
  10473. return {
  10474. nsTime,
  10475. nsPicker,
  10476. arrowControl,
  10477. onSetOption,
  10478. setMaxSelectionRange,
  10479. setMinSelectionRange,
  10480. btnConfirmDisabled,
  10481. handleCancel,
  10482. handleConfirm,
  10483. t,
  10484. showSeconds,
  10485. minDate,
  10486. maxDate,
  10487. amPmMode,
  10488. handleMinChange,
  10489. handleMaxChange,
  10490. minSelectableRange,
  10491. maxSelectableRange,
  10492. disabledHours_,
  10493. disabledMinutes_,
  10494. disabledSeconds_
  10495. };
  10496. }
  10497. });
  10498. const _hoisted_1$A = ["disabled"];
  10499. function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
  10500. const _component_time_spinner = resolveComponent("time-spinner");
  10501. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  10502. key: 0,
  10503. class: normalizeClass([_ctx.nsTime.b("range-picker"), _ctx.nsPicker.b("panel")])
  10504. }, [
  10505. createElementVNode("div", {
  10506. class: normalizeClass(_ctx.nsTime.be("range-picker", "content"))
  10507. }, [
  10508. createElementVNode("div", {
  10509. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10510. }, [
  10511. createElementVNode("div", {
  10512. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10513. }, toDisplayString(_ctx.t("el.datepicker.startTime")), 3),
  10514. createElementVNode("div", {
  10515. class: normalizeClass([
  10516. _ctx.nsTime.be("range-picker", "body"),
  10517. _ctx.nsTime.be("panel", "content"),
  10518. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10519. { "has-seconds": _ctx.showSeconds }
  10520. ])
  10521. }, [
  10522. createVNode(_component_time_spinner, {
  10523. ref: "minSpinner",
  10524. role: "start",
  10525. "show-seconds": _ctx.showSeconds,
  10526. "am-pm-mode": _ctx.amPmMode,
  10527. "arrow-control": _ctx.arrowControl,
  10528. "spinner-date": _ctx.minDate,
  10529. "disabled-hours": _ctx.disabledHours_,
  10530. "disabled-minutes": _ctx.disabledMinutes_,
  10531. "disabled-seconds": _ctx.disabledSeconds_,
  10532. onChange: _ctx.handleMinChange,
  10533. onSetOption: _ctx.onSetOption,
  10534. onSelectRange: _ctx.setMinSelectionRange
  10535. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10536. ], 2)
  10537. ], 2),
  10538. createElementVNode("div", {
  10539. class: normalizeClass(_ctx.nsTime.be("range-picker", "cell"))
  10540. }, [
  10541. createElementVNode("div", {
  10542. class: normalizeClass(_ctx.nsTime.be("range-picker", "header"))
  10543. }, toDisplayString(_ctx.t("el.datepicker.endTime")), 3),
  10544. createElementVNode("div", {
  10545. class: normalizeClass([
  10546. _ctx.nsTime.be("range-picker", "body"),
  10547. _ctx.nsTime.be("panel", "content"),
  10548. _ctx.nsTime.is("arrow", _ctx.arrowControl),
  10549. { "has-seconds": _ctx.showSeconds }
  10550. ])
  10551. }, [
  10552. createVNode(_component_time_spinner, {
  10553. ref: "maxSpinner",
  10554. role: "end",
  10555. "show-seconds": _ctx.showSeconds,
  10556. "am-pm-mode": _ctx.amPmMode,
  10557. "arrow-control": _ctx.arrowControl,
  10558. "spinner-date": _ctx.maxDate,
  10559. "disabled-hours": _ctx.disabledHours_,
  10560. "disabled-minutes": _ctx.disabledMinutes_,
  10561. "disabled-seconds": _ctx.disabledSeconds_,
  10562. onChange: _ctx.handleMaxChange,
  10563. onSetOption: _ctx.onSetOption,
  10564. onSelectRange: _ctx.setMaxSelectionRange
  10565. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onChange", "onSetOption", "onSelectRange"])
  10566. ], 2)
  10567. ], 2)
  10568. ], 2),
  10569. createElementVNode("div", {
  10570. class: normalizeClass(_ctx.nsTime.be("panel", "footer"))
  10571. }, [
  10572. createElementVNode("button", {
  10573. type: "button",
  10574. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "cancel"]),
  10575. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleCancel())
  10576. }, toDisplayString(_ctx.t("el.datepicker.cancel")), 3),
  10577. createElementVNode("button", {
  10578. type: "button",
  10579. class: normalizeClass([_ctx.nsTime.be("panel", "btn"), "confirm"]),
  10580. disabled: _ctx.btnConfirmDisabled,
  10581. onClick: _cache[1] || (_cache[1] = ($event) => _ctx.handleConfirm())
  10582. }, toDisplayString(_ctx.t("el.datepicker.confirm")), 11, _hoisted_1$A)
  10583. ], 2)
  10584. ], 2)) : createCommentVNode("v-if", true);
  10585. }
  10586. var TimeRangePanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$U, [["render", _sfc_render$w], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-range.vue"]]);
  10587. dayjs.extend(customParseFormat);
  10588. var TimePicker = defineComponent({
  10589. name: "ElTimePicker",
  10590. install: null,
  10591. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  10592. isRange: {
  10593. type: Boolean,
  10594. default: false
  10595. }
  10596. }),
  10597. emits: ["update:modelValue"],
  10598. setup(props, ctx) {
  10599. const commonPicker = ref(null);
  10600. const type4 = props.isRange ? "timerange" : "time";
  10601. const panel = props.isRange ? TimeRangePanel : TimePickPanel;
  10602. const refProps = __spreadProps(__spreadValues({}, props), {
  10603. focus: () => {
  10604. var _a2;
  10605. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleFocus();
  10606. },
  10607. blur: () => {
  10608. var _a2;
  10609. (_a2 = commonPicker.value) == null ? void 0 : _a2.handleBlur();
  10610. }
  10611. });
  10612. provide("ElPopperOptions", props.popperOptions);
  10613. ctx.expose(refProps);
  10614. return () => {
  10615. var _a2;
  10616. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_TIME;
  10617. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  10618. format: format2,
  10619. type: type4,
  10620. ref: commonPicker,
  10621. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  10622. }), {
  10623. default: (scopedProps) => h$1(panel, scopedProps)
  10624. });
  10625. };
  10626. }
  10627. });
  10628. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  10629. const extractDateFormat = (format2) => {
  10630. return format2.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  10631. };
  10632. const extractTimeFormat = (format2) => {
  10633. return format2.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  10634. };
  10635. const _TimePicker = TimePicker;
  10636. _TimePicker.install = (app) => {
  10637. app.component(_TimePicker.name, _TimePicker);
  10638. };
  10639. const ElTimePicker = _TimePicker;
  10640. const useCheckboxProps = {
  10641. modelValue: {
  10642. type: [Boolean, Number, String],
  10643. default: () => void 0
  10644. },
  10645. label: {
  10646. type: [String, Boolean, Number, Object]
  10647. },
  10648. indeterminate: Boolean,
  10649. disabled: Boolean,
  10650. checked: Boolean,
  10651. name: {
  10652. type: String,
  10653. default: void 0
  10654. },
  10655. trueLabel: {
  10656. type: [String, Number],
  10657. default: void 0
  10658. },
  10659. falseLabel: {
  10660. type: [String, Number],
  10661. default: void 0
  10662. },
  10663. tabindex: [String, Number],
  10664. size: String
  10665. };
  10666. const useCheckboxGroup = () => {
  10667. const elForm2 = inject(formContextKey, {});
  10668. const elFormItem2 = inject(formItemContextKey, {});
  10669. const checkboxGroup = inject("CheckboxGroup", {});
  10670. const isGroup = computed(() => checkboxGroup && (checkboxGroup == null ? void 0 : checkboxGroup.name) === "ElCheckboxGroup");
  10671. const elFormItemSize = computed(() => {
  10672. return elFormItem2.size;
  10673. });
  10674. return {
  10675. isGroup,
  10676. checkboxGroup,
  10677. elForm: elForm2,
  10678. elFormItemSize,
  10679. elFormItem: elFormItem2
  10680. };
  10681. };
  10682. const useModel = (props) => {
  10683. const selfModel = ref(false);
  10684. const { emit } = getCurrentInstance();
  10685. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10686. const isLimitExceeded = ref(false);
  10687. const model = computed({
  10688. get() {
  10689. var _a2, _b2;
  10690. return isGroup.value ? (_a2 = checkboxGroup.modelValue) == null ? void 0 : _a2.value : (_b2 = props.modelValue) != null ? _b2 : selfModel.value;
  10691. },
  10692. set(val) {
  10693. var _a2;
  10694. if (isGroup.value && Array.isArray(val)) {
  10695. isLimitExceeded.value = checkboxGroup.max !== void 0 && val.length > checkboxGroup.max.value;
  10696. isLimitExceeded.value === false && ((_a2 = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _a2.call(checkboxGroup, val));
  10697. } else {
  10698. emit(UPDATE_MODEL_EVENT, val);
  10699. selfModel.value = val;
  10700. }
  10701. }
  10702. });
  10703. return {
  10704. model,
  10705. isLimitExceeded
  10706. };
  10707. };
  10708. const useCheckboxStatus = (props, { model }) => {
  10709. const { isGroup, checkboxGroup } = useCheckboxGroup();
  10710. const focus = ref(false);
  10711. const size = useSize(checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize, { prop: true });
  10712. const isChecked = computed(() => {
  10713. const value = model.value;
  10714. if (toTypeString(value) === "[object Boolean]") {
  10715. return value;
  10716. } else if (Array.isArray(value)) {
  10717. return value.includes(props.label);
  10718. } else if (value !== null && value !== void 0) {
  10719. return value === props.trueLabel;
  10720. } else {
  10721. return !!value;
  10722. }
  10723. });
  10724. const checkboxSize = useSize(computed(() => {
  10725. var _a2;
  10726. return isGroup.value ? (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.checkboxGroupSize) == null ? void 0 : _a2.value : void 0;
  10727. }));
  10728. return {
  10729. isChecked,
  10730. focus,
  10731. size,
  10732. checkboxSize
  10733. };
  10734. };
  10735. const useDisabled = (props, {
  10736. model,
  10737. isChecked
  10738. }) => {
  10739. const { elForm: elForm2, isGroup, checkboxGroup } = useCheckboxGroup();
  10740. const isLimitDisabled = computed(() => {
  10741. var _a2, _b2;
  10742. const max2 = (_a2 = checkboxGroup.max) == null ? void 0 : _a2.value;
  10743. const min2 = (_b2 = checkboxGroup.min) == null ? void 0 : _b2.value;
  10744. return !!(max2 || min2) && model.value.length >= max2 && !isChecked.value || model.value.length <= min2 && isChecked.value;
  10745. });
  10746. const isDisabled = computed(() => {
  10747. var _a2, _b2;
  10748. const disabled = props.disabled || elForm2.disabled;
  10749. return (_b2 = isGroup.value ? ((_a2 = checkboxGroup.disabled) == null ? void 0 : _a2.value) || disabled || isLimitDisabled.value : props.disabled || elForm2.disabled) != null ? _b2 : false;
  10750. });
  10751. return {
  10752. isDisabled,
  10753. isLimitDisabled
  10754. };
  10755. };
  10756. const setStoreValue = (props, { model }) => {
  10757. function addToStore() {
  10758. if (Array.isArray(model.value) && !model.value.includes(props.label)) {
  10759. model.value.push(props.label);
  10760. } else {
  10761. model.value = props.trueLabel || true;
  10762. }
  10763. }
  10764. props.checked && addToStore();
  10765. };
  10766. const useEvent$1 = (props, { isLimitExceeded }) => {
  10767. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  10768. const { emit } = getCurrentInstance();
  10769. function handleChange2(e) {
  10770. var _a2, _b2;
  10771. if (isLimitExceeded.value)
  10772. return;
  10773. const target = e.target;
  10774. const value = target.checked ? (_a2 = props.trueLabel) != null ? _a2 : true : (_b2 = props.falseLabel) != null ? _b2 : false;
  10775. emit("change", value, e);
  10776. }
  10777. watch(() => props.modelValue, () => {
  10778. var _a2;
  10779. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  10780. });
  10781. return {
  10782. handleChange: handleChange2
  10783. };
  10784. };
  10785. const useCheckbox = (props) => {
  10786. const { model, isLimitExceeded } = useModel(props);
  10787. const { focus, size, isChecked, checkboxSize } = useCheckboxStatus(props, {
  10788. model
  10789. });
  10790. const { isDisabled } = useDisabled(props, { model, isChecked });
  10791. const { handleChange: handleChange2 } = useEvent$1(props, { isLimitExceeded });
  10792. setStoreValue(props, { model });
  10793. return {
  10794. isChecked,
  10795. isDisabled,
  10796. checkboxSize,
  10797. model,
  10798. handleChange: handleChange2,
  10799. focus,
  10800. size
  10801. };
  10802. };
  10803. const _sfc_main$T = defineComponent({
  10804. name: "ElCheckbox",
  10805. props: {
  10806. modelValue: {
  10807. type: [Number, String, Boolean],
  10808. default: () => void 0
  10809. },
  10810. label: {
  10811. type: [String, Boolean, Number, Object]
  10812. },
  10813. indeterminate: Boolean,
  10814. disabled: Boolean,
  10815. checked: Boolean,
  10816. name: {
  10817. type: String,
  10818. default: void 0
  10819. },
  10820. trueLabel: {
  10821. type: [String, Number],
  10822. default: void 0
  10823. },
  10824. falseLabel: {
  10825. type: [String, Number],
  10826. default: void 0
  10827. },
  10828. id: {
  10829. type: String,
  10830. default: void 0
  10831. },
  10832. controls: {
  10833. type: String,
  10834. default: void 0
  10835. },
  10836. border: Boolean,
  10837. size: {
  10838. type: String,
  10839. validator: isValidComponentSize
  10840. },
  10841. tabindex: [String, Number]
  10842. },
  10843. emits: [UPDATE_MODEL_EVENT, "change"],
  10844. setup(props) {
  10845. const ns = useNamespace("checkbox");
  10846. return __spreadValues({
  10847. ns
  10848. }, useCheckbox(props));
  10849. }
  10850. });
  10851. const _hoisted_1$z = ["id", "aria-controls"];
  10852. const _hoisted_2$r = ["tabindex", "role", "aria-checked"];
  10853. const _hoisted_3$i = ["aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
  10854. const _hoisted_4$f = ["aria-hidden", "disabled", "value", "name", "tabindex"];
  10855. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  10856. return openBlock(), createElementBlock("label", {
  10857. id: _ctx.id,
  10858. class: normalizeClass([
  10859. _ctx.ns.b(),
  10860. _ctx.ns.m(_ctx.checkboxSize),
  10861. _ctx.ns.is("disabled", _ctx.isDisabled),
  10862. _ctx.ns.is("bordered", _ctx.border),
  10863. _ctx.ns.is("checked", _ctx.isChecked)
  10864. ]),
  10865. "aria-controls": _ctx.indeterminate ? _ctx.controls : null
  10866. }, [
  10867. createElementVNode("span", {
  10868. class: normalizeClass([
  10869. _ctx.ns.e("input"),
  10870. _ctx.ns.is("disabled", _ctx.isDisabled),
  10871. _ctx.ns.is("checked", _ctx.isChecked),
  10872. _ctx.ns.is("indeterminate", _ctx.indeterminate),
  10873. _ctx.ns.is("focus", _ctx.focus)
  10874. ]),
  10875. tabindex: _ctx.indeterminate ? 0 : void 0,
  10876. role: _ctx.indeterminate ? "checkbox" : void 0,
  10877. "aria-checked": _ctx.indeterminate ? "mixed" : false
  10878. }, [
  10879. createElementVNode("span", {
  10880. class: normalizeClass(_ctx.ns.e("inner"))
  10881. }, null, 2),
  10882. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10883. key: 0,
  10884. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10885. class: normalizeClass(_ctx.ns.e("original")),
  10886. type: "checkbox",
  10887. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10888. name: _ctx.name,
  10889. tabindex: _ctx.tabindex,
  10890. disabled: _ctx.isDisabled,
  10891. "true-value": _ctx.trueLabel,
  10892. "false-value": _ctx.falseLabel,
  10893. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10894. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10895. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10896. }, null, 42, _hoisted_3$i)), [
  10897. [vModelCheckbox, _ctx.model]
  10898. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10899. key: 1,
  10900. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10901. class: normalizeClass(_ctx.ns.e("original")),
  10902. type: "checkbox",
  10903. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  10904. disabled: _ctx.isDisabled,
  10905. value: _ctx.label,
  10906. name: _ctx.name,
  10907. tabindex: _ctx.tabindex,
  10908. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10909. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10910. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  10911. }, null, 42, _hoisted_4$f)), [
  10912. [vModelCheckbox, _ctx.model]
  10913. ])
  10914. ], 10, _hoisted_2$r),
  10915. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  10916. key: 0,
  10917. class: normalizeClass(_ctx.ns.e("label"))
  10918. }, [
  10919. renderSlot(_ctx.$slots, "default"),
  10920. !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  10921. createTextVNode(toDisplayString(_ctx.label), 1)
  10922. ], 2112)) : createCommentVNode("v-if", true)
  10923. ], 2)) : createCommentVNode("v-if", true)
  10924. ], 10, _hoisted_1$z);
  10925. }
  10926. var Checkbox = /* @__PURE__ */ _export_sfc$1(_sfc_main$T, [["render", _sfc_render$v], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);
  10927. const _sfc_main$S = defineComponent({
  10928. name: "ElCheckboxButton",
  10929. props: useCheckboxProps,
  10930. emits: [UPDATE_MODEL_EVENT, "change"],
  10931. setup(props) {
  10932. const { focus, isChecked, isDisabled, size, model, handleChange: handleChange2 } = useCheckbox(props);
  10933. const { checkboxGroup } = useCheckboxGroup();
  10934. const ns = useNamespace("checkbox");
  10935. const activeStyle = computed(() => {
  10936. var _a2, _b2, _c, _d;
  10937. const fillValue = (_b2 = (_a2 = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a2.value) != null ? _b2 : "";
  10938. return {
  10939. backgroundColor: fillValue,
  10940. borderColor: fillValue,
  10941. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  10942. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : null
  10943. };
  10944. });
  10945. return {
  10946. focus,
  10947. isChecked,
  10948. isDisabled,
  10949. model,
  10950. handleChange: handleChange2,
  10951. activeStyle,
  10952. size,
  10953. ns
  10954. };
  10955. }
  10956. });
  10957. const _hoisted_1$y = ["aria-checked", "aria-disabled"];
  10958. const _hoisted_2$q = ["name", "tabindex", "disabled", "true-value", "false-value"];
  10959. const _hoisted_3$h = ["name", "tabindex", "disabled", "value"];
  10960. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  10961. return openBlock(), createElementBlock("label", {
  10962. class: normalizeClass([
  10963. _ctx.ns.b("button"),
  10964. _ctx.ns.bm("button", _ctx.size),
  10965. _ctx.ns.is("disabled", _ctx.isDisabled),
  10966. _ctx.ns.is("checked", _ctx.isChecked),
  10967. _ctx.ns.is("focus", _ctx.focus)
  10968. ]),
  10969. role: "checkbox",
  10970. "aria-checked": _ctx.isChecked,
  10971. "aria-disabled": _ctx.isDisabled
  10972. }, [
  10973. _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  10974. key: 0,
  10975. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model = $event),
  10976. class: normalizeClass(_ctx.ns.be("button", "original")),
  10977. type: "checkbox",
  10978. name: _ctx.name,
  10979. tabindex: _ctx.tabindex,
  10980. disabled: _ctx.isDisabled,
  10981. "true-value": _ctx.trueLabel,
  10982. "false-value": _ctx.falseLabel,
  10983. onChange: _cache[1] || (_cache[1] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10984. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.focus = true),
  10985. onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.focus = false)
  10986. }, null, 42, _hoisted_2$q)), [
  10987. [vModelCheckbox, _ctx.model]
  10988. ]) : withDirectives((openBlock(), createElementBlock("input", {
  10989. key: 1,
  10990. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.model = $event),
  10991. class: normalizeClass(_ctx.ns.be("button", "original")),
  10992. type: "checkbox",
  10993. name: _ctx.name,
  10994. tabindex: _ctx.tabindex,
  10995. disabled: _ctx.isDisabled,
  10996. value: _ctx.label,
  10997. onChange: _cache[5] || (_cache[5] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  10998. onFocus: _cache[6] || (_cache[6] = ($event) => _ctx.focus = true),
  10999. onBlur: _cache[7] || (_cache[7] = ($event) => _ctx.focus = false)
  11000. }, null, 42, _hoisted_3$h)), [
  11001. [vModelCheckbox, _ctx.model]
  11002. ]),
  11003. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  11004. key: 2,
  11005. class: normalizeClass(_ctx.ns.be("button", "inner")),
  11006. style: normalizeStyle(_ctx.isChecked ? _ctx.activeStyle : null)
  11007. }, [
  11008. renderSlot(_ctx.$slots, "default", {}, () => [
  11009. createTextVNode(toDisplayString(_ctx.label), 1)
  11010. ])
  11011. ], 6)) : createCommentVNode("v-if", true)
  11012. ], 10, _hoisted_1$y);
  11013. }
  11014. var CheckboxButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$S, [["render", _sfc_render$u], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);
  11015. const _sfc_main$R = defineComponent({
  11016. name: "ElCheckboxGroup",
  11017. props: {
  11018. modelValue: {
  11019. type: Array,
  11020. default: () => []
  11021. },
  11022. disabled: Boolean,
  11023. min: {
  11024. type: Number,
  11025. default: void 0
  11026. },
  11027. max: {
  11028. type: Number,
  11029. default: void 0
  11030. },
  11031. size: {
  11032. type: String,
  11033. validator: isValidComponentSize
  11034. },
  11035. fill: {
  11036. type: String,
  11037. default: void 0
  11038. },
  11039. textColor: {
  11040. type: String,
  11041. default: void 0
  11042. },
  11043. tag: {
  11044. type: String,
  11045. default: "div"
  11046. }
  11047. },
  11048. emits: [UPDATE_MODEL_EVENT, "change"],
  11049. setup(props, { emit, slots }) {
  11050. const { elFormItem: elFormItem2 } = useCheckboxGroup();
  11051. const checkboxGroupSize = useSize();
  11052. const ns = useNamespace("checkbox");
  11053. const changeEvent = (value) => {
  11054. emit(UPDATE_MODEL_EVENT, value);
  11055. nextTick(() => {
  11056. emit("change", value);
  11057. });
  11058. };
  11059. const modelValue = computed({
  11060. get() {
  11061. return props.modelValue;
  11062. },
  11063. set(val) {
  11064. changeEvent(val);
  11065. }
  11066. });
  11067. provide("CheckboxGroup", __spreadProps(__spreadValues({
  11068. name: "ElCheckboxGroup",
  11069. modelValue
  11070. }, toRefs(props)), {
  11071. checkboxGroupSize,
  11072. changeEvent
  11073. }));
  11074. watch(() => props.modelValue, () => {
  11075. var _a2;
  11076. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  11077. });
  11078. return () => {
  11079. return h$1(props.tag, {
  11080. class: ns.b("group"),
  11081. role: "group",
  11082. "aria-label": "checkbox-group"
  11083. }, [renderSlot(slots, "default")]);
  11084. };
  11085. }
  11086. });
  11087. var CheckboxGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$R, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);
  11088. const ElCheckbox = withInstall(Checkbox, {
  11089. CheckboxButton,
  11090. CheckboxGroup
  11091. });
  11092. withNoopInstall(CheckboxButton);
  11093. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  11094. const radioPropsBase = buildProps({
  11095. size: useSizeProp,
  11096. disabled: Boolean,
  11097. label: {
  11098. type: [String, Number, Boolean],
  11099. default: ""
  11100. }
  11101. });
  11102. const radioProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  11103. modelValue: {
  11104. type: [String, Number, Boolean],
  11105. default: ""
  11106. },
  11107. name: {
  11108. type: String,
  11109. default: ""
  11110. },
  11111. border: Boolean
  11112. }));
  11113. const radioEmits = {
  11114. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  11115. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  11116. };
  11117. const useRadio = (props, emit) => {
  11118. const radioRef = ref();
  11119. const radioGroup = inject(radioGroupKey, void 0);
  11120. const isGroup = computed(() => !!radioGroup);
  11121. const modelValue = computed({
  11122. get() {
  11123. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  11124. },
  11125. set(val) {
  11126. if (isGroup.value) {
  11127. radioGroup.changeEvent(val);
  11128. } else {
  11129. emit(UPDATE_MODEL_EVENT, val);
  11130. }
  11131. radioRef.value.checked = props.modelValue === props.label;
  11132. }
  11133. });
  11134. const size = useSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
  11135. const disabled = useDisabled$1(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  11136. const focus = ref(false);
  11137. const tabIndex = computed(() => {
  11138. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  11139. });
  11140. return {
  11141. radioRef,
  11142. isGroup,
  11143. radioGroup,
  11144. focus,
  11145. size,
  11146. disabled,
  11147. tabIndex,
  11148. modelValue
  11149. };
  11150. };
  11151. const _sfc_main$Q = defineComponent({
  11152. name: "ElRadio",
  11153. props: radioProps,
  11154. emits: radioEmits,
  11155. setup(props, { emit }) {
  11156. const ns = useNamespace("radio");
  11157. const { radioRef, isGroup, focus, size, disabled, tabIndex, modelValue } = useRadio(props, emit);
  11158. function handleChange2() {
  11159. nextTick(() => emit("change", modelValue.value));
  11160. }
  11161. return {
  11162. ns,
  11163. focus,
  11164. isGroup,
  11165. modelValue,
  11166. tabIndex,
  11167. size,
  11168. disabled,
  11169. radioRef,
  11170. handleChange: handleChange2
  11171. };
  11172. }
  11173. });
  11174. const _hoisted_1$x = ["aria-checked", "aria-disabled", "tabindex"];
  11175. const _hoisted_2$p = ["value", "name", "disabled"];
  11176. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  11177. return openBlock(), createElementBlock("label", {
  11178. class: normalizeClass([
  11179. _ctx.ns.b(),
  11180. _ctx.ns.is("disabled", _ctx.disabled),
  11181. _ctx.ns.is("focus", _ctx.focus),
  11182. _ctx.ns.is("bordered", _ctx.border),
  11183. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label),
  11184. _ctx.ns.m(_ctx.size)
  11185. ]),
  11186. role: "radio",
  11187. "aria-checked": _ctx.modelValue === _ctx.label,
  11188. "aria-disabled": _ctx.disabled,
  11189. tabindex: _ctx.tabIndex,
  11190. onKeydown: _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11191. }, [
  11192. createElementVNode("span", {
  11193. class: normalizeClass([
  11194. _ctx.ns.e("input"),
  11195. _ctx.ns.is("disabled", _ctx.disabled),
  11196. _ctx.ns.is("checked", _ctx.modelValue === _ctx.label)
  11197. ])
  11198. }, [
  11199. createElementVNode("span", {
  11200. class: normalizeClass(_ctx.ns.e("inner"))
  11201. }, null, 2),
  11202. withDirectives(createElementVNode("input", {
  11203. ref: "radioRef",
  11204. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11205. class: normalizeClass(_ctx.ns.e("original")),
  11206. value: _ctx.label,
  11207. type: "radio",
  11208. "aria-hidden": "true",
  11209. name: _ctx.name,
  11210. disabled: _ctx.disabled,
  11211. tabindex: "-1",
  11212. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11213. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false),
  11214. onChange: _cache[3] || (_cache[3] = (...args) => _ctx.handleChange && _ctx.handleChange(...args))
  11215. }, null, 42, _hoisted_2$p), [
  11216. [vModelRadio, _ctx.modelValue]
  11217. ])
  11218. ], 2),
  11219. createElementVNode("span", {
  11220. class: normalizeClass(_ctx.ns.e("label")),
  11221. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {
  11222. }, ["stop"]))
  11223. }, [
  11224. renderSlot(_ctx.$slots, "default", {}, () => [
  11225. createTextVNode(toDisplayString(_ctx.label), 1)
  11226. ])
  11227. ], 34)
  11228. ], 42, _hoisted_1$x);
  11229. }
  11230. var Radio = /* @__PURE__ */ _export_sfc$1(_sfc_main$Q, [["render", _sfc_render$t], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
  11231. const radioButtonProps = buildProps(__spreadProps(__spreadValues({}, radioPropsBase), {
  11232. name: {
  11233. type: String,
  11234. default: ""
  11235. }
  11236. }));
  11237. const _sfc_main$P = defineComponent({
  11238. name: "ElRadioButton",
  11239. props: radioButtonProps,
  11240. setup(props, { emit }) {
  11241. const ns = useNamespace("radio");
  11242. const {
  11243. radioRef,
  11244. isGroup,
  11245. focus,
  11246. size,
  11247. disabled,
  11248. tabIndex,
  11249. modelValue,
  11250. radioGroup
  11251. } = useRadio(props, emit);
  11252. const activeStyle = computed(() => {
  11253. return {
  11254. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11255. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  11256. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  11257. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  11258. };
  11259. });
  11260. return {
  11261. ns,
  11262. isGroup,
  11263. size,
  11264. disabled,
  11265. tabIndex,
  11266. modelValue,
  11267. focus,
  11268. activeStyle,
  11269. radioRef
  11270. };
  11271. }
  11272. });
  11273. const _hoisted_1$w = ["aria-checked", "aria-disabled", "tabindex"];
  11274. const _hoisted_2$o = ["value", "name", "disabled"];
  11275. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  11276. return openBlock(), createElementBlock("label", {
  11277. class: normalizeClass([
  11278. _ctx.ns.b("button"),
  11279. _ctx.ns.is("active", _ctx.modelValue === _ctx.label),
  11280. _ctx.ns.is("disabled", _ctx.disabled),
  11281. _ctx.ns.is("focus", _ctx.focus),
  11282. _ctx.ns.bm("button", _ctx.size)
  11283. ]),
  11284. role: "radio",
  11285. "aria-checked": _ctx.modelValue === _ctx.label,
  11286. "aria-disabled": _ctx.disabled,
  11287. tabindex: _ctx.tabIndex,
  11288. onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.modelValue = _ctx.disabled ? _ctx.modelValue : _ctx.label, ["stop", "prevent"]), ["space"]))
  11289. }, [
  11290. withDirectives(createElementVNode("input", {
  11291. ref: "radioRef",
  11292. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.modelValue = $event),
  11293. class: normalizeClass(_ctx.ns.be("button", "original-radio")),
  11294. value: _ctx.label,
  11295. type: "radio",
  11296. name: _ctx.name,
  11297. disabled: _ctx.disabled,
  11298. tabindex: "-1",
  11299. onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.focus = true),
  11300. onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.focus = false)
  11301. }, null, 42, _hoisted_2$o), [
  11302. [vModelRadio, _ctx.modelValue]
  11303. ]),
  11304. createElementVNode("span", {
  11305. class: normalizeClass(_ctx.ns.be("button", "inner")),
  11306. style: normalizeStyle(_ctx.modelValue === _ctx.label ? _ctx.activeStyle : {}),
  11307. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  11308. }, ["stop"]))
  11309. }, [
  11310. renderSlot(_ctx.$slots, "default", {}, () => [
  11311. createTextVNode(toDisplayString(_ctx.label), 1)
  11312. ])
  11313. ], 38)
  11314. ], 42, _hoisted_1$w);
  11315. }
  11316. var RadioButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$P, [["render", _sfc_render$s], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
  11317. const radioGroupProps = buildProps({
  11318. size: useSizeProp,
  11319. disabled: Boolean,
  11320. modelValue: {
  11321. type: [String, Number, Boolean],
  11322. default: ""
  11323. },
  11324. fill: {
  11325. type: String,
  11326. default: ""
  11327. },
  11328. textColor: {
  11329. type: String,
  11330. default: ""
  11331. }
  11332. });
  11333. const radioGroupEmits = radioEmits;
  11334. const _sfc_main$O = defineComponent({
  11335. name: "ElRadioGroup",
  11336. props: radioGroupProps,
  11337. emits: radioGroupEmits,
  11338. setup(props, ctx) {
  11339. const ns = useNamespace("radio");
  11340. const radioGroupRef = ref();
  11341. const { formItem } = useFormItem();
  11342. const changeEvent = (value) => {
  11343. ctx.emit(UPDATE_MODEL_EVENT, value);
  11344. nextTick(() => ctx.emit("change", value));
  11345. };
  11346. const handleKeydown = (e) => {
  11347. if (!radioGroupRef.value)
  11348. return;
  11349. const target = e.target;
  11350. const className = target.nodeName === "INPUT" ? "[type=radio]" : "[role=radio]";
  11351. const radios = radioGroupRef.value.querySelectorAll(className);
  11352. const length = radios.length;
  11353. const index = Array.from(radios).indexOf(target);
  11354. const roleRadios = radioGroupRef.value.querySelectorAll("[role=radio]");
  11355. let nextIndex = null;
  11356. switch (e.code) {
  11357. case EVENT_CODE.left:
  11358. case EVENT_CODE.up:
  11359. e.stopPropagation();
  11360. e.preventDefault();
  11361. nextIndex = index === 0 ? length - 1 : index - 1;
  11362. break;
  11363. case EVENT_CODE.right:
  11364. case EVENT_CODE.down:
  11365. e.stopPropagation();
  11366. e.preventDefault();
  11367. nextIndex = index === length - 1 ? 0 : index + 1;
  11368. break;
  11369. }
  11370. if (nextIndex === null)
  11371. return;
  11372. roleRadios[nextIndex].click();
  11373. roleRadios[nextIndex].focus();
  11374. };
  11375. onMounted(() => {
  11376. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  11377. const firstLabel = radios[0];
  11378. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  11379. firstLabel.tabIndex = 0;
  11380. }
  11381. });
  11382. provide(radioGroupKey, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  11383. changeEvent
  11384. })));
  11385. watch(() => props.modelValue, () => formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  11386. return {
  11387. ns,
  11388. radioGroupRef,
  11389. handleKeydown
  11390. };
  11391. }
  11392. });
  11393. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  11394. return openBlock(), createElementBlock("div", {
  11395. ref: "radioGroupRef",
  11396. class: normalizeClass(_ctx.ns.b("group")),
  11397. role: "radiogroup",
  11398. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  11399. }, [
  11400. renderSlot(_ctx.$slots, "default")
  11401. ], 34);
  11402. }
  11403. var RadioGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["render", _sfc_render$r], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
  11404. const ElRadio = withInstall(Radio, {
  11405. RadioButton,
  11406. RadioGroup
  11407. });
  11408. const ElRadioGroup = withNoopInstall(RadioGroup);
  11409. const ElRadioButton = withNoopInstall(RadioButton);
  11410. var NodeContent = defineComponent({
  11411. name: "NodeContent",
  11412. setup() {
  11413. const ns = useNamespace("cascader-node");
  11414. return {
  11415. ns
  11416. };
  11417. },
  11418. render() {
  11419. const { ns } = this;
  11420. const { node, panel } = this.$parent;
  11421. const { data: data2, label } = node;
  11422. const { renderLabelFn } = panel;
  11423. return h$1("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data: data2 }) : label);
  11424. }
  11425. });
  11426. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  11427. const _sfc_main$N = defineComponent({
  11428. name: "ElCascaderNode",
  11429. components: {
  11430. ElCheckbox,
  11431. ElRadio,
  11432. NodeContent,
  11433. ElIcon,
  11434. Check: check,
  11435. Loading: loading,
  11436. ArrowRight: arrowRight
  11437. },
  11438. props: {
  11439. node: {
  11440. type: Object,
  11441. required: true
  11442. },
  11443. menuId: String
  11444. },
  11445. emits: ["expand"],
  11446. setup(props, { emit }) {
  11447. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11448. const ns = useNamespace("cascader-node");
  11449. const isHoverMenu = computed(() => panel.isHoverMenu);
  11450. const multiple = computed(() => panel.config.multiple);
  11451. const checkStrictly = computed(() => panel.config.checkStrictly);
  11452. const checkedNodeId = computed(() => {
  11453. var _a2;
  11454. return (_a2 = panel.checkedNodes[0]) == null ? void 0 : _a2.uid;
  11455. });
  11456. const isDisabled = computed(() => props.node.isDisabled);
  11457. const isLeaf2 = computed(() => props.node.isLeaf);
  11458. const expandable = computed(() => checkStrictly.value && !isLeaf2.value || !isDisabled.value);
  11459. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  11460. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  11461. const isInPath = (node) => {
  11462. var _a2;
  11463. const { level, uid: uid2 } = props.node;
  11464. return ((_a2 = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a2.uid) === uid2;
  11465. };
  11466. const doExpand = () => {
  11467. if (inExpandingPath.value)
  11468. return;
  11469. panel.expandNode(props.node);
  11470. };
  11471. const doCheck = (checked) => {
  11472. const { node } = props;
  11473. if (checked === node.checked)
  11474. return;
  11475. panel.handleCheckChange(node, checked);
  11476. };
  11477. const doLoad = () => {
  11478. panel.lazyLoad(props.node, () => {
  11479. if (!isLeaf2.value)
  11480. doExpand();
  11481. });
  11482. };
  11483. const handleHoverExpand = (e) => {
  11484. if (!isHoverMenu.value)
  11485. return;
  11486. handleExpand();
  11487. !isLeaf2.value && emit("expand", e);
  11488. };
  11489. const handleExpand = () => {
  11490. const { node } = props;
  11491. if (!expandable.value || node.loading)
  11492. return;
  11493. node.loaded ? doExpand() : doLoad();
  11494. };
  11495. const handleClick = () => {
  11496. if (isHoverMenu.value && !isLeaf2.value)
  11497. return;
  11498. if (isLeaf2.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  11499. handleCheck(true);
  11500. } else {
  11501. handleExpand();
  11502. }
  11503. };
  11504. const handleSelectCheck = (checked) => {
  11505. if (checkStrictly.value) {
  11506. doCheck(checked);
  11507. if (props.node.loaded) {
  11508. doExpand();
  11509. }
  11510. } else {
  11511. handleCheck(checked);
  11512. }
  11513. };
  11514. const handleCheck = (checked) => {
  11515. if (!props.node.loaded) {
  11516. doLoad();
  11517. } else {
  11518. doCheck(checked);
  11519. !checkStrictly.value && doExpand();
  11520. }
  11521. };
  11522. return {
  11523. panel,
  11524. isHoverMenu,
  11525. multiple,
  11526. checkStrictly,
  11527. checkedNodeId,
  11528. isDisabled,
  11529. isLeaf: isLeaf2,
  11530. expandable,
  11531. inExpandingPath,
  11532. inCheckedPath,
  11533. ns,
  11534. handleHoverExpand,
  11535. handleExpand,
  11536. handleClick,
  11537. handleCheck,
  11538. handleSelectCheck
  11539. };
  11540. }
  11541. });
  11542. const _hoisted_1$v = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  11543. const _hoisted_2$n = /* @__PURE__ */ createElementVNode("span", null, null, -1);
  11544. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  11545. const _component_el_checkbox = resolveComponent("el-checkbox");
  11546. const _component_el_radio = resolveComponent("el-radio");
  11547. const _component_check = resolveComponent("check");
  11548. const _component_el_icon = resolveComponent("el-icon");
  11549. const _component_node_content = resolveComponent("node-content");
  11550. const _component_loading = resolveComponent("loading");
  11551. const _component_arrow_right = resolveComponent("arrow-right");
  11552. return openBlock(), createElementBlock("li", {
  11553. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  11554. role: "menuitem",
  11555. "aria-haspopup": !_ctx.isLeaf,
  11556. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  11557. "aria-expanded": _ctx.inExpandingPath,
  11558. tabindex: _ctx.expandable ? -1 : void 0,
  11559. class: normalizeClass([
  11560. _ctx.ns.b(),
  11561. _ctx.ns.is("selectable", _ctx.checkStrictly),
  11562. _ctx.ns.is("active", _ctx.node.checked),
  11563. _ctx.ns.is("disabled", !_ctx.expandable),
  11564. _ctx.inExpandingPath && "in-active-path",
  11565. _ctx.inCheckedPath && "in-checked-path"
  11566. ]),
  11567. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11568. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  11569. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  11570. }, [
  11571. createCommentVNode(" prefix "),
  11572. _ctx.multiple ? (openBlock(), createBlock(_component_el_checkbox, {
  11573. key: 0,
  11574. "model-value": _ctx.node.checked,
  11575. indeterminate: _ctx.node.indeterminate,
  11576. disabled: _ctx.isDisabled,
  11577. onClick: _cache[0] || (_cache[0] = withModifiers(() => {
  11578. }, ["stop"])),
  11579. "onUpdate:modelValue": _ctx.handleSelectCheck
  11580. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (openBlock(), createBlock(_component_el_radio, {
  11581. key: 1,
  11582. "model-value": _ctx.checkedNodeId,
  11583. label: _ctx.node.uid,
  11584. disabled: _ctx.isDisabled,
  11585. "onUpdate:modelValue": _ctx.handleSelectCheck,
  11586. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  11587. }, ["stop"]))
  11588. }, {
  11589. default: withCtx(() => [
  11590. 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 "),
  11591. _hoisted_2$n
  11592. ]),
  11593. _: 1
  11594. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (openBlock(), createBlock(_component_el_icon, {
  11595. key: 2,
  11596. class: normalizeClass(_ctx.ns.e("prefix"))
  11597. }, {
  11598. default: withCtx(() => [
  11599. createVNode(_component_check)
  11600. ]),
  11601. _: 1
  11602. }, 8, ["class"])) : createCommentVNode("v-if", true),
  11603. createCommentVNode(" content "),
  11604. createVNode(_component_node_content),
  11605. createCommentVNode(" postfix "),
  11606. !_ctx.isLeaf ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  11607. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  11608. key: 0,
  11609. class: normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  11610. }, {
  11611. default: withCtx(() => [
  11612. createVNode(_component_loading)
  11613. ]),
  11614. _: 1
  11615. }, 8, ["class"])) : (openBlock(), createBlock(_component_el_icon, {
  11616. key: 1,
  11617. class: normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  11618. }, {
  11619. default: withCtx(() => [
  11620. createVNode(_component_arrow_right)
  11621. ]),
  11622. _: 1
  11623. }, 8, ["class"]))
  11624. ], 2112)) : createCommentVNode("v-if", true)
  11625. ], 42, _hoisted_1$v);
  11626. }
  11627. var ElCascaderNode = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["render", _sfc_render$q], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/node.vue"]]);
  11628. const _sfc_main$M = defineComponent({
  11629. name: "ElCascaderMenu",
  11630. components: {
  11631. Loading: loading,
  11632. ElIcon,
  11633. ElScrollbar,
  11634. ElCascaderNode
  11635. },
  11636. props: {
  11637. nodes: {
  11638. type: Array,
  11639. required: true
  11640. },
  11641. index: {
  11642. type: Number,
  11643. required: true
  11644. }
  11645. },
  11646. setup(props) {
  11647. const instance = getCurrentInstance();
  11648. const ns = useNamespace("cascader-menu");
  11649. const { t } = useLocale();
  11650. const id = generateId();
  11651. let activeNode = null;
  11652. let hoverTimer = null;
  11653. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  11654. const hoverZone = ref(null);
  11655. const isEmpty3 = computed(() => !props.nodes.length);
  11656. const isLoading = computed(() => !panel.initialLoaded);
  11657. const menuId = computed(() => `cascader-menu-${id}-${props.index}`);
  11658. const handleExpand = (e) => {
  11659. activeNode = e.target;
  11660. };
  11661. const handleMouseMove = (e) => {
  11662. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  11663. return;
  11664. if (activeNode.contains(e.target)) {
  11665. clearHoverTimer();
  11666. const el = instance.vnode.el;
  11667. const { left: left2 } = el.getBoundingClientRect();
  11668. const { offsetWidth, offsetHeight } = el;
  11669. const startX = e.clientX - left2;
  11670. const top2 = activeNode.offsetTop;
  11671. const bottom2 = top2 + activeNode.offsetHeight;
  11672. hoverZone.value.innerHTML = `
  11673. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top2} L${offsetWidth} 0 V${top2} Z" />
  11674. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom2} L${offsetWidth} ${offsetHeight} V${bottom2} Z" />
  11675. `;
  11676. } else if (!hoverTimer) {
  11677. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  11678. }
  11679. };
  11680. const clearHoverTimer = () => {
  11681. if (!hoverTimer)
  11682. return;
  11683. clearTimeout(hoverTimer);
  11684. hoverTimer = null;
  11685. };
  11686. const clearHoverZone = () => {
  11687. if (!hoverZone.value)
  11688. return;
  11689. hoverZone.value.innerHTML = "";
  11690. clearHoverTimer();
  11691. };
  11692. return {
  11693. ns,
  11694. panel,
  11695. hoverZone,
  11696. isEmpty: isEmpty3,
  11697. isLoading,
  11698. menuId,
  11699. t,
  11700. handleExpand,
  11701. handleMouseMove,
  11702. clearHoverZone
  11703. };
  11704. }
  11705. });
  11706. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  11707. const _component_el_cascader_node = resolveComponent("el-cascader-node");
  11708. const _component_loading = resolveComponent("loading");
  11709. const _component_el_icon = resolveComponent("el-icon");
  11710. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  11711. return openBlock(), createBlock(_component_el_scrollbar, {
  11712. key: _ctx.menuId,
  11713. tag: "ul",
  11714. role: "menu",
  11715. class: normalizeClass(_ctx.ns.b()),
  11716. "wrap-class": _ctx.ns.e("wrap"),
  11717. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  11718. onMousemove: _ctx.handleMouseMove,
  11719. onMouseleave: _ctx.clearHoverZone
  11720. }, {
  11721. default: withCtx(() => {
  11722. var _a2;
  11723. return [
  11724. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodes, (node) => {
  11725. return openBlock(), createBlock(_component_el_cascader_node, {
  11726. key: node.uid,
  11727. node,
  11728. "menu-id": _ctx.menuId,
  11729. onExpand: _ctx.handleExpand
  11730. }, null, 8, ["node", "menu-id", "onExpand"]);
  11731. }), 128)),
  11732. _ctx.isLoading ? (openBlock(), createElementBlock("div", {
  11733. key: 0,
  11734. class: normalizeClass(_ctx.ns.e("empty-text"))
  11735. }, [
  11736. createVNode(_component_el_icon, {
  11737. size: "14",
  11738. class: normalizeClass(_ctx.ns.is("loading"))
  11739. }, {
  11740. default: withCtx(() => [
  11741. createVNode(_component_loading)
  11742. ]),
  11743. _: 1
  11744. }, 8, ["class"]),
  11745. createTextVNode(" " + toDisplayString(_ctx.t("el.cascader.loading")), 1)
  11746. ], 2)) : _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  11747. key: 1,
  11748. class: normalizeClass(_ctx.ns.e("empty-text"))
  11749. }, toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a2 = _ctx.panel) == null ? void 0 : _a2.isHoverMenu) ? (openBlock(), createElementBlock("svg", {
  11750. key: 2,
  11751. ref: "hoverZone",
  11752. class: normalizeClass(_ctx.ns.e("hover-zone"))
  11753. }, null, 2)) : createCommentVNode("v-if", true)
  11754. ];
  11755. }),
  11756. _: 1
  11757. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  11758. }
  11759. var ElCascaderMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["render", _sfc_render$p], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/menu.vue"]]);
  11760. var ExpandTrigger = /* @__PURE__ */ ((ExpandTrigger2) => {
  11761. ExpandTrigger2["CLICK"] = "click";
  11762. ExpandTrigger2["HOVER"] = "hover";
  11763. return ExpandTrigger2;
  11764. })(ExpandTrigger || {});
  11765. let uid = 0;
  11766. const calculatePathNodes = (node) => {
  11767. const nodes = [node];
  11768. let { parent } = node;
  11769. while (parent) {
  11770. nodes.unshift(parent);
  11771. parent = parent.parent;
  11772. }
  11773. return nodes;
  11774. };
  11775. class Node {
  11776. constructor(data2, config, parent, root2 = false) {
  11777. this.data = data2;
  11778. this.config = config;
  11779. this.parent = parent;
  11780. this.root = root2;
  11781. this.uid = uid++;
  11782. this.checked = false;
  11783. this.indeterminate = false;
  11784. this.loading = false;
  11785. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  11786. const childrenData = data2[childrenKey];
  11787. const pathNodes = calculatePathNodes(this);
  11788. this.level = root2 ? 0 : parent ? parent.level + 1 : 1;
  11789. this.value = data2[valueKey];
  11790. this.label = data2[labelKey];
  11791. this.pathNodes = pathNodes;
  11792. this.pathValues = pathNodes.map((node) => node.value);
  11793. this.pathLabels = pathNodes.map((node) => node.label);
  11794. this.childrenData = childrenData;
  11795. this.children = (childrenData || []).map((child) => new Node(child, config, this));
  11796. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  11797. }
  11798. get isDisabled() {
  11799. const { data: data2, parent, config } = this;
  11800. const { disabled, checkStrictly } = config;
  11801. const isDisabled = isFunction(disabled) ? disabled(data2, this) : !!data2[disabled];
  11802. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  11803. }
  11804. get isLeaf() {
  11805. const { data: data2, config, childrenData, loaded } = this;
  11806. const { lazy, leaf } = config;
  11807. const isLeaf2 = isFunction(leaf) ? leaf(data2, this) : data2[leaf];
  11808. return isUndefined(isLeaf2) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf2;
  11809. }
  11810. get valueByOption() {
  11811. return this.config.emitPath ? this.pathValues : this.value;
  11812. }
  11813. appendChild(childData) {
  11814. const { childrenData, children } = this;
  11815. const node = new Node(childData, this.config, this);
  11816. if (Array.isArray(childrenData)) {
  11817. childrenData.push(childData);
  11818. } else {
  11819. this.childrenData = [childData];
  11820. }
  11821. children.push(node);
  11822. return node;
  11823. }
  11824. calcText(allLevels, separator) {
  11825. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  11826. this.text = text;
  11827. return text;
  11828. }
  11829. broadcast(event, ...args) {
  11830. const handlerName = `onParent${capitalize(event)}`;
  11831. this.children.forEach((child) => {
  11832. if (child) {
  11833. child.broadcast(event, ...args);
  11834. child[handlerName] && child[handlerName](...args);
  11835. }
  11836. });
  11837. }
  11838. emit(event, ...args) {
  11839. const { parent } = this;
  11840. const handlerName = `onChild${capitalize(event)}`;
  11841. if (parent) {
  11842. parent[handlerName] && parent[handlerName](...args);
  11843. parent.emit(event, ...args);
  11844. }
  11845. }
  11846. onParentCheck(checked) {
  11847. if (!this.isDisabled) {
  11848. this.setCheckState(checked);
  11849. }
  11850. }
  11851. onChildCheck() {
  11852. const { children } = this;
  11853. const validChildren = children.filter((child) => !child.isDisabled);
  11854. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  11855. this.setCheckState(checked);
  11856. }
  11857. setCheckState(checked) {
  11858. const totalNum = this.children.length;
  11859. const checkedNum = this.children.reduce((c2, p2) => {
  11860. const num = p2.checked ? 1 : p2.indeterminate ? 0.5 : 0;
  11861. return c2 + num;
  11862. }, 0);
  11863. this.checked = this.loaded && this.children.every((child) => child.loaded && child.checked) && checked;
  11864. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  11865. }
  11866. doCheck(checked) {
  11867. if (this.checked === checked)
  11868. return;
  11869. const { checkStrictly, multiple } = this.config;
  11870. if (checkStrictly || !multiple) {
  11871. this.checked = checked;
  11872. } else {
  11873. this.broadcast("check", checked);
  11874. this.setCheckState(checked);
  11875. this.emit("check");
  11876. }
  11877. }
  11878. }
  11879. const flatNodes = (nodes, leafOnly) => {
  11880. return nodes.reduce((res, node) => {
  11881. if (node.isLeaf) {
  11882. res.push(node);
  11883. } else {
  11884. !leafOnly && res.push(node);
  11885. res = res.concat(flatNodes(node.children, leafOnly));
  11886. }
  11887. return res;
  11888. }, []);
  11889. };
  11890. class Store {
  11891. constructor(data2, config) {
  11892. this.config = config;
  11893. const nodes = (data2 || []).map((nodeData) => new Node(nodeData, this.config));
  11894. this.nodes = nodes;
  11895. this.allNodes = flatNodes(nodes, false);
  11896. this.leafNodes = flatNodes(nodes, true);
  11897. }
  11898. getNodes() {
  11899. return this.nodes;
  11900. }
  11901. getFlattedNodes(leafOnly) {
  11902. return leafOnly ? this.leafNodes : this.allNodes;
  11903. }
  11904. appendNode(nodeData, parentNode) {
  11905. const node = parentNode ? parentNode.appendChild(nodeData) : new Node(nodeData, this.config);
  11906. if (!parentNode)
  11907. this.nodes.push(node);
  11908. this.allNodes.push(node);
  11909. node.isLeaf && this.leafNodes.push(node);
  11910. }
  11911. appendNodes(nodeDataList, parentNode) {
  11912. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  11913. }
  11914. getNodeByValue(value, leafOnly = false) {
  11915. if (!value && value !== 0)
  11916. return null;
  11917. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  11918. return node || null;
  11919. }
  11920. getSameNode(node) {
  11921. if (!node)
  11922. return null;
  11923. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  11924. return node_ || null;
  11925. }
  11926. }
  11927. const CommonProps = {
  11928. modelValue: [Number, String, Array],
  11929. options: {
  11930. type: Array,
  11931. default: () => []
  11932. },
  11933. props: {
  11934. type: Object,
  11935. default: () => ({})
  11936. }
  11937. };
  11938. const DefaultProps = {
  11939. expandTrigger: ExpandTrigger.CLICK,
  11940. multiple: false,
  11941. checkStrictly: false,
  11942. emitPath: true,
  11943. lazy: false,
  11944. lazyLoad: NOOP,
  11945. value: "value",
  11946. label: "label",
  11947. children: "children",
  11948. leaf: "leaf",
  11949. disabled: "disabled",
  11950. hoverThreshold: 500
  11951. };
  11952. const useCascaderConfig = (props) => {
  11953. return computed(() => __spreadValues(__spreadValues({}, DefaultProps), props.props));
  11954. };
  11955. const getMenuIndex = (el) => {
  11956. if (!el)
  11957. return 0;
  11958. const pieces = el.id.split("-");
  11959. return Number(pieces[pieces.length - 2]);
  11960. };
  11961. const checkNode = (el) => {
  11962. if (!el)
  11963. return;
  11964. const input = el.querySelector("input");
  11965. if (input) {
  11966. input.click();
  11967. } else if (isLeaf(el)) {
  11968. el.click();
  11969. }
  11970. };
  11971. const sortByOriginalOrder = (oldNodes, newNodes) => {
  11972. const newNodesCopy = newNodes.slice(0);
  11973. const newIds = newNodesCopy.map((node) => node.uid);
  11974. const res = oldNodes.reduce((acc, item) => {
  11975. const index = newIds.indexOf(item.uid);
  11976. if (index > -1) {
  11977. acc.push(item);
  11978. newNodesCopy.splice(index, 1);
  11979. newIds.splice(index, 1);
  11980. }
  11981. return acc;
  11982. }, []);
  11983. res.push(...newNodesCopy);
  11984. return res;
  11985. };
  11986. const _sfc_main$L = defineComponent({
  11987. name: "ElCascaderPanel",
  11988. components: {
  11989. ElCascaderMenu
  11990. },
  11991. props: __spreadProps(__spreadValues({}, CommonProps), {
  11992. border: {
  11993. type: Boolean,
  11994. default: true
  11995. },
  11996. renderLabel: Function
  11997. }),
  11998. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  11999. setup(props, { emit, slots }) {
  12000. let manualChecked = false;
  12001. const ns = useNamespace("cascader");
  12002. const config = useCascaderConfig(props);
  12003. let store = null;
  12004. const initialLoaded = ref(true);
  12005. const menuList = ref([]);
  12006. const checkedValue = ref(null);
  12007. const menus = ref([]);
  12008. const expandingNode = ref(null);
  12009. const checkedNodes = ref([]);
  12010. const isHoverMenu = computed(() => config.value.expandTrigger === ExpandTrigger.HOVER);
  12011. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  12012. const initStore = () => {
  12013. const { options } = props;
  12014. const cfg = config.value;
  12015. manualChecked = false;
  12016. store = new Store(options, cfg);
  12017. menus.value = [store.getNodes()];
  12018. if (cfg.lazy && isEmpty(props.options)) {
  12019. initialLoaded.value = false;
  12020. lazyLoad(void 0, (list) => {
  12021. if (list) {
  12022. store = new Store(list, cfg);
  12023. menus.value = [store.getNodes()];
  12024. }
  12025. initialLoaded.value = true;
  12026. syncCheckedValue(false, true);
  12027. });
  12028. } else {
  12029. syncCheckedValue(false, true);
  12030. }
  12031. };
  12032. const lazyLoad = (node, cb) => {
  12033. const cfg = config.value;
  12034. node = node || new Node({}, cfg, void 0, true);
  12035. node.loading = true;
  12036. const resolve = (dataList) => {
  12037. const _node = node;
  12038. const parent = _node.root ? null : _node;
  12039. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  12040. _node.loading = false;
  12041. _node.loaded = true;
  12042. _node.childrenData = _node.childrenData || [];
  12043. cb && cb(dataList);
  12044. };
  12045. cfg.lazyLoad(node, resolve);
  12046. };
  12047. const expandNode = (node, silent) => {
  12048. var _a2;
  12049. const { level } = node;
  12050. const newMenus = menus.value.slice(0, level);
  12051. let newExpandingNode;
  12052. if (node.isLeaf) {
  12053. newExpandingNode = node.pathNodes[level - 2];
  12054. } else {
  12055. newExpandingNode = node;
  12056. newMenus.push(node.children);
  12057. }
  12058. if (((_a2 = expandingNode.value) == null ? void 0 : _a2.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  12059. expandingNode.value = node;
  12060. menus.value = newMenus;
  12061. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  12062. }
  12063. };
  12064. const handleCheckChange = (node, checked, emitClose = true) => {
  12065. const { checkStrictly, multiple } = config.value;
  12066. const oldNode = checkedNodes.value[0];
  12067. manualChecked = true;
  12068. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  12069. node.doCheck(checked);
  12070. calculateCheckedValue();
  12071. emitClose && !multiple && !checkStrictly && emit("close");
  12072. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  12073. };
  12074. const expandParentNode = (node) => {
  12075. if (!node)
  12076. return;
  12077. node = node.parent;
  12078. expandParentNode(node);
  12079. node && expandNode(node);
  12080. };
  12081. const getFlattedNodes = (leafOnly) => {
  12082. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  12083. };
  12084. const getCheckedNodes = (leafOnly) => {
  12085. var _a2;
  12086. return (_a2 = getFlattedNodes(leafOnly)) == null ? void 0 : _a2.filter((node) => node.checked !== false);
  12087. };
  12088. const clearCheckedNodes = () => {
  12089. checkedNodes.value.forEach((node) => node.doCheck(false));
  12090. calculateCheckedValue();
  12091. };
  12092. const calculateCheckedValue = () => {
  12093. var _a2;
  12094. const { checkStrictly, multiple } = config.value;
  12095. const oldNodes = checkedNodes.value;
  12096. const newNodes = getCheckedNodes(!checkStrictly);
  12097. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  12098. const values = nodes.map((node) => node.valueByOption);
  12099. checkedNodes.value = nodes;
  12100. checkedValue.value = multiple ? values : (_a2 = values[0]) != null ? _a2 : null;
  12101. };
  12102. const syncCheckedValue = (loaded = false, forced = false) => {
  12103. const { modelValue } = props;
  12104. const { lazy, multiple, checkStrictly } = config.value;
  12105. const leafOnly = !checkStrictly;
  12106. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  12107. return;
  12108. if (lazy && !loaded) {
  12109. const values = unique(flattenDeep(castArray(modelValue)));
  12110. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  12111. if (nodes.length) {
  12112. nodes.forEach((node) => {
  12113. lazyLoad(node, () => syncCheckedValue(false, forced));
  12114. });
  12115. } else {
  12116. syncCheckedValue(true, forced);
  12117. }
  12118. } else {
  12119. const values = multiple ? castArray(modelValue) : [modelValue];
  12120. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  12121. syncMenuState(nodes, false);
  12122. checkedValue.value = modelValue;
  12123. }
  12124. };
  12125. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  12126. const { checkStrictly } = config.value;
  12127. const oldNodes = checkedNodes.value;
  12128. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  12129. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  12130. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  12131. if (newExpandingNode) {
  12132. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  12133. } else {
  12134. expandingNode.value = null;
  12135. }
  12136. oldNodes.forEach((node) => node.doCheck(false));
  12137. newNodes.forEach((node) => node.doCheck(true));
  12138. checkedNodes.value = newNodes;
  12139. nextTick(scrollToExpandingNode);
  12140. };
  12141. const scrollToExpandingNode = () => {
  12142. if (!isClient)
  12143. return;
  12144. menuList.value.forEach((menu) => {
  12145. const menuElement = menu == null ? void 0 : menu.$el;
  12146. if (menuElement) {
  12147. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  12148. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  12149. scrollIntoView(container, activeNode);
  12150. }
  12151. });
  12152. };
  12153. const handleKeyDown2 = (e) => {
  12154. const target = e.target;
  12155. const { code } = e;
  12156. switch (code) {
  12157. case EVENT_CODE.up:
  12158. case EVENT_CODE.down: {
  12159. e.preventDefault();
  12160. const distance = code === EVENT_CODE.up ? -1 : 1;
  12161. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  12162. break;
  12163. }
  12164. case EVENT_CODE.left: {
  12165. e.preventDefault();
  12166. const preMenu = menuList.value[getMenuIndex(target) - 1];
  12167. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  12168. focusNode(expandedNode);
  12169. break;
  12170. }
  12171. case EVENT_CODE.right: {
  12172. e.preventDefault();
  12173. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  12174. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  12175. focusNode(firstNode);
  12176. break;
  12177. }
  12178. case EVENT_CODE.enter:
  12179. checkNode(target);
  12180. break;
  12181. case EVENT_CODE.esc:
  12182. case EVENT_CODE.tab:
  12183. emit("close");
  12184. break;
  12185. }
  12186. };
  12187. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  12188. config,
  12189. expandingNode,
  12190. checkedNodes,
  12191. isHoverMenu,
  12192. initialLoaded,
  12193. renderLabelFn,
  12194. lazyLoad,
  12195. expandNode,
  12196. handleCheckChange
  12197. }));
  12198. watch([config, () => props.options], initStore, {
  12199. deep: true,
  12200. immediate: true
  12201. });
  12202. watch(() => props.modelValue, () => {
  12203. manualChecked = false;
  12204. syncCheckedValue();
  12205. });
  12206. watch(checkedValue, (val) => {
  12207. if (!isEqual$1(val, props.modelValue)) {
  12208. emit(UPDATE_MODEL_EVENT, val);
  12209. emit(CHANGE_EVENT, val);
  12210. }
  12211. });
  12212. onBeforeUpdate(() => menuList.value = []);
  12213. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  12214. return {
  12215. ns,
  12216. menuList,
  12217. menus,
  12218. checkedNodes,
  12219. handleKeyDown: handleKeyDown2,
  12220. handleCheckChange,
  12221. getFlattedNodes,
  12222. getCheckedNodes,
  12223. clearCheckedNodes,
  12224. calculateCheckedValue,
  12225. scrollToExpandingNode
  12226. };
  12227. }
  12228. });
  12229. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  12230. const _component_el_cascader_menu = resolveComponent("el-cascader-menu");
  12231. return openBlock(), createElementBlock("div", {
  12232. class: normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  12233. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  12234. }, [
  12235. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menus, (menu, index) => {
  12236. return openBlock(), createBlock(_component_el_cascader_menu, {
  12237. key: index,
  12238. ref_for: true,
  12239. ref: (item) => _ctx.menuList[index] = item,
  12240. index,
  12241. nodes: [...menu]
  12242. }, null, 8, ["index", "nodes"]);
  12243. }), 128))
  12244. ], 34);
  12245. }
  12246. var CascaderPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["render", _sfc_render$o], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader-panel/src/index.vue"]]);
  12247. CascaderPanel.install = (app) => {
  12248. app.component(CascaderPanel.name, CascaderPanel);
  12249. };
  12250. const _CascaderPanel = CascaderPanel;
  12251. const tagProps = buildProps({
  12252. closable: Boolean,
  12253. type: {
  12254. type: String,
  12255. values: ["success", "info", "warning", "danger", ""],
  12256. default: ""
  12257. },
  12258. hit: Boolean,
  12259. disableTransitions: Boolean,
  12260. color: {
  12261. type: String,
  12262. default: ""
  12263. },
  12264. size: {
  12265. type: String,
  12266. values: componentSizes,
  12267. default: ""
  12268. },
  12269. effect: {
  12270. type: String,
  12271. values: ["dark", "light", "plain"],
  12272. default: "light"
  12273. },
  12274. round: Boolean
  12275. });
  12276. const tagEmits = {
  12277. close: (evt) => evt instanceof MouseEvent,
  12278. click: (evt) => evt instanceof MouseEvent
  12279. };
  12280. const __default__$d = {
  12281. name: "ElTag"
  12282. };
  12283. const _sfc_main$K = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$d), {
  12284. props: tagProps,
  12285. emits: tagEmits,
  12286. setup(__props, { emit }) {
  12287. const props = __props;
  12288. const tagSize = useSize();
  12289. const ns = useNamespace("tag");
  12290. const classes = computed(() => {
  12291. const { type: type4, hit, effect: effect2, closable, round: round2 } = props;
  12292. return [
  12293. ns.b(),
  12294. ns.is("closable", closable),
  12295. ns.m(type4),
  12296. ns.m(tagSize.value),
  12297. ns.m(effect2),
  12298. ns.is("hit", hit),
  12299. ns.is("round", round2)
  12300. ];
  12301. });
  12302. const handleClose = (event) => {
  12303. event.stopPropagation();
  12304. emit("close", event);
  12305. };
  12306. const handleClick = (event) => {
  12307. emit("click", event);
  12308. };
  12309. return (_ctx, _cache) => {
  12310. return !_ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  12311. key: 0,
  12312. class: normalizeClass(unref(classes)),
  12313. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12314. onClick: handleClick
  12315. }, [
  12316. createElementVNode("span", {
  12317. class: normalizeClass(unref(ns).e("content"))
  12318. }, [
  12319. renderSlot(_ctx.$slots, "default")
  12320. ], 2),
  12321. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12322. key: 0,
  12323. class: normalizeClass(unref(ns).e("close")),
  12324. onClick: handleClose
  12325. }, {
  12326. default: withCtx(() => [
  12327. createVNode(unref(close))
  12328. ]),
  12329. _: 1
  12330. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12331. ], 6)) : (openBlock(), createBlock(Transition, {
  12332. key: 1,
  12333. name: `${unref(ns).namespace.value}-zoom-in-center`
  12334. }, {
  12335. default: withCtx(() => [
  12336. createElementVNode("span", {
  12337. class: normalizeClass(unref(classes)),
  12338. style: normalizeStyle({ backgroundColor: _ctx.color }),
  12339. onClick: handleClick
  12340. }, [
  12341. createElementVNode("span", {
  12342. class: normalizeClass(unref(ns).e("content"))
  12343. }, [
  12344. renderSlot(_ctx.$slots, "default")
  12345. ], 2),
  12346. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  12347. key: 0,
  12348. class: normalizeClass(unref(ns).e("close")),
  12349. onClick: handleClose
  12350. }, {
  12351. default: withCtx(() => [
  12352. createVNode(unref(close))
  12353. ]),
  12354. _: 1
  12355. }, 8, ["class"])) : createCommentVNode("v-if", true)
  12356. ], 6)
  12357. ]),
  12358. _: 3
  12359. }, 8, ["name"]));
  12360. };
  12361. }
  12362. }));
  12363. var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
  12364. const ElTag = withInstall(Tag);
  12365. const DEFAULT_INPUT_HEIGHT = 40;
  12366. const INPUT_HEIGHT_MAP = {
  12367. large: 36,
  12368. default: 32,
  12369. small: 28
  12370. };
  12371. const popperOptions = {
  12372. modifiers: [
  12373. {
  12374. name: "arrowPosition",
  12375. enabled: true,
  12376. phase: "main",
  12377. fn: ({ state }) => {
  12378. const { modifiersData, placement } = state;
  12379. if (["right", "left", "bottom", "top"].includes(placement))
  12380. return;
  12381. modifiersData.arrow.x = 35;
  12382. },
  12383. requires: ["arrow"]
  12384. }
  12385. ]
  12386. };
  12387. const COMPONENT_NAME$4 = "ElCascader";
  12388. const _sfc_main$J = defineComponent({
  12389. name: COMPONENT_NAME$4,
  12390. components: {
  12391. ElCascaderPanel: _CascaderPanel,
  12392. ElInput,
  12393. ElTooltip,
  12394. ElScrollbar,
  12395. ElTag,
  12396. ElIcon,
  12397. CircleClose: circleClose,
  12398. Check: check,
  12399. ArrowDown: arrowDown
  12400. },
  12401. directives: {
  12402. Clickoutside: ClickOutside
  12403. },
  12404. props: __spreadProps(__spreadValues({}, CommonProps), {
  12405. size: {
  12406. type: String,
  12407. validator: isValidComponentSize
  12408. },
  12409. placeholder: {
  12410. type: String
  12411. },
  12412. disabled: Boolean,
  12413. clearable: Boolean,
  12414. filterable: Boolean,
  12415. filterMethod: {
  12416. type: Function,
  12417. default: (node, keyword) => node.text.includes(keyword)
  12418. },
  12419. separator: {
  12420. type: String,
  12421. default: " / "
  12422. },
  12423. showAllLevels: {
  12424. type: Boolean,
  12425. default: true
  12426. },
  12427. collapseTags: Boolean,
  12428. collapseTagsTooltip: {
  12429. type: Boolean,
  12430. default: false
  12431. },
  12432. debounce: {
  12433. type: Number,
  12434. default: 300
  12435. },
  12436. beforeFilter: {
  12437. type: Function,
  12438. default: () => true
  12439. },
  12440. popperClass: {
  12441. type: String,
  12442. default: ""
  12443. },
  12444. popperAppendToBody: {
  12445. type: Boolean,
  12446. default: void 0
  12447. },
  12448. teleported: useTooltipContentProps.teleported,
  12449. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  12450. }),
  12451. emits: [
  12452. UPDATE_MODEL_EVENT,
  12453. CHANGE_EVENT,
  12454. "focus",
  12455. "blur",
  12456. "visible-change",
  12457. "expand-change",
  12458. "remove-tag"
  12459. ],
  12460. setup(props, { emit }) {
  12461. let inputInitialHeight = 0;
  12462. let pressDeleteCount = 0;
  12463. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$4, "popperAppendToBody");
  12464. const nsCascader = useNamespace("cascader");
  12465. const nsInput = useNamespace("input");
  12466. const { t } = useLocale();
  12467. const elForm2 = inject(formContextKey, {});
  12468. const elFormItem2 = inject(formItemContextKey, {});
  12469. const tooltipRef = ref(null);
  12470. const input = ref(null);
  12471. const tagWrapper = ref(null);
  12472. const panel = ref(null);
  12473. const suggestionPanel = ref(null);
  12474. const popperVisible = ref(false);
  12475. const inputHover = ref(false);
  12476. const filtering = ref(false);
  12477. const inputValue = ref("");
  12478. const searchInputValue = ref("");
  12479. const presentTags = ref([]);
  12480. const allPresentTags = ref([]);
  12481. const suggestions = ref([]);
  12482. const isOnComposition = ref(false);
  12483. const isDisabled = computed(() => props.disabled || elForm2.disabled);
  12484. const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
  12485. const realSize = useSize();
  12486. const tagSize = computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  12487. const multiple = computed(() => !!props.props.multiple);
  12488. const readonly2 = computed(() => !props.filterable || multiple.value);
  12489. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  12490. const checkedNodes = computed(() => {
  12491. var _a2;
  12492. return ((_a2 = panel.value) == null ? void 0 : _a2.checkedNodes) || [];
  12493. });
  12494. const clearBtnVisible = computed(() => {
  12495. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  12496. return false;
  12497. return !!checkedNodes.value.length;
  12498. });
  12499. const presentText = computed(() => {
  12500. const { showAllLevels, separator } = props;
  12501. const nodes = checkedNodes.value;
  12502. return nodes.length ? multiple.value ? " " : nodes[0].calcText(showAllLevels, separator) : "";
  12503. });
  12504. const checkedValue = computed({
  12505. get() {
  12506. return props.modelValue;
  12507. },
  12508. set(val) {
  12509. var _a2;
  12510. emit(UPDATE_MODEL_EVENT, val);
  12511. emit(CHANGE_EVENT, val);
  12512. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  12513. }
  12514. });
  12515. const popperPaneRef = computed(() => {
  12516. var _a2, _b2;
  12517. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  12518. });
  12519. const togglePopperVisible = (visible) => {
  12520. var _a2, _b2, _c;
  12521. if (isDisabled.value)
  12522. return;
  12523. visible = visible != null ? visible : !popperVisible.value;
  12524. if (visible !== popperVisible.value) {
  12525. popperVisible.value = visible;
  12526. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.input) == null ? void 0 : _b2.setAttribute("aria-expanded", `${visible}`);
  12527. if (visible) {
  12528. updatePopperPosition();
  12529. nextTick((_c = panel.value) == null ? void 0 : _c.scrollToExpandingNode);
  12530. } else if (props.filterable) {
  12531. const { value } = presentText;
  12532. inputValue.value = value;
  12533. searchInputValue.value = value;
  12534. }
  12535. emit("visible-change", visible);
  12536. }
  12537. };
  12538. const updatePopperPosition = () => {
  12539. nextTick(() => {
  12540. var _a2;
  12541. (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper();
  12542. });
  12543. };
  12544. const hideSuggestionPanel = () => {
  12545. filtering.value = false;
  12546. };
  12547. const genTag2 = (node) => {
  12548. const { showAllLevels, separator } = props;
  12549. return {
  12550. node,
  12551. key: node.uid,
  12552. text: node.calcText(showAllLevels, separator),
  12553. hitState: false,
  12554. closable: !isDisabled.value && !node.isDisabled,
  12555. isCollapseTag: false
  12556. };
  12557. };
  12558. const deleteTag = (tag) => {
  12559. var _a2;
  12560. const node = tag.node;
  12561. node.doCheck(false);
  12562. (_a2 = panel.value) == null ? void 0 : _a2.calculateCheckedValue();
  12563. emit("remove-tag", node.valueByOption);
  12564. };
  12565. const calculatePresentTags = () => {
  12566. if (!multiple.value)
  12567. return;
  12568. const nodes = checkedNodes.value;
  12569. const tags = [];
  12570. const allTags = [];
  12571. nodes.forEach((node) => allTags.push(genTag2(node)));
  12572. allPresentTags.value = allTags;
  12573. if (nodes.length) {
  12574. const [first, ...rest] = nodes;
  12575. const restCount = rest.length;
  12576. tags.push(genTag2(first));
  12577. if (restCount) {
  12578. if (props.collapseTags) {
  12579. tags.push({
  12580. key: -1,
  12581. text: `+ ${restCount}`,
  12582. closable: false,
  12583. isCollapseTag: true
  12584. });
  12585. } else {
  12586. rest.forEach((node) => tags.push(genTag2(node)));
  12587. }
  12588. }
  12589. }
  12590. presentTags.value = tags;
  12591. };
  12592. const calculateSuggestions = () => {
  12593. var _a2, _b2;
  12594. const { filterMethod, showAllLevels, separator } = props;
  12595. const res = (_b2 = (_a2 = panel.value) == null ? void 0 : _a2.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b2.filter((node) => {
  12596. if (node.isDisabled)
  12597. return false;
  12598. node.calcText(showAllLevels, separator);
  12599. return filterMethod(node, searchKeyword.value);
  12600. });
  12601. if (multiple.value) {
  12602. presentTags.value.forEach((tag) => {
  12603. tag.hitState = false;
  12604. });
  12605. allPresentTags.value.forEach((tag) => {
  12606. tag.hitState = false;
  12607. });
  12608. }
  12609. filtering.value = true;
  12610. suggestions.value = res;
  12611. updatePopperPosition();
  12612. };
  12613. const focusFirstNode = () => {
  12614. var _a2;
  12615. let firstNode;
  12616. if (filtering.value && suggestionPanel.value) {
  12617. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  12618. } else {
  12619. firstNode = (_a2 = panel.value) == null ? void 0 : _a2.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  12620. }
  12621. if (firstNode) {
  12622. firstNode.focus();
  12623. !filtering.value && firstNode.click();
  12624. }
  12625. };
  12626. const updateStyle = () => {
  12627. var _a2, _b2;
  12628. const inputInner = (_a2 = input.value) == null ? void 0 : _a2.input;
  12629. const tagWrapperEl = tagWrapper.value;
  12630. const suggestionPanelEl = (_b2 = suggestionPanel.value) == null ? void 0 : _b2.$el;
  12631. if (!isClient || !inputInner)
  12632. return;
  12633. if (suggestionPanelEl) {
  12634. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  12635. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  12636. }
  12637. if (tagWrapperEl) {
  12638. const { offsetHeight } = tagWrapperEl;
  12639. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  12640. inputInner.style.height = height;
  12641. updatePopperPosition();
  12642. }
  12643. };
  12644. const getCheckedNodes = (leafOnly) => {
  12645. var _a2;
  12646. return (_a2 = panel.value) == null ? void 0 : _a2.getCheckedNodes(leafOnly);
  12647. };
  12648. const handleExpandChange = (value) => {
  12649. updatePopperPosition();
  12650. emit("expand-change", value);
  12651. };
  12652. const handleComposition = (event) => {
  12653. var _a2;
  12654. const text = (_a2 = event.target) == null ? void 0 : _a2.value;
  12655. if (event.type === "compositionend") {
  12656. isOnComposition.value = false;
  12657. nextTick(() => handleInput(text));
  12658. } else {
  12659. const lastCharacter = text[text.length - 1] || "";
  12660. isOnComposition.value = !isKorean(lastCharacter);
  12661. }
  12662. };
  12663. const handleKeyDown2 = (e) => {
  12664. if (isOnComposition.value)
  12665. return;
  12666. switch (e.code) {
  12667. case EVENT_CODE.enter:
  12668. togglePopperVisible();
  12669. break;
  12670. case EVENT_CODE.down:
  12671. togglePopperVisible(true);
  12672. nextTick(focusFirstNode);
  12673. e.preventDefault();
  12674. break;
  12675. case EVENT_CODE.esc:
  12676. case EVENT_CODE.tab:
  12677. togglePopperVisible(false);
  12678. break;
  12679. }
  12680. };
  12681. const handleClear = () => {
  12682. var _a2;
  12683. (_a2 = panel.value) == null ? void 0 : _a2.clearCheckedNodes();
  12684. togglePopperVisible(false);
  12685. };
  12686. const handleSuggestionClick = (node) => {
  12687. var _a2, _b2;
  12688. const { checked } = node;
  12689. if (multiple.value) {
  12690. (_a2 = panel.value) == null ? void 0 : _a2.handleCheckChange(node, !checked, false);
  12691. } else {
  12692. !checked && ((_b2 = panel.value) == null ? void 0 : _b2.handleCheckChange(node, true, false));
  12693. togglePopperVisible(false);
  12694. }
  12695. };
  12696. const handleSuggestionKeyDown = (e) => {
  12697. const target = e.target;
  12698. const { code } = e;
  12699. switch (code) {
  12700. case EVENT_CODE.up:
  12701. case EVENT_CODE.down: {
  12702. const distance = code === EVENT_CODE.up ? -1 : 1;
  12703. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  12704. break;
  12705. }
  12706. case EVENT_CODE.enter:
  12707. target.click();
  12708. break;
  12709. case EVENT_CODE.esc:
  12710. case EVENT_CODE.tab:
  12711. togglePopperVisible(false);
  12712. break;
  12713. }
  12714. };
  12715. const handleDelete = () => {
  12716. const tags = presentTags.value;
  12717. const lastTag = tags[tags.length - 1];
  12718. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  12719. if (!lastTag || !pressDeleteCount)
  12720. return;
  12721. if (lastTag.hitState) {
  12722. deleteTag(lastTag);
  12723. } else {
  12724. lastTag.hitState = true;
  12725. }
  12726. };
  12727. const handleFilter = debounce$1(() => {
  12728. const { value } = searchKeyword;
  12729. if (!value)
  12730. return;
  12731. const passed = props.beforeFilter(value);
  12732. if (isPromise(passed)) {
  12733. passed.then(calculateSuggestions).catch(() => {
  12734. });
  12735. } else if (passed !== false) {
  12736. calculateSuggestions();
  12737. } else {
  12738. hideSuggestionPanel();
  12739. }
  12740. }, props.debounce);
  12741. const handleInput = (val, e) => {
  12742. !popperVisible.value && togglePopperVisible(true);
  12743. if (e == null ? void 0 : e.isComposing)
  12744. return;
  12745. val ? handleFilter() : hideSuggestionPanel();
  12746. };
  12747. watch(filtering, updatePopperPosition);
  12748. watch([checkedNodes, isDisabled], calculatePresentTags);
  12749. watch(presentTags, () => {
  12750. nextTick(() => updateStyle());
  12751. });
  12752. watch(presentText, (val) => inputValue.value = val, { immediate: true });
  12753. onMounted(() => {
  12754. var _a2;
  12755. const inputEl = (_a2 = input.value) == null ? void 0 : _a2.$el;
  12756. inputInitialHeight = (inputEl == null ? void 0 : inputEl.offsetHeight) || INPUT_HEIGHT_MAP[realSize.value] || DEFAULT_INPUT_HEIGHT;
  12757. addResizeListener(inputEl, updateStyle);
  12758. });
  12759. onBeforeUnmount(() => {
  12760. var _a2;
  12761. removeResizeListener((_a2 = input.value) == null ? void 0 : _a2.$el, updateStyle);
  12762. });
  12763. return {
  12764. popperOptions,
  12765. tooltipRef,
  12766. popperPaneRef,
  12767. input,
  12768. tagWrapper,
  12769. panel,
  12770. suggestionPanel,
  12771. popperVisible,
  12772. inputHover,
  12773. inputPlaceholder,
  12774. filtering,
  12775. presentText,
  12776. checkedValue,
  12777. inputValue,
  12778. searchInputValue,
  12779. presentTags,
  12780. allPresentTags,
  12781. suggestions,
  12782. isDisabled,
  12783. isOnComposition,
  12784. realSize,
  12785. tagSize,
  12786. multiple,
  12787. readonly: readonly2,
  12788. clearBtnVisible,
  12789. compatTeleported,
  12790. nsCascader,
  12791. nsInput,
  12792. t,
  12793. togglePopperVisible,
  12794. hideSuggestionPanel,
  12795. deleteTag,
  12796. focusFirstNode,
  12797. getCheckedNodes,
  12798. handleExpandChange,
  12799. handleKeyDown: handleKeyDown2,
  12800. handleComposition,
  12801. handleClear,
  12802. handleSuggestionClick,
  12803. handleSuggestionKeyDown,
  12804. handleDelete,
  12805. handleInput
  12806. };
  12807. }
  12808. });
  12809. const _hoisted_1$u = { key: 0 };
  12810. const _hoisted_2$m = { class: "el-cascader__collapse-tags" };
  12811. const _hoisted_3$g = ["placeholder"];
  12812. const _hoisted_4$e = ["onClick"];
  12813. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  12814. const _component_circle_close = resolveComponent("circle-close");
  12815. const _component_el_icon = resolveComponent("el-icon");
  12816. const _component_arrow_down = resolveComponent("arrow-down");
  12817. const _component_el_input = resolveComponent("el-input");
  12818. const _component_el_tag = resolveComponent("el-tag");
  12819. const _component_el_tooltip = resolveComponent("el-tooltip");
  12820. const _component_el_cascader_panel = resolveComponent("el-cascader-panel");
  12821. const _component_check = resolveComponent("check");
  12822. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  12823. const _directive_clickoutside = resolveDirective("clickoutside");
  12824. return openBlock(), createBlock(_component_el_tooltip, {
  12825. ref: "tooltipRef",
  12826. visible: _ctx.popperVisible,
  12827. "onUpdate:visible": _cache[17] || (_cache[17] = ($event) => _ctx.popperVisible = $event),
  12828. teleported: _ctx.compatTeleported,
  12829. "popper-class": [_ctx.nsCascader.e("dropdown"), _ctx.popperClass],
  12830. "popper-options": _ctx.popperOptions,
  12831. "fallback-placements": [
  12832. "bottom-start",
  12833. "bottom",
  12834. "top-start",
  12835. "top",
  12836. "right",
  12837. "left"
  12838. ],
  12839. "stop-popper-mouse-event": false,
  12840. "gpu-acceleration": false,
  12841. placement: "bottom-start",
  12842. transition: `${_ctx.nsCascader.namespace.value}-zoom-in-top`,
  12843. effect: "light",
  12844. pure: "",
  12845. persistent: "",
  12846. onHide: _ctx.hideSuggestionPanel
  12847. }, {
  12848. default: withCtx(() => [
  12849. withDirectives((openBlock(), createElementBlock("div", {
  12850. class: normalizeClass([
  12851. _ctx.nsCascader.b(),
  12852. _ctx.nsCascader.m(_ctx.realSize),
  12853. _ctx.nsCascader.is("disabled", _ctx.isDisabled),
  12854. _ctx.$attrs.class
  12855. ]),
  12856. style: normalizeStyle(_ctx.$attrs.style),
  12857. onClick: _cache[11] || (_cache[11] = () => _ctx.togglePopperVisible(_ctx.readonly ? void 0 : true)),
  12858. onKeydown: _cache[12] || (_cache[12] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
  12859. onMouseenter: _cache[13] || (_cache[13] = ($event) => _ctx.inputHover = true),
  12860. onMouseleave: _cache[14] || (_cache[14] = ($event) => _ctx.inputHover = false)
  12861. }, [
  12862. createVNode(_component_el_input, {
  12863. ref: "input",
  12864. modelValue: _ctx.inputValue,
  12865. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.inputValue = $event),
  12866. placeholder: _ctx.inputPlaceholder,
  12867. readonly: _ctx.readonly,
  12868. disabled: _ctx.isDisabled,
  12869. "validate-event": false,
  12870. size: _ctx.realSize,
  12871. class: normalizeClass(_ctx.nsCascader.is("focus", _ctx.popperVisible)),
  12872. onCompositionstart: _ctx.handleComposition,
  12873. onCompositionupdate: _ctx.handleComposition,
  12874. onCompositionend: _ctx.handleComposition,
  12875. onFocus: _cache[2] || (_cache[2] = (e) => _ctx.$emit("focus", e)),
  12876. onBlur: _cache[3] || (_cache[3] = (e) => _ctx.$emit("blur", e)),
  12877. onInput: _ctx.handleInput
  12878. }, {
  12879. suffix: withCtx(() => [
  12880. _ctx.clearBtnVisible ? (openBlock(), createBlock(_component_el_icon, {
  12881. key: "clear",
  12882. class: normalizeClass([_ctx.nsInput.e("icon"), "icon-circle-close"]),
  12883. onClick: withModifiers(_ctx.handleClear, ["stop"])
  12884. }, {
  12885. default: withCtx(() => [
  12886. createVNode(_component_circle_close)
  12887. ]),
  12888. _: 1
  12889. }, 8, ["class", "onClick"])) : (openBlock(), createBlock(_component_el_icon, {
  12890. key: "arrow-down",
  12891. class: normalizeClass([
  12892. _ctx.nsInput.e("icon"),
  12893. "icon-arrow-down",
  12894. _ctx.nsCascader.is("reverse", _ctx.popperVisible)
  12895. ]),
  12896. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.togglePopperVisible(), ["stop"]))
  12897. }, {
  12898. default: withCtx(() => [
  12899. createVNode(_component_arrow_down)
  12900. ]),
  12901. _: 1
  12902. }, 8, ["class"]))
  12903. ]),
  12904. _: 1
  12905. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput"]),
  12906. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  12907. key: 0,
  12908. ref: "tagWrapper",
  12909. class: normalizeClass(_ctx.nsCascader.e("tags"))
  12910. }, [
  12911. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.presentTags, (tag) => {
  12912. return openBlock(), createBlock(_component_el_tag, {
  12913. key: tag.key,
  12914. type: _ctx.tagType,
  12915. size: _ctx.tagSize,
  12916. hit: tag.hitState,
  12917. closable: tag.closable,
  12918. "disable-transitions": "",
  12919. onClose: ($event) => _ctx.deleteTag(tag)
  12920. }, {
  12921. default: withCtx(() => [
  12922. tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", _hoisted_1$u, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(_component_el_tooltip, {
  12923. key: 1,
  12924. teleported: false,
  12925. disabled: _ctx.popperVisible || !_ctx.collapseTagsTooltip,
  12926. "fallback-placements": ["bottom", "top", "right", "left"],
  12927. placement: "bottom",
  12928. effect: "light"
  12929. }, {
  12930. default: withCtx(() => [
  12931. createElementVNode("span", null, toDisplayString(tag.text), 1)
  12932. ]),
  12933. content: withCtx(() => [
  12934. createElementVNode("div", _hoisted_2$m, [
  12935. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.allPresentTags, (tag2, idx) => {
  12936. return openBlock(), createElementBlock("div", {
  12937. key: idx,
  12938. class: "el-cascader__collapse-tag"
  12939. }, [
  12940. (openBlock(), createBlock(_component_el_tag, {
  12941. key: tag2.key,
  12942. class: "in-tooltip",
  12943. type: _ctx.tagType,
  12944. size: _ctx.tagSize,
  12945. hit: tag2.hitState,
  12946. closable: tag2.closable,
  12947. "disable-transitions": "",
  12948. onClose: ($event) => _ctx.deleteTag(tag2)
  12949. }, {
  12950. default: withCtx(() => [
  12951. createElementVNode("span", null, toDisplayString(tag2.text), 1)
  12952. ]),
  12953. _: 2
  12954. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  12955. ]);
  12956. }), 128))
  12957. ])
  12958. ]),
  12959. _: 2
  12960. }, 1032, ["disabled"]))
  12961. ]),
  12962. _: 2
  12963. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  12964. }), 128)),
  12965. _ctx.filterable && !_ctx.isDisabled ? withDirectives((openBlock(), createElementBlock("input", {
  12966. key: 0,
  12967. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.searchInputValue = $event),
  12968. type: "text",
  12969. class: normalizeClass(_ctx.nsCascader.e("search-input")),
  12970. placeholder: _ctx.presentText ? "" : _ctx.inputPlaceholder,
  12971. onInput: _cache[5] || (_cache[5] = (e) => _ctx.handleInput(_ctx.searchInputValue, e)),
  12972. onClick: _cache[6] || (_cache[6] = withModifiers(($event) => _ctx.togglePopperVisible(true), ["stop"])),
  12973. onKeydown: _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleDelete && _ctx.handleDelete(...args), ["delete"])),
  12974. onCompositionstart: _cache[8] || (_cache[8] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12975. onCompositionupdate: _cache[9] || (_cache[9] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  12976. onCompositionend: _cache[10] || (_cache[10] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args))
  12977. }, null, 42, _hoisted_3$g)), [
  12978. [vModelText, _ctx.searchInputValue]
  12979. ]) : createCommentVNode("v-if", true)
  12980. ], 2)) : createCommentVNode("v-if", true)
  12981. ], 38)), [
  12982. [_directive_clickoutside, () => _ctx.togglePopperVisible(false), _ctx.popperPaneRef]
  12983. ])
  12984. ]),
  12985. content: withCtx(() => [
  12986. withDirectives(createVNode(_component_el_cascader_panel, {
  12987. ref: "panel",
  12988. modelValue: _ctx.checkedValue,
  12989. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.checkedValue = $event),
  12990. options: _ctx.options,
  12991. props: _ctx.props,
  12992. border: false,
  12993. "render-label": _ctx.$slots.default,
  12994. onExpandChange: _ctx.handleExpandChange,
  12995. onClose: _cache[16] || (_cache[16] = ($event) => _ctx.$nextTick(() => _ctx.togglePopperVisible(false)))
  12996. }, null, 8, ["modelValue", "options", "props", "render-label", "onExpandChange"]), [
  12997. [vShow, !_ctx.filtering]
  12998. ]),
  12999. _ctx.filterable ? withDirectives((openBlock(), createBlock(_component_el_scrollbar, {
  13000. key: 0,
  13001. ref: "suggestionPanel",
  13002. tag: "ul",
  13003. class: normalizeClass(_ctx.nsCascader.e("suggestion-panel")),
  13004. "view-class": _ctx.nsCascader.e("suggestion-list"),
  13005. onKeydown: _ctx.handleSuggestionKeyDown
  13006. }, {
  13007. default: withCtx(() => [
  13008. _ctx.suggestions.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.suggestions, (item) => {
  13009. return openBlock(), createElementBlock("li", {
  13010. key: item.uid,
  13011. class: normalizeClass([
  13012. _ctx.nsCascader.e("suggestion-item"),
  13013. _ctx.nsCascader.is("checked", item.checked)
  13014. ]),
  13015. tabindex: -1,
  13016. onClick: ($event) => _ctx.handleSuggestionClick(item)
  13017. }, [
  13018. createElementVNode("span", null, toDisplayString(item.text), 1),
  13019. item.checked ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  13020. default: withCtx(() => [
  13021. createVNode(_component_check)
  13022. ]),
  13023. _: 1
  13024. })) : createCommentVNode("v-if", true)
  13025. ], 10, _hoisted_4$e);
  13026. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  13027. createElementVNode("li", {
  13028. class: normalizeClass(_ctx.nsCascader.e("empty-text"))
  13029. }, toDisplayString(_ctx.t("el.cascader.noMatch")), 3)
  13030. ])
  13031. ]),
  13032. _: 3
  13033. }, 8, ["class", "view-class", "onKeydown"])), [
  13034. [vShow, _ctx.filtering]
  13035. ]) : createCommentVNode("v-if", true)
  13036. ]),
  13037. _: 3
  13038. }, 8, ["visible", "teleported", "popper-class", "popper-options", "transition", "onHide"]);
  13039. }
  13040. var Cascader = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$n], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/cascader/src/index.vue"]]);
  13041. Cascader.install = (app) => {
  13042. app.component(Cascader.name, Cascader);
  13043. };
  13044. const _Cascader = Cascader;
  13045. const ElCascader = _Cascader;
  13046. const messageConfig = {};
  13047. const configProviderProps = buildProps({
  13048. a11y: {
  13049. type: Boolean,
  13050. default: true
  13051. },
  13052. locale: {
  13053. type: definePropType(Object)
  13054. },
  13055. size: {
  13056. type: String,
  13057. values: componentSizes,
  13058. default: ""
  13059. },
  13060. button: {
  13061. type: definePropType(Object)
  13062. },
  13063. experimentalFeatures: {
  13064. type: definePropType(Object)
  13065. },
  13066. keyboardNavigation: {
  13067. type: Boolean,
  13068. default: true
  13069. },
  13070. message: {
  13071. type: definePropType(Object)
  13072. },
  13073. zIndex: {
  13074. type: Number
  13075. },
  13076. namespace: {
  13077. type: String,
  13078. default: "el"
  13079. }
  13080. });
  13081. var ConfigProvider = defineComponent({
  13082. name: "ElConfigProvider",
  13083. props: configProviderProps,
  13084. setup(props, { slots }) {
  13085. watch(() => props.message, (val) => {
  13086. Object.assign(messageConfig, val != null ? val : {});
  13087. }, { immediate: true, deep: true });
  13088. const config = provideGlobalConfig(props);
  13089. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  13090. }
  13091. });
  13092. const ElConfigProvider = withInstall(ConfigProvider);
  13093. var advancedFormat$1 = { exports: {} };
  13094. (function(module2, exports2) {
  13095. !function(e, t) {
  13096. module2.exports = t();
  13097. }(commonjsGlobal, function() {
  13098. return function(e, t) {
  13099. var r = t.prototype, n = r.format;
  13100. r.format = function(e2) {
  13101. var t2 = this, r2 = this.$locale();
  13102. if (!this.isValid())
  13103. return n.bind(this)(e2);
  13104. var s2 = this.$utils(), a2 = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) {
  13105. switch (e3) {
  13106. case "Q":
  13107. return Math.ceil((t2.$M + 1) / 3);
  13108. case "Do":
  13109. return r2.ordinal(t2.$D);
  13110. case "gggg":
  13111. return t2.weekYear();
  13112. case "GGGG":
  13113. return t2.isoWeekYear();
  13114. case "wo":
  13115. return r2.ordinal(t2.week(), "W");
  13116. case "w":
  13117. case "ww":
  13118. return s2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  13119. case "W":
  13120. case "WW":
  13121. return s2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  13122. case "k":
  13123. case "kk":
  13124. return s2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  13125. case "X":
  13126. return Math.floor(t2.$d.getTime() / 1e3);
  13127. case "x":
  13128. return t2.$d.getTime();
  13129. case "z":
  13130. return "[" + t2.offsetName() + "]";
  13131. case "zzz":
  13132. return "[" + t2.offsetName("long") + "]";
  13133. default:
  13134. return e3;
  13135. }
  13136. });
  13137. return n.bind(this)(a2);
  13138. };
  13139. };
  13140. });
  13141. })(advancedFormat$1);
  13142. var advancedFormat = advancedFormat$1.exports;
  13143. var weekOfYear$1 = { exports: {} };
  13144. (function(module2, exports2) {
  13145. !function(e, t) {
  13146. module2.exports = t();
  13147. }(commonjsGlobal, function() {
  13148. var e = "week", t = "year";
  13149. return function(i, n, r) {
  13150. var f2 = n.prototype;
  13151. f2.week = function(i2) {
  13152. if (i2 === void 0 && (i2 = null), i2 !== null)
  13153. return this.add(7 * (i2 - this.week()), "day");
  13154. var n2 = this.$locale().yearStart || 1;
  13155. if (this.month() === 11 && this.date() > 25) {
  13156. var f3 = r(this).startOf(t).add(1, t).date(n2), s2 = r(this).endOf(e);
  13157. if (f3.isBefore(s2))
  13158. return 1;
  13159. }
  13160. var a2 = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o2 = this.diff(a2, e, true);
  13161. return o2 < 0 ? r(this).startOf("week").week() : Math.ceil(o2);
  13162. }, f2.weeks = function(e2) {
  13163. return e2 === void 0 && (e2 = null), this.week(e2);
  13164. };
  13165. };
  13166. });
  13167. })(weekOfYear$1);
  13168. var weekOfYear = weekOfYear$1.exports;
  13169. var weekYear$1 = { exports: {} };
  13170. (function(module2, exports2) {
  13171. !function(e, t) {
  13172. module2.exports = t();
  13173. }(commonjsGlobal, function() {
  13174. return function(e, t) {
  13175. t.prototype.weekYear = function() {
  13176. var e2 = this.month(), t2 = this.week(), n = this.year();
  13177. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  13178. };
  13179. };
  13180. });
  13181. })(weekYear$1);
  13182. var weekYear = weekYear$1.exports;
  13183. var dayOfYear$1 = { exports: {} };
  13184. (function(module2, exports2) {
  13185. !function(e, t) {
  13186. module2.exports = t();
  13187. }(commonjsGlobal, function() {
  13188. return function(e, t, n) {
  13189. t.prototype.dayOfYear = function(e2) {
  13190. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  13191. return e2 == null ? t2 : this.add(e2 - t2, "day");
  13192. };
  13193. };
  13194. });
  13195. })(dayOfYear$1);
  13196. var dayOfYear = dayOfYear$1.exports;
  13197. var isSameOrAfter$1 = { exports: {} };
  13198. (function(module2, exports2) {
  13199. !function(e, t) {
  13200. module2.exports = t();
  13201. }(commonjsGlobal, function() {
  13202. return function(e, t) {
  13203. t.prototype.isSameOrAfter = function(e2, t2) {
  13204. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  13205. };
  13206. };
  13207. });
  13208. })(isSameOrAfter$1);
  13209. var isSameOrAfter = isSameOrAfter$1.exports;
  13210. var isSameOrBefore$1 = { exports: {} };
  13211. (function(module2, exports2) {
  13212. !function(e, i) {
  13213. module2.exports = i();
  13214. }(commonjsGlobal, function() {
  13215. return function(e, i) {
  13216. i.prototype.isSameOrBefore = function(e2, i2) {
  13217. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  13218. };
  13219. };
  13220. });
  13221. })(isSameOrBefore$1);
  13222. var isSameOrBefore = isSameOrBefore$1.exports;
  13223. const ROOT_PICKER_INJECTION_KEY = Symbol();
  13224. var ElDatePickerCell = defineComponent({
  13225. name: "ElDatePickerCell",
  13226. props: buildProps({
  13227. cell: {
  13228. type: definePropType(Object)
  13229. }
  13230. }),
  13231. setup(props) {
  13232. const picker = inject(ROOT_PICKER_INJECTION_KEY);
  13233. return () => {
  13234. const cell = props.cell;
  13235. if (picker == null ? void 0 : picker.ctx.slots.default) {
  13236. const list = picker.ctx.slots.default(cell).filter((item) => {
  13237. return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)";
  13238. });
  13239. if (list.length) {
  13240. return list;
  13241. }
  13242. }
  13243. return h$1("div", {
  13244. class: "el-date-table-cell"
  13245. }, [
  13246. h$1("span", {
  13247. class: "el-date-table-cell__text"
  13248. }, [cell == null ? void 0 : cell.text])
  13249. ]);
  13250. };
  13251. }
  13252. });
  13253. const _sfc_main$I = defineComponent({
  13254. components: {
  13255. ElDatePickerCell
  13256. },
  13257. props: {
  13258. date: {
  13259. type: Object
  13260. },
  13261. minDate: {
  13262. type: Object
  13263. },
  13264. maxDate: {
  13265. type: Object
  13266. },
  13267. parsedValue: {
  13268. type: [Object, Array]
  13269. },
  13270. selectionMode: {
  13271. type: String,
  13272. default: "day"
  13273. },
  13274. showWeekNumber: {
  13275. type: Boolean,
  13276. default: false
  13277. },
  13278. disabledDate: {
  13279. type: Function
  13280. },
  13281. cellClassName: {
  13282. type: Function
  13283. },
  13284. rangeState: {
  13285. type: Object,
  13286. default: () => ({
  13287. endDate: null,
  13288. selecting: false
  13289. })
  13290. }
  13291. },
  13292. emits: ["changerange", "pick", "select"],
  13293. setup(props, ctx) {
  13294. const { t, lang } = useLocale();
  13295. const lastRow = ref(null);
  13296. const lastColumn = ref(null);
  13297. const tableRows = ref([[], [], [], [], [], []]);
  13298. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  13299. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_2) => _2.toLowerCase());
  13300. const offsetDay = computed(() => {
  13301. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  13302. });
  13303. const startDate = computed(() => {
  13304. const startDayOfMonth = props.date.startOf("month");
  13305. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  13306. });
  13307. const WEEKS = computed(() => {
  13308. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  13309. });
  13310. const rows = computed(() => {
  13311. var _a2;
  13312. const startOfMonth = props.date.startOf("month");
  13313. const startOfMonthDay = startOfMonth.day() || 7;
  13314. const dateCountOfMonth = startOfMonth.daysInMonth();
  13315. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  13316. const offset2 = offsetDay.value;
  13317. const rows_ = tableRows.value;
  13318. let count = 1;
  13319. const selectedDate = props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  13320. const calNow = dayjs().locale(lang.value).startOf("day");
  13321. for (let i = 0; i < 6; i++) {
  13322. const row = rows_[i];
  13323. if (props.showWeekNumber) {
  13324. if (!row[0]) {
  13325. row[0] = {
  13326. type: "week",
  13327. text: startDate.value.add(i * 7 + 1, "day").week()
  13328. };
  13329. }
  13330. }
  13331. for (let j = 0; j < 7; j++) {
  13332. let cell = row[props.showWeekNumber ? j + 1 : j];
  13333. if (!cell) {
  13334. cell = {
  13335. row: i,
  13336. column: j,
  13337. type: "normal",
  13338. inRange: false,
  13339. start: false,
  13340. end: false
  13341. };
  13342. }
  13343. const index = i * 7 + j;
  13344. const calTime = startDate.value.add(index - offset2, "day");
  13345. cell.dayjs = calTime;
  13346. cell.date = calTime.toDate();
  13347. cell.timestamp = calTime.valueOf();
  13348. cell.type = "normal";
  13349. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13350. 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");
  13351. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13352. cell.start = calEndDate && calTime.isSame(calEndDate, "day");
  13353. cell.end = props.minDate && calTime.isSame(props.minDate, "day");
  13354. } else {
  13355. cell.start = props.minDate && calTime.isSame(props.minDate, "day");
  13356. cell.end = calEndDate && calTime.isSame(calEndDate, "day");
  13357. }
  13358. const isToday = calTime.isSame(calNow, "day");
  13359. if (isToday) {
  13360. cell.type = "today";
  13361. }
  13362. if (i >= 0 && i <= 1) {
  13363. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset2 < 0 ? 7 + startOfMonthDay + offset2 : startOfMonthDay + offset2;
  13364. if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
  13365. cell.text = count++;
  13366. } else {
  13367. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
  13368. cell.type = "prev-month";
  13369. }
  13370. } else {
  13371. if (count <= dateCountOfMonth) {
  13372. cell.text = count++;
  13373. } else {
  13374. cell.text = count++ - dateCountOfMonth;
  13375. cell.type = "next-month";
  13376. }
  13377. }
  13378. const cellDate = calTime.toDate();
  13379. cell.selected = selectedDate.find((_2) => _2.valueOf() === calTime.valueOf());
  13380. cell.isSelected = !!cell.selected;
  13381. cell.isCurrent = isCurrent(cell);
  13382. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13383. cell.customClass = props.cellClassName && props.cellClassName(cellDate);
  13384. row[props.showWeekNumber ? j + 1 : j] = cell;
  13385. }
  13386. if (props.selectionMode === "week") {
  13387. const start2 = props.showWeekNumber ? 1 : 0;
  13388. const end2 = props.showWeekNumber ? 7 : 6;
  13389. const isActive = isWeekActive(row[start2 + 1]);
  13390. row[start2].inRange = isActive;
  13391. row[start2].start = isActive;
  13392. row[end2].inRange = isActive;
  13393. row[end2].end = isActive;
  13394. }
  13395. }
  13396. return rows_;
  13397. });
  13398. const isCurrent = (cell) => {
  13399. return props.selectionMode === "day" && (cell.type === "normal" || cell.type === "today") && cellMatchesDate(cell, props.parsedValue);
  13400. };
  13401. const cellMatchesDate = (cell, date4) => {
  13402. if (!date4)
  13403. return false;
  13404. return dayjs(date4).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day");
  13405. };
  13406. const getCellClasses = (cell) => {
  13407. const classes = [];
  13408. if ((cell.type === "normal" || cell.type === "today") && !cell.disabled) {
  13409. classes.push("available");
  13410. if (cell.type === "today") {
  13411. classes.push("today");
  13412. }
  13413. } else {
  13414. classes.push(cell.type);
  13415. }
  13416. if (isCurrent(cell)) {
  13417. classes.push("current");
  13418. }
  13419. if (cell.inRange && (cell.type === "normal" || cell.type === "today" || props.selectionMode === "week")) {
  13420. classes.push("in-range");
  13421. if (cell.start) {
  13422. classes.push("start-date");
  13423. }
  13424. if (cell.end) {
  13425. classes.push("end-date");
  13426. }
  13427. }
  13428. if (cell.disabled) {
  13429. classes.push("disabled");
  13430. }
  13431. if (cell.selected) {
  13432. classes.push("selected");
  13433. }
  13434. if (cell.customClass) {
  13435. classes.push(cell.customClass);
  13436. }
  13437. return classes.join(" ");
  13438. };
  13439. const getDateOfCell = (row, column) => {
  13440. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value;
  13441. return startDate.value.add(offsetFromStart, "day");
  13442. };
  13443. const handleMouseMove = (event) => {
  13444. if (!props.rangeState.selecting)
  13445. return;
  13446. let target = event.target;
  13447. if (target.tagName === "SPAN") {
  13448. target = target.parentNode.parentNode;
  13449. }
  13450. if (target.tagName === "DIV") {
  13451. target = target.parentNode;
  13452. }
  13453. if (target.tagName !== "TD")
  13454. return;
  13455. const row = target.parentNode.rowIndex - 1;
  13456. const column = target.cellIndex;
  13457. if (rows.value[row][column].disabled)
  13458. return;
  13459. if (row !== lastRow.value || column !== lastColumn.value) {
  13460. lastRow.value = row;
  13461. lastColumn.value = column;
  13462. ctx.emit("changerange", {
  13463. selecting: true,
  13464. endDate: getDateOfCell(row, column)
  13465. });
  13466. }
  13467. };
  13468. const handleClick = (event) => {
  13469. let target = event.target;
  13470. while (target) {
  13471. if (target.tagName === "TD") {
  13472. break;
  13473. }
  13474. target = target.parentNode;
  13475. }
  13476. if (!target || target.tagName !== "TD")
  13477. return;
  13478. const row = target.parentNode.rowIndex - 1;
  13479. const column = target.cellIndex;
  13480. const cell = rows.value[row][column];
  13481. if (cell.disabled || cell.type === "week")
  13482. return;
  13483. const newDate = getDateOfCell(row, column);
  13484. if (props.selectionMode === "range") {
  13485. if (!props.rangeState.selecting) {
  13486. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13487. ctx.emit("select", true);
  13488. } else {
  13489. if (newDate >= props.minDate) {
  13490. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13491. } else {
  13492. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13493. }
  13494. ctx.emit("select", false);
  13495. }
  13496. } else if (props.selectionMode === "day") {
  13497. ctx.emit("pick", newDate);
  13498. } else if (props.selectionMode === "week") {
  13499. const weekNumber = newDate.week();
  13500. const value = `${newDate.year()}w${weekNumber}`;
  13501. ctx.emit("pick", {
  13502. year: newDate.year(),
  13503. week: weekNumber,
  13504. value,
  13505. date: newDate.startOf("week")
  13506. });
  13507. } else if (props.selectionMode === "dates") {
  13508. const newValue = cell.selected ? castArray(props.parsedValue).filter((_2) => _2.valueOf() !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  13509. ctx.emit("pick", newValue);
  13510. }
  13511. };
  13512. const isWeekActive = (cell) => {
  13513. if (props.selectionMode !== "week")
  13514. return false;
  13515. let newDate = props.date.startOf("day");
  13516. if (cell.type === "prev-month") {
  13517. newDate = newDate.subtract(1, "month");
  13518. }
  13519. if (cell.type === "next-month") {
  13520. newDate = newDate.add(1, "month");
  13521. }
  13522. newDate = newDate.date(Number.parseInt(cell.text, 10));
  13523. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  13524. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  13525. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  13526. return weekDate.isSame(newDate, "day");
  13527. }
  13528. return false;
  13529. };
  13530. return {
  13531. handleMouseMove,
  13532. t,
  13533. rows,
  13534. isWeekActive,
  13535. getCellClasses,
  13536. WEEKS,
  13537. handleClick
  13538. };
  13539. }
  13540. });
  13541. const _hoisted_1$t = { key: 0 };
  13542. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  13543. const _component_el_date_picker_cell = resolveComponent("el-date-picker-cell");
  13544. return openBlock(), createElementBlock("table", {
  13545. cellspacing: "0",
  13546. cellpadding: "0",
  13547. class: normalizeClass(["el-date-table", { "is-week-mode": _ctx.selectionMode === "week" }]),
  13548. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
  13549. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13550. }, [
  13551. createElementVNode("tbody", null, [
  13552. createElementVNode("tr", null, [
  13553. _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", _hoisted_1$t, toDisplayString(_ctx.t("el.datepicker.week")), 1)) : createCommentVNode("v-if", true),
  13554. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.WEEKS, (week, key) => {
  13555. return openBlock(), createElementBlock("th", { key }, toDisplayString(_ctx.t("el.datepicker.weeks." + week)), 1);
  13556. }), 128))
  13557. ]),
  13558. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13559. return openBlock(), createElementBlock("tr", {
  13560. key,
  13561. class: normalizeClass(["el-date-table__row", { current: _ctx.isWeekActive(row[1]) }])
  13562. }, [
  13563. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13564. return openBlock(), createElementBlock("td", {
  13565. key: key_,
  13566. class: normalizeClass(_ctx.getCellClasses(cell))
  13567. }, [
  13568. createVNode(_component_el_date_picker_cell, { cell }, null, 8, ["cell"])
  13569. ], 2);
  13570. }), 128))
  13571. ], 2);
  13572. }), 128))
  13573. ])
  13574. ], 34);
  13575. }
  13576. var DateTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["render", _sfc_render$m], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-date-table.vue"]]);
  13577. const datesInMonth = (year, month, lang) => {
  13578. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  13579. const numOfDays = firstDay.daysInMonth();
  13580. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13581. };
  13582. const _sfc_main$H = defineComponent({
  13583. props: {
  13584. disabledDate: {
  13585. type: Function
  13586. },
  13587. selectionMode: {
  13588. type: String,
  13589. default: "month"
  13590. },
  13591. minDate: {
  13592. type: Object
  13593. },
  13594. maxDate: {
  13595. type: Object
  13596. },
  13597. date: {
  13598. type: Object
  13599. },
  13600. parsedValue: {
  13601. type: Object
  13602. },
  13603. rangeState: {
  13604. type: Object,
  13605. default: () => ({
  13606. endDate: null,
  13607. selecting: false
  13608. })
  13609. }
  13610. },
  13611. emits: ["changerange", "pick", "select"],
  13612. setup(props, ctx) {
  13613. const { t, lang } = useLocale();
  13614. const months = ref(props.date.locale("en").localeData().monthsShort().map((_2) => _2.toLowerCase()));
  13615. const tableRows = ref([[], [], []]);
  13616. const lastRow = ref(null);
  13617. const lastColumn = ref(null);
  13618. const rows = computed(() => {
  13619. var _a2;
  13620. const rows2 = tableRows.value;
  13621. const now2 = dayjs().locale(lang.value).startOf("month");
  13622. for (let i = 0; i < 3; i++) {
  13623. const row = rows2[i];
  13624. for (let j = 0; j < 4; j++) {
  13625. let cell = row[j];
  13626. if (!cell) {
  13627. cell = {
  13628. row: i,
  13629. column: j,
  13630. type: "normal",
  13631. inRange: false,
  13632. start: false,
  13633. end: false
  13634. };
  13635. }
  13636. cell.type = "normal";
  13637. const index = i * 4 + j;
  13638. const calTime = props.date.startOf("year").month(index);
  13639. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate;
  13640. 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");
  13641. if ((_a2 = props.minDate) == null ? void 0 : _a2.isSameOrAfter(calEndDate)) {
  13642. cell.start = calEndDate && calTime.isSame(calEndDate, "month");
  13643. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  13644. } else {
  13645. cell.start = props.minDate && calTime.isSame(props.minDate, "month");
  13646. cell.end = calEndDate && calTime.isSame(calEndDate, "month");
  13647. }
  13648. const isToday = now2.isSame(calTime);
  13649. if (isToday) {
  13650. cell.type = "today";
  13651. }
  13652. cell.text = index;
  13653. const cellDate = calTime.toDate();
  13654. cell.disabled = props.disabledDate && props.disabledDate(cellDate);
  13655. row[j] = cell;
  13656. }
  13657. }
  13658. return rows2;
  13659. });
  13660. const getCellStyle = (cell) => {
  13661. const style = {};
  13662. const year = props.date.year();
  13663. const today = new Date();
  13664. const month = cell.text;
  13665. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  13666. style.current = castArray(props.parsedValue).findIndex((date4) => date4.year() === year && date4.month() === month) >= 0;
  13667. style.today = today.getFullYear() === year && today.getMonth() === month;
  13668. if (cell.inRange) {
  13669. style["in-range"] = true;
  13670. if (cell.start) {
  13671. style["start-date"] = true;
  13672. }
  13673. if (cell.end) {
  13674. style["end-date"] = true;
  13675. }
  13676. }
  13677. return style;
  13678. };
  13679. const handleMouseMove = (event) => {
  13680. if (!props.rangeState.selecting)
  13681. return;
  13682. let target = event.target;
  13683. if (target.tagName === "A") {
  13684. target = target.parentNode.parentNode;
  13685. }
  13686. if (target.tagName === "DIV") {
  13687. target = target.parentNode;
  13688. }
  13689. if (target.tagName !== "TD")
  13690. return;
  13691. const row = target.parentNode.rowIndex;
  13692. const column = target.cellIndex;
  13693. if (rows.value[row][column].disabled)
  13694. return;
  13695. if (row !== lastRow.value || column !== lastColumn.value) {
  13696. lastRow.value = row;
  13697. lastColumn.value = column;
  13698. ctx.emit("changerange", {
  13699. selecting: true,
  13700. endDate: props.date.startOf("year").month(row * 4 + column)
  13701. });
  13702. }
  13703. };
  13704. const handleMonthTableClick = (event) => {
  13705. let target = event.target;
  13706. if (target.tagName === "A") {
  13707. target = target.parentNode.parentNode;
  13708. }
  13709. if (target.tagName === "DIV") {
  13710. target = target.parentNode;
  13711. }
  13712. if (target.tagName !== "TD")
  13713. return;
  13714. if (hasClass(target, "disabled"))
  13715. return;
  13716. const column = target.cellIndex;
  13717. const row = target.parentNode.rowIndex;
  13718. const month = row * 4 + column;
  13719. const newDate = props.date.startOf("year").month(month);
  13720. if (props.selectionMode === "range") {
  13721. if (!props.rangeState.selecting) {
  13722. ctx.emit("pick", { minDate: newDate, maxDate: null });
  13723. ctx.emit("select", true);
  13724. } else {
  13725. if (newDate >= props.minDate) {
  13726. ctx.emit("pick", { minDate: props.minDate, maxDate: newDate });
  13727. } else {
  13728. ctx.emit("pick", { minDate: newDate, maxDate: props.minDate });
  13729. }
  13730. ctx.emit("select", false);
  13731. }
  13732. } else {
  13733. ctx.emit("pick", month);
  13734. }
  13735. };
  13736. return {
  13737. handleMouseMove,
  13738. handleMonthTableClick,
  13739. rows,
  13740. getCellStyle,
  13741. t,
  13742. months
  13743. };
  13744. }
  13745. });
  13746. const _hoisted_1$s = { class: "cell" };
  13747. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  13748. return openBlock(), createElementBlock("table", {
  13749. class: "el-month-table",
  13750. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleMonthTableClick && _ctx.handleMonthTableClick(...args)),
  13751. onMousemove: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseMove && _ctx.handleMouseMove(...args))
  13752. }, [
  13753. createElementVNode("tbody", null, [
  13754. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row, key) => {
  13755. return openBlock(), createElementBlock("tr", { key }, [
  13756. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  13757. return openBlock(), createElementBlock("td", {
  13758. key: key_,
  13759. class: normalizeClass(_ctx.getCellStyle(cell))
  13760. }, [
  13761. createElementVNode("div", null, [
  13762. createElementVNode("a", _hoisted_1$s, toDisplayString(_ctx.t("el.datepicker.months." + _ctx.months[cell.text])), 1)
  13763. ])
  13764. ], 2);
  13765. }), 128))
  13766. ]);
  13767. }), 128))
  13768. ])
  13769. ], 32);
  13770. }
  13771. var MonthTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["render", _sfc_render$l], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-month-table.vue"]]);
  13772. const datesInYear = (year, lang) => {
  13773. const firstDay = dayjs(String(year)).locale(lang).startOf("year");
  13774. const lastDay = firstDay.endOf("year");
  13775. const numOfDays = lastDay.dayOfYear();
  13776. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  13777. };
  13778. const _sfc_main$G = defineComponent({
  13779. props: {
  13780. disabledDate: {
  13781. type: Function
  13782. },
  13783. parsedValue: {
  13784. type: Object
  13785. },
  13786. date: {
  13787. type: Object
  13788. }
  13789. },
  13790. emits: ["pick"],
  13791. setup(props, ctx) {
  13792. const { lang } = useLocale();
  13793. const startYear = computed(() => {
  13794. return Math.floor(props.date.year() / 10) * 10;
  13795. });
  13796. const getCellStyle = (year) => {
  13797. const style = {};
  13798. const today = dayjs().locale(lang.value);
  13799. style.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  13800. style.current = castArray(props.parsedValue).findIndex((_2) => _2.year() === year) >= 0;
  13801. style.today = today.year() === year;
  13802. return style;
  13803. };
  13804. const handleYearTableClick = (event) => {
  13805. const target = event.target;
  13806. if (target.tagName === "A") {
  13807. if (hasClass(target.parentNode, "disabled"))
  13808. return;
  13809. const year = target.textContent || target.innerText;
  13810. ctx.emit("pick", Number(year));
  13811. }
  13812. };
  13813. return {
  13814. startYear,
  13815. getCellStyle,
  13816. handleYearTableClick
  13817. };
  13818. }
  13819. });
  13820. const _hoisted_1$r = { class: "cell" };
  13821. const _hoisted_2$l = { class: "cell" };
  13822. const _hoisted_3$f = { class: "cell" };
  13823. const _hoisted_4$d = { class: "cell" };
  13824. const _hoisted_5$d = { class: "cell" };
  13825. const _hoisted_6$a = { class: "cell" };
  13826. const _hoisted_7$6 = { class: "cell" };
  13827. const _hoisted_8$5 = { class: "cell" };
  13828. const _hoisted_9$5 = { class: "cell" };
  13829. const _hoisted_10$5 = { class: "cell" };
  13830. const _hoisted_11$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13831. const _hoisted_12$4 = /* @__PURE__ */ createElementVNode("td", null, null, -1);
  13832. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  13833. return openBlock(), createElementBlock("table", {
  13834. class: "el-year-table",
  13835. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleYearTableClick && _ctx.handleYearTableClick(...args))
  13836. }, [
  13837. createElementVNode("tbody", null, [
  13838. createElementVNode("tr", null, [
  13839. createElementVNode("td", {
  13840. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 0)])
  13841. }, [
  13842. createElementVNode("a", _hoisted_1$r, toDisplayString(_ctx.startYear), 1)
  13843. ], 2),
  13844. createElementVNode("td", {
  13845. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 1)])
  13846. }, [
  13847. createElementVNode("a", _hoisted_2$l, toDisplayString(_ctx.startYear + 1), 1)
  13848. ], 2),
  13849. createElementVNode("td", {
  13850. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 2)])
  13851. }, [
  13852. createElementVNode("a", _hoisted_3$f, toDisplayString(_ctx.startYear + 2), 1)
  13853. ], 2),
  13854. createElementVNode("td", {
  13855. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 3)])
  13856. }, [
  13857. createElementVNode("a", _hoisted_4$d, toDisplayString(_ctx.startYear + 3), 1)
  13858. ], 2)
  13859. ]),
  13860. createElementVNode("tr", null, [
  13861. createElementVNode("td", {
  13862. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 4)])
  13863. }, [
  13864. createElementVNode("a", _hoisted_5$d, toDisplayString(_ctx.startYear + 4), 1)
  13865. ], 2),
  13866. createElementVNode("td", {
  13867. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 5)])
  13868. }, [
  13869. createElementVNode("a", _hoisted_6$a, toDisplayString(_ctx.startYear + 5), 1)
  13870. ], 2),
  13871. createElementVNode("td", {
  13872. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 6)])
  13873. }, [
  13874. createElementVNode("a", _hoisted_7$6, toDisplayString(_ctx.startYear + 6), 1)
  13875. ], 2),
  13876. createElementVNode("td", {
  13877. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 7)])
  13878. }, [
  13879. createElementVNode("a", _hoisted_8$5, toDisplayString(_ctx.startYear + 7), 1)
  13880. ], 2)
  13881. ]),
  13882. createElementVNode("tr", null, [
  13883. createElementVNode("td", {
  13884. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 8)])
  13885. }, [
  13886. createElementVNode("a", _hoisted_9$5, toDisplayString(_ctx.startYear + 8), 1)
  13887. ], 2),
  13888. createElementVNode("td", {
  13889. class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + 9)])
  13890. }, [
  13891. createElementVNode("a", _hoisted_10$5, toDisplayString(_ctx.startYear + 9), 1)
  13892. ], 2),
  13893. _hoisted_11$4,
  13894. _hoisted_12$4
  13895. ])
  13896. ])
  13897. ]);
  13898. }
  13899. var YearTable = /* @__PURE__ */ _export_sfc$1(_sfc_main$G, [["render", _sfc_render$k], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-year-table.vue"]]);
  13900. const timeWithinRange = (_2, __, ___) => true;
  13901. const _sfc_main$F = defineComponent({
  13902. components: {
  13903. DateTable,
  13904. ElInput,
  13905. ElButton,
  13906. ElIcon,
  13907. TimePickPanel,
  13908. MonthTable,
  13909. YearTable,
  13910. DArrowLeft: dArrowLeft,
  13911. ArrowLeft: arrowLeft,
  13912. DArrowRight: dArrowRight,
  13913. ArrowRight: arrowRight
  13914. },
  13915. directives: { clickoutside: ClickOutside },
  13916. props: {
  13917. visible: {
  13918. type: Boolean,
  13919. default: false
  13920. },
  13921. parsedValue: {
  13922. type: [Object, Array]
  13923. },
  13924. format: {
  13925. type: String,
  13926. default: ""
  13927. },
  13928. type: {
  13929. type: String,
  13930. required: true,
  13931. validator: isValidDatePickType
  13932. }
  13933. },
  13934. emits: ["pick", "set-picker-option", "panel-change"],
  13935. setup(props, ctx) {
  13936. const { t, lang } = useLocale();
  13937. const pickerBase = inject("EP_PICKER_BASE");
  13938. const popper2 = inject(TOOLTIP_INJECTION_KEY);
  13939. const {
  13940. shortcuts,
  13941. disabledDate,
  13942. cellClassName,
  13943. defaultTime,
  13944. arrowControl
  13945. } = pickerBase.props;
  13946. const defaultValue = toRef(pickerBase.props, "defaultValue");
  13947. const innerDate = ref(dayjs().locale(lang.value));
  13948. const defaultTimeD = computed(() => {
  13949. return dayjs(defaultTime).locale(lang.value);
  13950. });
  13951. const month = computed(() => {
  13952. return innerDate.value.month();
  13953. });
  13954. const year = computed(() => {
  13955. return innerDate.value.year();
  13956. });
  13957. const selectableRange = ref([]);
  13958. const userInputDate = ref(null);
  13959. const userInputTime = ref(null);
  13960. const checkDateWithinRange = (date4) => {
  13961. return selectableRange.value.length > 0 ? timeWithinRange(date4, selectableRange.value, props.format || "HH:mm:ss") : true;
  13962. };
  13963. const formatEmit = (emitDayjs) => {
  13964. if (defaultTime && !visibleTime.value) {
  13965. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  13966. }
  13967. if (showTime.value)
  13968. return emitDayjs.millisecond(0);
  13969. return emitDayjs.startOf("day");
  13970. };
  13971. const emit = (value, ...args) => {
  13972. if (!value) {
  13973. ctx.emit("pick", value, ...args);
  13974. } else if (Array.isArray(value)) {
  13975. const dates = value.map(formatEmit);
  13976. ctx.emit("pick", dates, ...args);
  13977. } else {
  13978. ctx.emit("pick", formatEmit(value), ...args);
  13979. }
  13980. userInputDate.value = null;
  13981. userInputTime.value = null;
  13982. };
  13983. const handleDatePick = (value) => {
  13984. if (selectionMode.value === "day") {
  13985. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  13986. if (!checkDateWithinRange(newDate)) {
  13987. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  13988. }
  13989. innerDate.value = newDate;
  13990. emit(newDate, showTime.value);
  13991. } else if (selectionMode.value === "week") {
  13992. emit(value.date);
  13993. } else if (selectionMode.value === "dates") {
  13994. emit(value, true);
  13995. }
  13996. };
  13997. const prevMonth_ = () => {
  13998. innerDate.value = innerDate.value.subtract(1, "month");
  13999. handlePanelChange("month");
  14000. };
  14001. const nextMonth_ = () => {
  14002. innerDate.value = innerDate.value.add(1, "month");
  14003. handlePanelChange("month");
  14004. };
  14005. const prevYear_ = () => {
  14006. if (currentView.value === "year") {
  14007. innerDate.value = innerDate.value.subtract(10, "year");
  14008. } else {
  14009. innerDate.value = innerDate.value.subtract(1, "year");
  14010. }
  14011. handlePanelChange("year");
  14012. };
  14013. const nextYear_ = () => {
  14014. if (currentView.value === "year") {
  14015. innerDate.value = innerDate.value.add(10, "year");
  14016. } else {
  14017. innerDate.value = innerDate.value.add(1, "year");
  14018. }
  14019. handlePanelChange("year");
  14020. };
  14021. const currentView = ref("date");
  14022. const yearLabel = computed(() => {
  14023. const yearTranslation = t("el.datepicker.year");
  14024. if (currentView.value === "year") {
  14025. const startYear = Math.floor(year.value / 10) * 10;
  14026. if (yearTranslation) {
  14027. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  14028. }
  14029. return `${startYear} - ${startYear + 9}`;
  14030. }
  14031. return `${year.value} ${yearTranslation}`;
  14032. });
  14033. const handleShortcutClick = (shortcut) => {
  14034. const shortcutValue = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  14035. if (shortcutValue) {
  14036. emit(dayjs(shortcutValue).locale(lang.value));
  14037. return;
  14038. }
  14039. if (shortcut.onClick) {
  14040. shortcut.onClick(ctx);
  14041. }
  14042. };
  14043. const selectionMode = computed(() => {
  14044. if (["week", "month", "year", "dates"].includes(props.type)) {
  14045. return props.type;
  14046. }
  14047. return "day";
  14048. });
  14049. watch(() => selectionMode.value, (val) => {
  14050. if (["month", "year"].includes(val)) {
  14051. currentView.value = val;
  14052. return;
  14053. }
  14054. currentView.value = "date";
  14055. }, { immediate: true });
  14056. watch(() => currentView.value, () => {
  14057. popper2 == null ? void 0 : popper2.updatePopper();
  14058. });
  14059. const hasShortcuts = computed(() => !!shortcuts.length);
  14060. const handleMonthPick = (month2) => {
  14061. innerDate.value = innerDate.value.startOf("month").month(month2);
  14062. if (selectionMode.value === "month") {
  14063. emit(innerDate.value);
  14064. } else {
  14065. currentView.value = "date";
  14066. }
  14067. handlePanelChange("month");
  14068. };
  14069. const handleYearPick = (year2) => {
  14070. if (selectionMode.value === "year") {
  14071. innerDate.value = innerDate.value.startOf("year").year(year2);
  14072. emit(innerDate.value);
  14073. } else {
  14074. innerDate.value = innerDate.value.year(year2);
  14075. currentView.value = "month";
  14076. }
  14077. handlePanelChange("year");
  14078. };
  14079. const showMonthPicker = () => {
  14080. currentView.value = "month";
  14081. };
  14082. const showYearPicker = () => {
  14083. currentView.value = "year";
  14084. };
  14085. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  14086. const footerVisible = computed(() => {
  14087. return showTime.value || selectionMode.value === "dates";
  14088. });
  14089. const onConfirm = () => {
  14090. if (selectionMode.value === "dates") {
  14091. emit(props.parsedValue);
  14092. } else {
  14093. let result = props.parsedValue;
  14094. if (!result) {
  14095. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  14096. const defaultValueD = getDefaultValue();
  14097. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  14098. }
  14099. innerDate.value = result;
  14100. emit(result);
  14101. }
  14102. };
  14103. const changeToNow = () => {
  14104. const now2 = dayjs().locale(lang.value);
  14105. const nowDate = now2.toDate();
  14106. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  14107. innerDate.value = dayjs().locale(lang.value);
  14108. emit(innerDate.value);
  14109. }
  14110. };
  14111. const timeFormat = computed(() => {
  14112. return extractTimeFormat(props.format);
  14113. });
  14114. const dateFormat = computed(() => {
  14115. return extractDateFormat(props.format);
  14116. });
  14117. const visibleTime = computed(() => {
  14118. if (userInputTime.value)
  14119. return userInputTime.value;
  14120. if (!props.parsedValue && !defaultValue.value)
  14121. return;
  14122. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  14123. });
  14124. const visibleDate = computed(() => {
  14125. if (userInputDate.value)
  14126. return userInputDate.value;
  14127. if (!props.parsedValue && !defaultValue.value)
  14128. return;
  14129. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  14130. });
  14131. const timePickerVisible = ref(false);
  14132. const onTimePickerInputFocus = () => {
  14133. timePickerVisible.value = true;
  14134. };
  14135. const handleTimePickClose = () => {
  14136. timePickerVisible.value = false;
  14137. };
  14138. const handleTimePick = (value, visible, first) => {
  14139. const newDate = props.parsedValue ? props.parsedValue.hour(value.hour()).minute(value.minute()).second(value.second()) : value;
  14140. innerDate.value = newDate;
  14141. emit(innerDate.value, true);
  14142. if (!first) {
  14143. timePickerVisible.value = visible;
  14144. }
  14145. };
  14146. const handleVisibleTimeChange = (value) => {
  14147. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  14148. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  14149. innerDate.value = newDate.year(innerDate.value.year()).month(innerDate.value.month()).date(innerDate.value.date());
  14150. userInputTime.value = null;
  14151. timePickerVisible.value = false;
  14152. emit(innerDate.value, true);
  14153. }
  14154. };
  14155. const handleVisibleDateChange = (value) => {
  14156. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  14157. if (newDate.isValid()) {
  14158. if (disabledDate && disabledDate(newDate.toDate())) {
  14159. return;
  14160. }
  14161. innerDate.value = newDate.hour(innerDate.value.hour()).minute(innerDate.value.minute()).second(innerDate.value.second());
  14162. userInputDate.value = null;
  14163. emit(innerDate.value, true);
  14164. }
  14165. };
  14166. const isValidValue = (date4) => {
  14167. return dayjs.isDayjs(date4) && date4.isValid() && (disabledDate ? !disabledDate(date4.toDate()) : true);
  14168. };
  14169. const formatToString = (value) => {
  14170. if (selectionMode.value === "dates") {
  14171. return value.map((_2) => _2.format(props.format));
  14172. }
  14173. return value.format(props.format);
  14174. };
  14175. const parseUserInput = (value) => {
  14176. return dayjs(value, props.format).locale(lang.value);
  14177. };
  14178. const getDefaultValue = () => {
  14179. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  14180. if (!defaultValue.value) {
  14181. const defaultTimeDValue = defaultTimeD.value;
  14182. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  14183. }
  14184. return parseDate;
  14185. };
  14186. const handleKeydown = (event) => {
  14187. const { code, keyCode } = event;
  14188. const list = [
  14189. EVENT_CODE.up,
  14190. EVENT_CODE.down,
  14191. EVENT_CODE.left,
  14192. EVENT_CODE.right
  14193. ];
  14194. if (props.visible && !timePickerVisible.value) {
  14195. if (list.includes(code)) {
  14196. handleKeyControl(keyCode);
  14197. event.stopPropagation();
  14198. event.preventDefault();
  14199. }
  14200. if (code === EVENT_CODE.enter && userInputDate.value === null && userInputTime.value === null) {
  14201. emit(innerDate, false);
  14202. }
  14203. }
  14204. };
  14205. const handleKeyControl = (keyCode) => {
  14206. const mapping = {
  14207. year: {
  14208. 38: -4,
  14209. 40: 4,
  14210. 37: -1,
  14211. 39: 1,
  14212. offset: (date4, step) => date4.setFullYear(date4.getFullYear() + step)
  14213. },
  14214. month: {
  14215. 38: -4,
  14216. 40: 4,
  14217. 37: -1,
  14218. 39: 1,
  14219. offset: (date4, step) => date4.setMonth(date4.getMonth() + step)
  14220. },
  14221. week: {
  14222. 38: -1,
  14223. 40: 1,
  14224. 37: -1,
  14225. 39: 1,
  14226. offset: (date4, step) => date4.setDate(date4.getDate() + step * 7)
  14227. },
  14228. day: {
  14229. 38: -7,
  14230. 40: 7,
  14231. 37: -1,
  14232. 39: 1,
  14233. offset: (date4, step) => date4.setDate(date4.getDate() + step)
  14234. }
  14235. };
  14236. const newDate = innerDate.value.toDate();
  14237. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  14238. const map = mapping[selectionMode.value];
  14239. map.offset(newDate, map[keyCode]);
  14240. if (disabledDate && disabledDate(newDate)) {
  14241. continue;
  14242. }
  14243. const result = dayjs(newDate).locale(lang.value);
  14244. innerDate.value = result;
  14245. ctx.emit("pick", result, true);
  14246. break;
  14247. }
  14248. };
  14249. const handlePanelChange = (mode) => {
  14250. ctx.emit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  14251. };
  14252. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14253. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14254. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14255. ctx.emit("set-picker-option", ["handleKeydown", handleKeydown]);
  14256. watch(() => defaultValue.value, (val) => {
  14257. if (val) {
  14258. innerDate.value = getDefaultValue();
  14259. }
  14260. }, { immediate: true });
  14261. watch(() => props.parsedValue, (val) => {
  14262. if (val) {
  14263. if (selectionMode.value === "dates")
  14264. return;
  14265. if (Array.isArray(val))
  14266. return;
  14267. innerDate.value = val;
  14268. } else {
  14269. innerDate.value = getDefaultValue();
  14270. }
  14271. }, { immediate: true });
  14272. return {
  14273. handleTimePick,
  14274. handleTimePickClose,
  14275. onTimePickerInputFocus,
  14276. timePickerVisible,
  14277. visibleTime,
  14278. visibleDate,
  14279. showTime,
  14280. changeToNow,
  14281. onConfirm,
  14282. footerVisible,
  14283. handleYearPick,
  14284. showMonthPicker,
  14285. showYearPicker,
  14286. handleMonthPick,
  14287. hasShortcuts,
  14288. shortcuts,
  14289. arrowControl,
  14290. disabledDate,
  14291. cellClassName,
  14292. selectionMode,
  14293. handleShortcutClick,
  14294. prevYear_,
  14295. nextYear_,
  14296. prevMonth_,
  14297. nextMonth_,
  14298. innerDate,
  14299. t,
  14300. yearLabel,
  14301. currentView,
  14302. month,
  14303. handleDatePick,
  14304. handleVisibleTimeChange,
  14305. handleVisibleDateChange,
  14306. timeFormat,
  14307. userInputTime,
  14308. userInputDate
  14309. };
  14310. }
  14311. });
  14312. const _hoisted_1$q = { class: "el-picker-panel__body-wrapper" };
  14313. const _hoisted_2$k = {
  14314. key: 0,
  14315. class: "el-picker-panel__sidebar"
  14316. };
  14317. const _hoisted_3$e = ["onClick"];
  14318. const _hoisted_4$c = { class: "el-picker-panel__body" };
  14319. const _hoisted_5$c = {
  14320. key: 0,
  14321. class: "el-date-picker__time-header"
  14322. };
  14323. const _hoisted_6$9 = { class: "el-date-picker__editor-wrap" };
  14324. const _hoisted_7$5 = { class: "el-date-picker__editor-wrap" };
  14325. const _hoisted_8$4 = ["aria-label"];
  14326. const _hoisted_9$4 = ["aria-label"];
  14327. const _hoisted_10$4 = ["aria-label"];
  14328. const _hoisted_11$3 = ["aria-label"];
  14329. const _hoisted_12$3 = { class: "el-picker-panel__content" };
  14330. const _hoisted_13$3 = { class: "el-picker-panel__footer" };
  14331. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  14332. const _component_el_input = resolveComponent("el-input");
  14333. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14334. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14335. const _component_el_icon = resolveComponent("el-icon");
  14336. const _component_arrow_left = resolveComponent("arrow-left");
  14337. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  14338. const _component_arrow_right = resolveComponent("arrow-right");
  14339. const _component_date_table = resolveComponent("date-table");
  14340. const _component_year_table = resolveComponent("year-table");
  14341. const _component_month_table = resolveComponent("month-table");
  14342. const _component_el_button = resolveComponent("el-button");
  14343. const _directive_clickoutside = resolveDirective("clickoutside");
  14344. return openBlock(), createElementBlock("div", {
  14345. class: normalizeClass(["el-picker-panel el-date-picker", [
  14346. {
  14347. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  14348. "has-time": _ctx.showTime
  14349. }
  14350. ]])
  14351. }, [
  14352. createElementVNode("div", _hoisted_1$q, [
  14353. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  14354. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$k, [
  14355. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  14356. return openBlock(), createElementBlock("button", {
  14357. key,
  14358. type: "button",
  14359. class: "el-picker-panel__shortcut",
  14360. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  14361. }, toDisplayString(shortcut.text), 9, _hoisted_3$e);
  14362. }), 128))
  14363. ])) : createCommentVNode("v-if", true),
  14364. createElementVNode("div", _hoisted_4$c, [
  14365. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$c, [
  14366. createElementVNode("span", _hoisted_6$9, [
  14367. createVNode(_component_el_input, {
  14368. placeholder: _ctx.t("el.datepicker.selectDate"),
  14369. "model-value": _ctx.visibleDate,
  14370. size: "small",
  14371. onInput: _cache[0] || (_cache[0] = (val) => _ctx.userInputDate = val),
  14372. onChange: _ctx.handleVisibleDateChange
  14373. }, null, 8, ["placeholder", "model-value", "onChange"])
  14374. ]),
  14375. withDirectives((openBlock(), createElementBlock("span", _hoisted_7$5, [
  14376. createVNode(_component_el_input, {
  14377. placeholder: _ctx.t("el.datepicker.selectTime"),
  14378. "model-value": _ctx.visibleTime,
  14379. size: "small",
  14380. onFocus: _ctx.onTimePickerInputFocus,
  14381. onInput: _cache[1] || (_cache[1] = (val) => _ctx.userInputTime = val),
  14382. onChange: _ctx.handleVisibleTimeChange
  14383. }, null, 8, ["placeholder", "model-value", "onFocus", "onChange"]),
  14384. createVNode(_component_time_pick_panel, {
  14385. visible: _ctx.timePickerVisible,
  14386. format: _ctx.timeFormat,
  14387. "time-arrow-control": _ctx.arrowControl,
  14388. "parsed-value": _ctx.innerDate,
  14389. onPick: _ctx.handleTimePick
  14390. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  14391. ])), [
  14392. [_directive_clickoutside, _ctx.handleTimePickClose]
  14393. ])
  14394. ])) : createCommentVNode("v-if", true),
  14395. withDirectives(createElementVNode("div", {
  14396. class: normalizeClass(["el-date-picker__header", {
  14397. "el-date-picker__header--bordered": _ctx.currentView === "year" || _ctx.currentView === "month"
  14398. }])
  14399. }, [
  14400. createElementVNode("button", {
  14401. type: "button",
  14402. "aria-label": _ctx.t(`el.datepicker.prevYear`),
  14403. class: "el-picker-panel__icon-btn el-date-picker__prev-btn d-arrow-left",
  14404. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.prevYear_ && _ctx.prevYear_(...args))
  14405. }, [
  14406. createVNode(_component_el_icon, null, {
  14407. default: withCtx(() => [
  14408. createVNode(_component_d_arrow_left)
  14409. ]),
  14410. _: 1
  14411. })
  14412. ], 8, _hoisted_8$4),
  14413. withDirectives(createElementVNode("button", {
  14414. type: "button",
  14415. "aria-label": _ctx.t(`el.datepicker.prevMonth`),
  14416. class: "el-picker-panel__icon-btn el-date-picker__prev-btn arrow-left",
  14417. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.prevMonth_ && _ctx.prevMonth_(...args))
  14418. }, [
  14419. createVNode(_component_el_icon, null, {
  14420. default: withCtx(() => [
  14421. createVNode(_component_arrow_left)
  14422. ]),
  14423. _: 1
  14424. })
  14425. ], 8, _hoisted_9$4), [
  14426. [vShow, _ctx.currentView === "date"]
  14427. ]),
  14428. createElementVNode("span", {
  14429. role: "button",
  14430. class: "el-date-picker__header-label",
  14431. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showYearPicker && _ctx.showYearPicker(...args))
  14432. }, toDisplayString(_ctx.yearLabel), 1),
  14433. withDirectives(createElementVNode("span", {
  14434. role: "button",
  14435. class: normalizeClass(["el-date-picker__header-label", { active: _ctx.currentView === "month" }]),
  14436. onClick: _cache[5] || (_cache[5] = (...args) => _ctx.showMonthPicker && _ctx.showMonthPicker(...args))
  14437. }, toDisplayString(_ctx.t(`el.datepicker.month${_ctx.month + 1}`)), 3), [
  14438. [vShow, _ctx.currentView === "date"]
  14439. ]),
  14440. createElementVNode("button", {
  14441. type: "button",
  14442. "aria-label": _ctx.t(`el.datepicker.nextYear`),
  14443. class: "el-picker-panel__icon-btn el-date-picker__next-btn d-arrow-right",
  14444. onClick: _cache[6] || (_cache[6] = (...args) => _ctx.nextYear_ && _ctx.nextYear_(...args))
  14445. }, [
  14446. createVNode(_component_el_icon, null, {
  14447. default: withCtx(() => [
  14448. createVNode(_component_d_arrow_right)
  14449. ]),
  14450. _: 1
  14451. })
  14452. ], 8, _hoisted_10$4),
  14453. withDirectives(createElementVNode("button", {
  14454. type: "button",
  14455. "aria-label": _ctx.t(`el.datepicker.nextMonth`),
  14456. class: "el-picker-panel__icon-btn el-date-picker__next-btn arrow-right",
  14457. onClick: _cache[7] || (_cache[7] = (...args) => _ctx.nextMonth_ && _ctx.nextMonth_(...args))
  14458. }, [
  14459. createVNode(_component_el_icon, null, {
  14460. default: withCtx(() => [
  14461. createVNode(_component_arrow_right)
  14462. ]),
  14463. _: 1
  14464. })
  14465. ], 8, _hoisted_11$3), [
  14466. [vShow, _ctx.currentView === "date"]
  14467. ])
  14468. ], 2), [
  14469. [vShow, _ctx.currentView !== "time"]
  14470. ]),
  14471. createElementVNode("div", _hoisted_12$3, [
  14472. _ctx.currentView === "date" ? (openBlock(), createBlock(_component_date_table, {
  14473. key: 0,
  14474. "selection-mode": _ctx.selectionMode,
  14475. date: _ctx.innerDate,
  14476. "parsed-value": _ctx.parsedValue,
  14477. "disabled-date": _ctx.disabledDate,
  14478. "cell-class-name": _ctx.cellClassName,
  14479. onPick: _ctx.handleDatePick
  14480. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name", "onPick"])) : createCommentVNode("v-if", true),
  14481. _ctx.currentView === "year" ? (openBlock(), createBlock(_component_year_table, {
  14482. key: 1,
  14483. date: _ctx.innerDate,
  14484. "disabled-date": _ctx.disabledDate,
  14485. "parsed-value": _ctx.parsedValue,
  14486. onPick: _ctx.handleYearPick
  14487. }, null, 8, ["date", "disabled-date", "parsed-value", "onPick"])) : createCommentVNode("v-if", true),
  14488. _ctx.currentView === "month" ? (openBlock(), createBlock(_component_month_table, {
  14489. key: 2,
  14490. date: _ctx.innerDate,
  14491. "parsed-value": _ctx.parsedValue,
  14492. "disabled-date": _ctx.disabledDate,
  14493. onPick: _ctx.handleMonthPick
  14494. }, null, 8, ["date", "parsed-value", "disabled-date", "onPick"])) : createCommentVNode("v-if", true)
  14495. ])
  14496. ])
  14497. ]),
  14498. withDirectives(createElementVNode("div", _hoisted_13$3, [
  14499. withDirectives(createVNode(_component_el_button, {
  14500. size: "small",
  14501. type: "text",
  14502. class: "el-picker-panel__link-btn",
  14503. onClick: _ctx.changeToNow
  14504. }, {
  14505. default: withCtx(() => [
  14506. createTextVNode(toDisplayString(_ctx.t("el.datepicker.now")), 1)
  14507. ]),
  14508. _: 1
  14509. }, 8, ["onClick"]), [
  14510. [vShow, _ctx.selectionMode !== "dates"]
  14511. ]),
  14512. createVNode(_component_el_button, {
  14513. plain: "",
  14514. size: "small",
  14515. class: "el-picker-panel__link-btn",
  14516. onClick: _ctx.onConfirm
  14517. }, {
  14518. default: withCtx(() => [
  14519. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  14520. ]),
  14521. _: 1
  14522. }, 8, ["onClick"])
  14523. ], 512), [
  14524. [vShow, _ctx.footerVisible && _ctx.currentView === "date"]
  14525. ])
  14526. ], 2);
  14527. }
  14528. var DatePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$F, [["render", _sfc_render$j], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue"]]);
  14529. const _sfc_main$E = defineComponent({
  14530. directives: { clickoutside: ClickOutside },
  14531. components: {
  14532. TimePickPanel,
  14533. DateTable,
  14534. ElInput,
  14535. ElButton,
  14536. ElIcon,
  14537. DArrowLeft: dArrowLeft,
  14538. ArrowLeft: arrowLeft,
  14539. DArrowRight: dArrowRight,
  14540. ArrowRight: arrowRight
  14541. },
  14542. props: {
  14543. unlinkPanels: Boolean,
  14544. parsedValue: {
  14545. type: Array
  14546. },
  14547. type: {
  14548. type: String,
  14549. required: true,
  14550. validator: isValidDatePickType
  14551. }
  14552. },
  14553. emits: ["pick", "set-picker-option", "calendar-change", "panel-change"],
  14554. setup(props, ctx) {
  14555. const { t, lang } = useLocale();
  14556. const leftDate = ref(dayjs().locale(lang.value));
  14557. const rightDate = ref(dayjs().locale(lang.value).add(1, "month"));
  14558. const minDate = ref(null);
  14559. const maxDate = ref(null);
  14560. const dateUserInput = ref({
  14561. min: null,
  14562. max: null
  14563. });
  14564. const timeUserInput = ref({
  14565. min: null,
  14566. max: null
  14567. });
  14568. const leftLabel = computed(() => {
  14569. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  14570. });
  14571. const rightLabel = computed(() => {
  14572. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  14573. });
  14574. const leftYear = computed(() => {
  14575. return leftDate.value.year();
  14576. });
  14577. const leftMonth = computed(() => {
  14578. return leftDate.value.month();
  14579. });
  14580. const rightYear = computed(() => {
  14581. return rightDate.value.year();
  14582. });
  14583. const rightMonth = computed(() => {
  14584. return rightDate.value.month();
  14585. });
  14586. const hasShortcuts = computed(() => !!shortcuts.length);
  14587. const minVisibleDate = computed(() => {
  14588. if (dateUserInput.value.min !== null)
  14589. return dateUserInput.value.min;
  14590. if (minDate.value)
  14591. return minDate.value.format(dateFormat.value);
  14592. return "";
  14593. });
  14594. const maxVisibleDate = computed(() => {
  14595. if (dateUserInput.value.max !== null)
  14596. return dateUserInput.value.max;
  14597. if (maxDate.value || minDate.value)
  14598. return (maxDate.value || minDate.value).format(dateFormat.value);
  14599. return "";
  14600. });
  14601. const minVisibleTime = computed(() => {
  14602. if (timeUserInput.value.min !== null)
  14603. return timeUserInput.value.min;
  14604. if (minDate.value)
  14605. return minDate.value.format(timeFormat.value);
  14606. return "";
  14607. });
  14608. const maxVisibleTime = computed(() => {
  14609. if (timeUserInput.value.max !== null)
  14610. return timeUserInput.value.max;
  14611. if (maxDate.value || minDate.value)
  14612. return (maxDate.value || minDate.value).format(timeFormat.value);
  14613. return "";
  14614. });
  14615. const timeFormat = computed(() => {
  14616. return extractTimeFormat(format2);
  14617. });
  14618. const dateFormat = computed(() => {
  14619. return extractDateFormat(format2);
  14620. });
  14621. const leftPrevYear = () => {
  14622. leftDate.value = leftDate.value.subtract(1, "year");
  14623. if (!props.unlinkPanels) {
  14624. rightDate.value = leftDate.value.add(1, "month");
  14625. }
  14626. handlePanelChange("year");
  14627. };
  14628. const leftPrevMonth = () => {
  14629. leftDate.value = leftDate.value.subtract(1, "month");
  14630. if (!props.unlinkPanels) {
  14631. rightDate.value = leftDate.value.add(1, "month");
  14632. }
  14633. handlePanelChange("month");
  14634. };
  14635. const rightNextYear = () => {
  14636. if (!props.unlinkPanels) {
  14637. leftDate.value = leftDate.value.add(1, "year");
  14638. rightDate.value = leftDate.value.add(1, "month");
  14639. } else {
  14640. rightDate.value = rightDate.value.add(1, "year");
  14641. }
  14642. handlePanelChange("year");
  14643. };
  14644. const rightNextMonth = () => {
  14645. if (!props.unlinkPanels) {
  14646. leftDate.value = leftDate.value.add(1, "month");
  14647. rightDate.value = leftDate.value.add(1, "month");
  14648. } else {
  14649. rightDate.value = rightDate.value.add(1, "month");
  14650. }
  14651. handlePanelChange("month");
  14652. };
  14653. const leftNextYear = () => {
  14654. leftDate.value = leftDate.value.add(1, "year");
  14655. handlePanelChange("year");
  14656. };
  14657. const leftNextMonth = () => {
  14658. leftDate.value = leftDate.value.add(1, "month");
  14659. handlePanelChange("month");
  14660. };
  14661. const rightPrevYear = () => {
  14662. rightDate.value = rightDate.value.subtract(1, "year");
  14663. handlePanelChange("year");
  14664. };
  14665. const rightPrevMonth = () => {
  14666. rightDate.value = rightDate.value.subtract(1, "month");
  14667. handlePanelChange("month");
  14668. };
  14669. const handlePanelChange = (mode) => {
  14670. ctx.emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  14671. };
  14672. const enableMonthArrow = computed(() => {
  14673. const nextMonth = (leftMonth.value + 1) % 12;
  14674. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  14675. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  14676. });
  14677. const enableYearArrow = computed(() => {
  14678. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  14679. });
  14680. const isValidValue = (value) => {
  14681. return Array.isArray(value) && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  14682. };
  14683. const rangeState = ref({
  14684. endDate: null,
  14685. selecting: false
  14686. });
  14687. const btnDisabled = computed(() => {
  14688. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidValue([minDate.value, maxDate.value]));
  14689. });
  14690. const handleChangeRange = (val) => {
  14691. rangeState.value = val;
  14692. };
  14693. const onSelect = (selecting) => {
  14694. rangeState.value.selecting = selecting;
  14695. if (!selecting) {
  14696. rangeState.value.endDate = null;
  14697. }
  14698. };
  14699. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  14700. const handleConfirm = (visible = false) => {
  14701. if (isValidValue([minDate.value, maxDate.value])) {
  14702. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  14703. }
  14704. };
  14705. const formatEmit = (emitDayjs, index) => {
  14706. if (!emitDayjs)
  14707. return;
  14708. if (defaultTime) {
  14709. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  14710. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  14711. }
  14712. return emitDayjs;
  14713. };
  14714. const handleRangePick = (val, close2 = true) => {
  14715. const min_ = val.minDate;
  14716. const max_ = val.maxDate;
  14717. const minDate_ = formatEmit(min_, 0);
  14718. const maxDate_ = formatEmit(max_, 1);
  14719. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  14720. return;
  14721. }
  14722. ctx.emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  14723. maxDate.value = maxDate_;
  14724. minDate.value = minDate_;
  14725. if (!close2 || showTime.value)
  14726. return;
  14727. handleConfirm();
  14728. };
  14729. const handleShortcutClick = (shortcut) => {
  14730. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  14731. if (shortcutValues) {
  14732. ctx.emit("pick", [
  14733. dayjs(shortcutValues[0]).locale(lang.value),
  14734. dayjs(shortcutValues[1]).locale(lang.value)
  14735. ]);
  14736. return;
  14737. }
  14738. if (shortcut.onClick) {
  14739. shortcut.onClick(ctx);
  14740. }
  14741. };
  14742. const minTimePickerVisible = ref(false);
  14743. const maxTimePickerVisible = ref(false);
  14744. const handleMinTimeClose = () => {
  14745. minTimePickerVisible.value = false;
  14746. };
  14747. const handleMaxTimeClose = () => {
  14748. maxTimePickerVisible.value = false;
  14749. };
  14750. const handleDateInput = (value, type4) => {
  14751. dateUserInput.value[type4] = value;
  14752. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  14753. if (parsedValueD.isValid()) {
  14754. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  14755. return;
  14756. }
  14757. if (type4 === "min") {
  14758. leftDate.value = parsedValueD;
  14759. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14760. if (!props.unlinkPanels) {
  14761. rightDate.value = parsedValueD.add(1, "month");
  14762. maxDate.value = minDate.value.add(1, "month");
  14763. }
  14764. } else {
  14765. rightDate.value = parsedValueD;
  14766. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  14767. if (!props.unlinkPanels) {
  14768. leftDate.value = parsedValueD.subtract(1, "month");
  14769. minDate.value = maxDate.value.subtract(1, "month");
  14770. }
  14771. }
  14772. }
  14773. };
  14774. const handleDateChange = (_2, type4) => {
  14775. dateUserInput.value[type4] = null;
  14776. };
  14777. const handleTimeInput = (value, type4) => {
  14778. timeUserInput.value[type4] = value;
  14779. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  14780. if (parsedValueD.isValid()) {
  14781. if (type4 === "min") {
  14782. minTimePickerVisible.value = true;
  14783. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14784. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14785. maxDate.value = minDate.value;
  14786. }
  14787. } else {
  14788. maxTimePickerVisible.value = true;
  14789. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  14790. rightDate.value = maxDate.value;
  14791. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14792. minDate.value = maxDate.value;
  14793. }
  14794. }
  14795. }
  14796. };
  14797. const handleTimeChange = (value, type4) => {
  14798. timeUserInput.value[type4] = null;
  14799. if (type4 === "min") {
  14800. leftDate.value = minDate.value;
  14801. minTimePickerVisible.value = false;
  14802. } else {
  14803. rightDate.value = maxDate.value;
  14804. maxTimePickerVisible.value = false;
  14805. }
  14806. };
  14807. const handleMinTimePick = (value, visible, first) => {
  14808. if (timeUserInput.value.min)
  14809. return;
  14810. if (value) {
  14811. leftDate.value = value;
  14812. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14813. }
  14814. if (!first) {
  14815. minTimePickerVisible.value = visible;
  14816. }
  14817. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  14818. maxDate.value = minDate.value;
  14819. rightDate.value = value;
  14820. }
  14821. };
  14822. const handleMaxTimePick = (value, visible, first) => {
  14823. if (timeUserInput.value.max)
  14824. return;
  14825. if (value) {
  14826. rightDate.value = value;
  14827. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  14828. }
  14829. if (!first) {
  14830. maxTimePickerVisible.value = visible;
  14831. }
  14832. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  14833. minDate.value = maxDate.value;
  14834. }
  14835. };
  14836. const handleClear = () => {
  14837. leftDate.value = getDefaultValue()[0];
  14838. rightDate.value = leftDate.value.add(1, "month");
  14839. ctx.emit("pick", null);
  14840. };
  14841. const formatToString = (value) => {
  14842. return Array.isArray(value) ? value.map((_2) => _2.format(format2)) : value.format(format2);
  14843. };
  14844. const parseUserInput = (value) => {
  14845. return Array.isArray(value) ? value.map((_2) => dayjs(_2, format2).locale(lang.value)) : dayjs(value, format2).locale(lang.value);
  14846. };
  14847. const getDefaultValue = () => {
  14848. let start2;
  14849. if (Array.isArray(defaultValue.value)) {
  14850. const left2 = dayjs(defaultValue.value[0]);
  14851. let right2 = dayjs(defaultValue.value[1]);
  14852. if (!props.unlinkPanels) {
  14853. right2 = left2.add(1, "month");
  14854. }
  14855. return [left2, right2];
  14856. } else if (defaultValue.value) {
  14857. start2 = dayjs(defaultValue.value);
  14858. } else {
  14859. start2 = dayjs();
  14860. }
  14861. start2 = start2.locale(lang.value);
  14862. return [start2, start2.add(1, "month")];
  14863. };
  14864. ctx.emit("set-picker-option", ["isValidValue", isValidValue]);
  14865. ctx.emit("set-picker-option", ["parseUserInput", parseUserInput]);
  14866. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  14867. ctx.emit("set-picker-option", ["handleClear", handleClear]);
  14868. const pickerBase = inject("EP_PICKER_BASE");
  14869. const {
  14870. shortcuts,
  14871. disabledDate,
  14872. cellClassName,
  14873. format: format2,
  14874. defaultTime,
  14875. arrowControl,
  14876. clearable
  14877. } = pickerBase.props;
  14878. const defaultValue = toRef(pickerBase.props, "defaultValue");
  14879. watch(() => defaultValue.value, (val) => {
  14880. if (val) {
  14881. const defaultArr = getDefaultValue();
  14882. minDate.value = null;
  14883. maxDate.value = null;
  14884. leftDate.value = defaultArr[0];
  14885. rightDate.value = defaultArr[1];
  14886. }
  14887. }, { immediate: true });
  14888. watch(() => props.parsedValue, (newVal) => {
  14889. if (newVal && newVal.length === 2) {
  14890. minDate.value = newVal[0];
  14891. maxDate.value = newVal[1];
  14892. leftDate.value = minDate.value;
  14893. if (props.unlinkPanels && maxDate.value) {
  14894. const minDateYear = minDate.value.year();
  14895. const minDateMonth = minDate.value.month();
  14896. const maxDateYear = maxDate.value.year();
  14897. const maxDateMonth = maxDate.value.month();
  14898. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate.value.add(1, "month") : maxDate.value;
  14899. } else {
  14900. rightDate.value = leftDate.value.add(1, "month");
  14901. if (maxDate.value) {
  14902. rightDate.value = rightDate.value.hour(maxDate.value.hour()).minute(maxDate.value.minute()).second(maxDate.value.second());
  14903. }
  14904. }
  14905. } else {
  14906. const defaultArr = getDefaultValue();
  14907. minDate.value = null;
  14908. maxDate.value = null;
  14909. leftDate.value = defaultArr[0];
  14910. rightDate.value = defaultArr[1];
  14911. }
  14912. }, { immediate: true });
  14913. return {
  14914. shortcuts,
  14915. disabledDate,
  14916. cellClassName,
  14917. minTimePickerVisible,
  14918. maxTimePickerVisible,
  14919. handleMinTimeClose,
  14920. handleMaxTimeClose,
  14921. handleShortcutClick,
  14922. rangeState,
  14923. minDate,
  14924. maxDate,
  14925. handleRangePick,
  14926. onSelect,
  14927. handleChangeRange,
  14928. btnDisabled,
  14929. enableYearArrow,
  14930. enableMonthArrow,
  14931. rightPrevMonth,
  14932. rightPrevYear,
  14933. rightNextMonth,
  14934. rightNextYear,
  14935. leftPrevMonth,
  14936. leftPrevYear,
  14937. leftNextMonth,
  14938. leftNextYear,
  14939. hasShortcuts,
  14940. leftLabel,
  14941. rightLabel,
  14942. leftDate,
  14943. rightDate,
  14944. showTime,
  14945. t,
  14946. minVisibleDate,
  14947. maxVisibleDate,
  14948. minVisibleTime,
  14949. maxVisibleTime,
  14950. arrowControl,
  14951. handleDateInput,
  14952. handleDateChange,
  14953. handleTimeInput,
  14954. handleTimeChange,
  14955. handleMinTimePick,
  14956. handleMaxTimePick,
  14957. handleClear,
  14958. handleConfirm,
  14959. timeFormat,
  14960. clearable
  14961. };
  14962. }
  14963. });
  14964. const _hoisted_1$p = { class: "el-picker-panel__body-wrapper" };
  14965. const _hoisted_2$j = {
  14966. key: 0,
  14967. class: "el-picker-panel__sidebar"
  14968. };
  14969. const _hoisted_3$d = ["onClick"];
  14970. const _hoisted_4$b = { class: "el-picker-panel__body" };
  14971. const _hoisted_5$b = {
  14972. key: 0,
  14973. class: "el-date-range-picker__time-header"
  14974. };
  14975. const _hoisted_6$8 = { class: "el-date-range-picker__editors-wrap" };
  14976. const _hoisted_7$4 = { class: "el-date-range-picker__time-picker-wrap" };
  14977. const _hoisted_8$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14978. const _hoisted_9$3 = { class: "el-date-range-picker__editors-wrap is-right" };
  14979. const _hoisted_10$3 = { class: "el-date-range-picker__time-picker-wrap" };
  14980. const _hoisted_11$2 = { class: "el-date-range-picker__time-picker-wrap" };
  14981. const _hoisted_12$2 = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  14982. const _hoisted_13$2 = { class: "el-date-range-picker__header" };
  14983. const _hoisted_14$2 = ["disabled"];
  14984. const _hoisted_15$1 = ["disabled"];
  14985. const _hoisted_16$1 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  14986. const _hoisted_17$1 = { class: "el-date-range-picker__header" };
  14987. const _hoisted_18$1 = ["disabled"];
  14988. const _hoisted_19$1 = ["disabled"];
  14989. const _hoisted_20$1 = {
  14990. key: 0,
  14991. class: "el-picker-panel__footer"
  14992. };
  14993. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  14994. const _component_el_input = resolveComponent("el-input");
  14995. const _component_time_pick_panel = resolveComponent("time-pick-panel");
  14996. const _component_arrow_right = resolveComponent("arrow-right");
  14997. const _component_el_icon = resolveComponent("el-icon");
  14998. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  14999. const _component_arrow_left = resolveComponent("arrow-left");
  15000. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  15001. const _component_date_table = resolveComponent("date-table");
  15002. const _component_el_button = resolveComponent("el-button");
  15003. const _directive_clickoutside = resolveDirective("clickoutside");
  15004. return openBlock(), createElementBlock("div", {
  15005. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  15006. {
  15007. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts,
  15008. "has-time": _ctx.showTime
  15009. }
  15010. ]])
  15011. }, [
  15012. createElementVNode("div", _hoisted_1$p, [
  15013. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  15014. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$j, [
  15015. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  15016. return openBlock(), createElementBlock("button", {
  15017. key,
  15018. type: "button",
  15019. class: "el-picker-panel__shortcut",
  15020. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  15021. }, toDisplayString(shortcut.text), 9, _hoisted_3$d);
  15022. }), 128))
  15023. ])) : createCommentVNode("v-if", true),
  15024. createElementVNode("div", _hoisted_4$b, [
  15025. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_5$b, [
  15026. createElementVNode("span", _hoisted_6$8, [
  15027. createElementVNode("span", _hoisted_7$4, [
  15028. createVNode(_component_el_input, {
  15029. size: "small",
  15030. disabled: _ctx.rangeState.selecting,
  15031. placeholder: _ctx.t("el.datepicker.startDate"),
  15032. class: "el-date-range-picker__editor",
  15033. "model-value": _ctx.minVisibleDate,
  15034. onInput: _cache[0] || (_cache[0] = (val) => _ctx.handleDateInput(val, "min")),
  15035. onChange: _cache[1] || (_cache[1] = (val) => _ctx.handleDateChange(val, "min"))
  15036. }, null, 8, ["disabled", "placeholder", "model-value"])
  15037. ]),
  15038. withDirectives((openBlock(), createElementBlock("span", _hoisted_8$3, [
  15039. createVNode(_component_el_input, {
  15040. size: "small",
  15041. class: "el-date-range-picker__editor",
  15042. disabled: _ctx.rangeState.selecting,
  15043. placeholder: _ctx.t("el.datepicker.startTime"),
  15044. "model-value": _ctx.minVisibleTime,
  15045. onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.minTimePickerVisible = true),
  15046. onInput: _cache[3] || (_cache[3] = (val) => _ctx.handleTimeInput(val, "min")),
  15047. onChange: _cache[4] || (_cache[4] = (val) => _ctx.handleTimeChange(val, "min"))
  15048. }, null, 8, ["disabled", "placeholder", "model-value"]),
  15049. createVNode(_component_time_pick_panel, {
  15050. visible: _ctx.minTimePickerVisible,
  15051. format: _ctx.timeFormat,
  15052. "datetime-role": "start",
  15053. "time-arrow-control": _ctx.arrowControl,
  15054. "parsed-value": _ctx.leftDate,
  15055. onPick: _ctx.handleMinTimePick
  15056. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  15057. ])), [
  15058. [_directive_clickoutside, _ctx.handleMinTimeClose]
  15059. ])
  15060. ]),
  15061. createElementVNode("span", null, [
  15062. createVNode(_component_el_icon, null, {
  15063. default: withCtx(() => [
  15064. createVNode(_component_arrow_right)
  15065. ]),
  15066. _: 1
  15067. })
  15068. ]),
  15069. createElementVNode("span", _hoisted_9$3, [
  15070. createElementVNode("span", _hoisted_10$3, [
  15071. createVNode(_component_el_input, {
  15072. size: "small",
  15073. class: "el-date-range-picker__editor",
  15074. disabled: _ctx.rangeState.selecting,
  15075. placeholder: _ctx.t("el.datepicker.endDate"),
  15076. "model-value": _ctx.maxVisibleDate,
  15077. readonly: !_ctx.minDate,
  15078. onInput: _cache[5] || (_cache[5] = (val) => _ctx.handleDateInput(val, "max")),
  15079. onChange: _cache[6] || (_cache[6] = (val) => _ctx.handleDateChange(val, "max"))
  15080. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"])
  15081. ]),
  15082. withDirectives((openBlock(), createElementBlock("span", _hoisted_11$2, [
  15083. createVNode(_component_el_input, {
  15084. size: "small",
  15085. class: "el-date-range-picker__editor",
  15086. disabled: _ctx.rangeState.selecting,
  15087. placeholder: _ctx.t("el.datepicker.endTime"),
  15088. "model-value": _ctx.maxVisibleTime,
  15089. readonly: !_ctx.minDate,
  15090. onFocus: _cache[7] || (_cache[7] = ($event) => _ctx.minDate && (_ctx.maxTimePickerVisible = true)),
  15091. onInput: _cache[8] || (_cache[8] = (val) => _ctx.handleTimeInput(val, "max")),
  15092. onChange: _cache[9] || (_cache[9] = (val) => _ctx.handleTimeChange(val, "max"))
  15093. }, null, 8, ["disabled", "placeholder", "model-value", "readonly"]),
  15094. createVNode(_component_time_pick_panel, {
  15095. "datetime-role": "end",
  15096. visible: _ctx.maxTimePickerVisible,
  15097. format: _ctx.timeFormat,
  15098. "time-arrow-control": _ctx.arrowControl,
  15099. "parsed-value": _ctx.rightDate,
  15100. onPick: _ctx.handleMaxTimePick
  15101. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value", "onPick"])
  15102. ])), [
  15103. [_directive_clickoutside, _ctx.handleMaxTimeClose]
  15104. ])
  15105. ])
  15106. ])) : createCommentVNode("v-if", true),
  15107. createElementVNode("div", _hoisted_12$2, [
  15108. createElementVNode("div", _hoisted_13$2, [
  15109. createElementVNode("button", {
  15110. type: "button",
  15111. class: "el-picker-panel__icon-btn d-arrow-left",
  15112. onClick: _cache[10] || (_cache[10] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  15113. }, [
  15114. createVNode(_component_el_icon, null, {
  15115. default: withCtx(() => [
  15116. createVNode(_component_d_arrow_left)
  15117. ]),
  15118. _: 1
  15119. })
  15120. ]),
  15121. createElementVNode("button", {
  15122. type: "button",
  15123. class: "el-picker-panel__icon-btn arrow-left",
  15124. onClick: _cache[11] || (_cache[11] = (...args) => _ctx.leftPrevMonth && _ctx.leftPrevMonth(...args))
  15125. }, [
  15126. createVNode(_component_el_icon, null, {
  15127. default: withCtx(() => [
  15128. createVNode(_component_arrow_left)
  15129. ]),
  15130. _: 1
  15131. })
  15132. ]),
  15133. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15134. key: 0,
  15135. type: "button",
  15136. disabled: !_ctx.enableYearArrow,
  15137. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  15138. onClick: _cache[12] || (_cache[12] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  15139. }, [
  15140. createVNode(_component_el_icon, null, {
  15141. default: withCtx(() => [
  15142. createVNode(_component_d_arrow_right)
  15143. ]),
  15144. _: 1
  15145. })
  15146. ], 10, _hoisted_14$2)) : createCommentVNode("v-if", true),
  15147. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15148. key: 1,
  15149. type: "button",
  15150. disabled: !_ctx.enableMonthArrow,
  15151. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-right"]),
  15152. onClick: _cache[13] || (_cache[13] = (...args) => _ctx.leftNextMonth && _ctx.leftNextMonth(...args))
  15153. }, [
  15154. createVNode(_component_el_icon, null, {
  15155. default: withCtx(() => [
  15156. createVNode(_component_arrow_right)
  15157. ]),
  15158. _: 1
  15159. })
  15160. ], 10, _hoisted_15$1)) : createCommentVNode("v-if", true),
  15161. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15162. ]),
  15163. createVNode(_component_date_table, {
  15164. "selection-mode": "range",
  15165. date: _ctx.leftDate,
  15166. "min-date": _ctx.minDate,
  15167. "max-date": _ctx.maxDate,
  15168. "range-state": _ctx.rangeState,
  15169. "disabled-date": _ctx.disabledDate,
  15170. "cell-class-name": _ctx.cellClassName,
  15171. onChangerange: _ctx.handleChangeRange,
  15172. onPick: _ctx.handleRangePick,
  15173. onSelect: _ctx.onSelect
  15174. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15175. ]),
  15176. createElementVNode("div", _hoisted_16$1, [
  15177. createElementVNode("div", _hoisted_17$1, [
  15178. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15179. key: 0,
  15180. type: "button",
  15181. disabled: !_ctx.enableYearArrow,
  15182. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15183. onClick: _cache[14] || (_cache[14] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15184. }, [
  15185. createVNode(_component_el_icon, null, {
  15186. default: withCtx(() => [
  15187. createVNode(_component_d_arrow_left)
  15188. ]),
  15189. _: 1
  15190. })
  15191. ], 10, _hoisted_18$1)) : createCommentVNode("v-if", true),
  15192. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15193. key: 1,
  15194. type: "button",
  15195. disabled: !_ctx.enableMonthArrow,
  15196. class: normalizeClass([{ "is-disabled": !_ctx.enableMonthArrow }, "el-picker-panel__icon-btn arrow-left"]),
  15197. onClick: _cache[15] || (_cache[15] = (...args) => _ctx.rightPrevMonth && _ctx.rightPrevMonth(...args))
  15198. }, [
  15199. createVNode(_component_el_icon, null, {
  15200. default: withCtx(() => [
  15201. createVNode(_component_arrow_left)
  15202. ]),
  15203. _: 1
  15204. })
  15205. ], 10, _hoisted_19$1)) : createCommentVNode("v-if", true),
  15206. createElementVNode("button", {
  15207. type: "button",
  15208. class: "el-picker-panel__icon-btn d-arrow-right",
  15209. onClick: _cache[16] || (_cache[16] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15210. }, [
  15211. createVNode(_component_el_icon, null, {
  15212. default: withCtx(() => [
  15213. createVNode(_component_d_arrow_right)
  15214. ]),
  15215. _: 1
  15216. })
  15217. ]),
  15218. createElementVNode("button", {
  15219. type: "button",
  15220. class: "el-picker-panel__icon-btn arrow-right",
  15221. onClick: _cache[17] || (_cache[17] = (...args) => _ctx.rightNextMonth && _ctx.rightNextMonth(...args))
  15222. }, [
  15223. createVNode(_component_el_icon, null, {
  15224. default: withCtx(() => [
  15225. createVNode(_component_arrow_right)
  15226. ]),
  15227. _: 1
  15228. })
  15229. ]),
  15230. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15231. ]),
  15232. createVNode(_component_date_table, {
  15233. "selection-mode": "range",
  15234. date: _ctx.rightDate,
  15235. "min-date": _ctx.minDate,
  15236. "max-date": _ctx.maxDate,
  15237. "range-state": _ctx.rangeState,
  15238. "disabled-date": _ctx.disabledDate,
  15239. "cell-class-name": _ctx.cellClassName,
  15240. onChangerange: _ctx.handleChangeRange,
  15241. onPick: _ctx.handleRangePick,
  15242. onSelect: _ctx.onSelect
  15243. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onPick", "onSelect"])
  15244. ])
  15245. ])
  15246. ]),
  15247. _ctx.showTime ? (openBlock(), createElementBlock("div", _hoisted_20$1, [
  15248. _ctx.clearable ? (openBlock(), createBlock(_component_el_button, {
  15249. key: 0,
  15250. size: "small",
  15251. type: "text",
  15252. class: "el-picker-panel__link-btn",
  15253. onClick: _ctx.handleClear
  15254. }, {
  15255. default: withCtx(() => [
  15256. createTextVNode(toDisplayString(_ctx.t("el.datepicker.clear")), 1)
  15257. ]),
  15258. _: 1
  15259. }, 8, ["onClick"])) : createCommentVNode("v-if", true),
  15260. createVNode(_component_el_button, {
  15261. plain: "",
  15262. size: "small",
  15263. class: "el-picker-panel__link-btn",
  15264. disabled: _ctx.btnDisabled,
  15265. onClick: _cache[18] || (_cache[18] = ($event) => _ctx.handleConfirm(false))
  15266. }, {
  15267. default: withCtx(() => [
  15268. createTextVNode(toDisplayString(_ctx.t("el.datepicker.confirm")), 1)
  15269. ]),
  15270. _: 1
  15271. }, 8, ["disabled"])
  15272. ])) : createCommentVNode("v-if", true)
  15273. ], 2);
  15274. }
  15275. var DateRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$E, [["render", _sfc_render$i], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-range.vue"]]);
  15276. const _sfc_main$D = defineComponent({
  15277. components: { MonthTable, ElIcon, DArrowLeft: dArrowLeft, DArrowRight: dArrowRight },
  15278. props: {
  15279. unlinkPanels: Boolean,
  15280. parsedValue: {
  15281. type: Array
  15282. }
  15283. },
  15284. emits: ["pick", "set-picker-option"],
  15285. setup(props, ctx) {
  15286. const { t, lang } = useLocale();
  15287. const leftDate = ref(dayjs().locale(lang.value));
  15288. const rightDate = ref(dayjs().locale(lang.value).add(1, "year"));
  15289. const hasShortcuts = computed(() => !!shortcuts.length);
  15290. const handleShortcutClick = (shortcut) => {
  15291. const shortcutValues = typeof shortcut.value === "function" ? shortcut.value() : shortcut.value;
  15292. if (shortcutValues) {
  15293. ctx.emit("pick", [
  15294. dayjs(shortcutValues[0]).locale(lang.value),
  15295. dayjs(shortcutValues[1]).locale(lang.value)
  15296. ]);
  15297. return;
  15298. }
  15299. if (shortcut.onClick) {
  15300. shortcut.onClick(ctx);
  15301. }
  15302. };
  15303. const leftPrevYear = () => {
  15304. leftDate.value = leftDate.value.subtract(1, "year");
  15305. if (!props.unlinkPanels) {
  15306. rightDate.value = rightDate.value.subtract(1, "year");
  15307. }
  15308. };
  15309. const rightNextYear = () => {
  15310. if (!props.unlinkPanels) {
  15311. leftDate.value = leftDate.value.add(1, "year");
  15312. }
  15313. rightDate.value = rightDate.value.add(1, "year");
  15314. };
  15315. const leftNextYear = () => {
  15316. leftDate.value = leftDate.value.add(1, "year");
  15317. };
  15318. const rightPrevYear = () => {
  15319. rightDate.value = rightDate.value.subtract(1, "year");
  15320. };
  15321. const leftLabel = computed(() => {
  15322. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  15323. });
  15324. const rightLabel = computed(() => {
  15325. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  15326. });
  15327. const leftYear = computed(() => {
  15328. return leftDate.value.year();
  15329. });
  15330. const rightYear = computed(() => {
  15331. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  15332. });
  15333. const enableYearArrow = computed(() => {
  15334. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  15335. });
  15336. const minDate = ref(null);
  15337. const maxDate = ref(null);
  15338. const rangeState = ref({
  15339. endDate: null,
  15340. selecting: false
  15341. });
  15342. const handleChangeRange = (val) => {
  15343. rangeState.value = val;
  15344. };
  15345. const handleRangePick = (val, close2 = true) => {
  15346. const minDate_ = val.minDate;
  15347. const maxDate_ = val.maxDate;
  15348. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  15349. return;
  15350. }
  15351. maxDate.value = maxDate_;
  15352. minDate.value = minDate_;
  15353. if (!close2)
  15354. return;
  15355. handleConfirm();
  15356. };
  15357. const isValidValue = (value) => {
  15358. return Array.isArray(value) && value && value[0] && value[1] && value[0].valueOf() <= value[1].valueOf();
  15359. };
  15360. const handleConfirm = (visible = false) => {
  15361. if (isValidValue([minDate.value, maxDate.value])) {
  15362. ctx.emit("pick", [minDate.value, maxDate.value], visible);
  15363. }
  15364. };
  15365. const onSelect = (selecting) => {
  15366. rangeState.value.selecting = selecting;
  15367. if (!selecting) {
  15368. rangeState.value.endDate = null;
  15369. }
  15370. };
  15371. const formatToString = (value) => {
  15372. return value.map((_2) => _2.format(format2));
  15373. };
  15374. const getDefaultValue = () => {
  15375. let start2;
  15376. if (Array.isArray(defaultValue.value)) {
  15377. const left2 = dayjs(defaultValue.value[0]);
  15378. let right2 = dayjs(defaultValue.value[1]);
  15379. if (!props.unlinkPanels) {
  15380. right2 = left2.add(1, "year");
  15381. }
  15382. return [left2, right2];
  15383. } else if (defaultValue.value) {
  15384. start2 = dayjs(defaultValue.value);
  15385. } else {
  15386. start2 = dayjs();
  15387. }
  15388. start2 = start2.locale(lang.value);
  15389. return [start2, start2.add(1, "year")];
  15390. };
  15391. ctx.emit("set-picker-option", ["formatToString", formatToString]);
  15392. const pickerBase = inject("EP_PICKER_BASE");
  15393. const { shortcuts, disabledDate, format: format2 } = pickerBase.props;
  15394. const defaultValue = toRef(pickerBase.props, "defaultValue");
  15395. watch(() => defaultValue.value, (val) => {
  15396. if (val) {
  15397. const defaultArr = getDefaultValue();
  15398. leftDate.value = defaultArr[0];
  15399. rightDate.value = defaultArr[1];
  15400. }
  15401. }, { immediate: true });
  15402. watch(() => props.parsedValue, (newVal) => {
  15403. if (newVal && newVal.length === 2) {
  15404. minDate.value = newVal[0];
  15405. maxDate.value = newVal[1];
  15406. leftDate.value = minDate.value;
  15407. if (props.unlinkPanels && maxDate.value) {
  15408. const minDateYear = minDate.value.year();
  15409. const maxDateYear = maxDate.value.year();
  15410. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(1, "year") : maxDate.value;
  15411. } else {
  15412. rightDate.value = leftDate.value.add(1, "year");
  15413. }
  15414. } else {
  15415. const defaultArr = getDefaultValue();
  15416. minDate.value = null;
  15417. maxDate.value = null;
  15418. leftDate.value = defaultArr[0];
  15419. rightDate.value = defaultArr[1];
  15420. }
  15421. }, { immediate: true });
  15422. return {
  15423. shortcuts,
  15424. disabledDate,
  15425. onSelect,
  15426. handleRangePick,
  15427. rangeState,
  15428. handleChangeRange,
  15429. minDate,
  15430. maxDate,
  15431. enableYearArrow,
  15432. leftLabel,
  15433. rightLabel,
  15434. leftNextYear,
  15435. leftPrevYear,
  15436. rightNextYear,
  15437. rightPrevYear,
  15438. t,
  15439. leftDate,
  15440. rightDate,
  15441. hasShortcuts,
  15442. handleShortcutClick
  15443. };
  15444. }
  15445. });
  15446. const _hoisted_1$o = { class: "el-picker-panel__body-wrapper" };
  15447. const _hoisted_2$i = {
  15448. key: 0,
  15449. class: "el-picker-panel__sidebar"
  15450. };
  15451. const _hoisted_3$c = ["onClick"];
  15452. const _hoisted_4$a = { class: "el-picker-panel__body" };
  15453. const _hoisted_5$a = { class: "el-picker-panel__content el-date-range-picker__content is-left" };
  15454. const _hoisted_6$7 = { class: "el-date-range-picker__header" };
  15455. const _hoisted_7$3 = ["disabled"];
  15456. const _hoisted_8$2 = { class: "el-picker-panel__content el-date-range-picker__content is-right" };
  15457. const _hoisted_9$2 = { class: "el-date-range-picker__header" };
  15458. const _hoisted_10$2 = ["disabled"];
  15459. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  15460. const _component_d_arrow_left = resolveComponent("d-arrow-left");
  15461. const _component_el_icon = resolveComponent("el-icon");
  15462. const _component_d_arrow_right = resolveComponent("d-arrow-right");
  15463. const _component_month_table = resolveComponent("month-table");
  15464. return openBlock(), createElementBlock("div", {
  15465. class: normalizeClass(["el-picker-panel el-date-range-picker", [
  15466. {
  15467. "has-sidebar": _ctx.$slots.sidebar || _ctx.hasShortcuts
  15468. }
  15469. ]])
  15470. }, [
  15471. createElementVNode("div", _hoisted_1$o, [
  15472. renderSlot(_ctx.$slots, "sidebar", { class: "el-picker-panel__sidebar" }),
  15473. _ctx.hasShortcuts ? (openBlock(), createElementBlock("div", _hoisted_2$i, [
  15474. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.shortcuts, (shortcut, key) => {
  15475. return openBlock(), createElementBlock("button", {
  15476. key,
  15477. type: "button",
  15478. class: "el-picker-panel__shortcut",
  15479. onClick: ($event) => _ctx.handleShortcutClick(shortcut)
  15480. }, toDisplayString(shortcut.text), 9, _hoisted_3$c);
  15481. }), 128))
  15482. ])) : createCommentVNode("v-if", true),
  15483. createElementVNode("div", _hoisted_4$a, [
  15484. createElementVNode("div", _hoisted_5$a, [
  15485. createElementVNode("div", _hoisted_6$7, [
  15486. createElementVNode("button", {
  15487. type: "button",
  15488. class: "el-picker-panel__icon-btn d-arrow-left",
  15489. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.leftPrevYear && _ctx.leftPrevYear(...args))
  15490. }, [
  15491. createVNode(_component_el_icon, null, {
  15492. default: withCtx(() => [
  15493. createVNode(_component_d_arrow_left)
  15494. ]),
  15495. _: 1
  15496. })
  15497. ]),
  15498. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15499. key: 0,
  15500. type: "button",
  15501. disabled: !_ctx.enableYearArrow,
  15502. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-right"]),
  15503. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.leftNextYear && _ctx.leftNextYear(...args))
  15504. }, [
  15505. createVNode(_component_el_icon, null, {
  15506. default: withCtx(() => [
  15507. createVNode(_component_d_arrow_right)
  15508. ]),
  15509. _: 1
  15510. })
  15511. ], 10, _hoisted_7$3)) : createCommentVNode("v-if", true),
  15512. createElementVNode("div", null, toDisplayString(_ctx.leftLabel), 1)
  15513. ]),
  15514. createVNode(_component_month_table, {
  15515. "selection-mode": "range",
  15516. date: _ctx.leftDate,
  15517. "min-date": _ctx.minDate,
  15518. "max-date": _ctx.maxDate,
  15519. "range-state": _ctx.rangeState,
  15520. "disabled-date": _ctx.disabledDate,
  15521. onChangerange: _ctx.handleChangeRange,
  15522. onPick: _ctx.handleRangePick,
  15523. onSelect: _ctx.onSelect
  15524. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15525. ]),
  15526. createElementVNode("div", _hoisted_8$2, [
  15527. createElementVNode("div", _hoisted_9$2, [
  15528. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  15529. key: 0,
  15530. type: "button",
  15531. disabled: !_ctx.enableYearArrow,
  15532. class: normalizeClass([{ "is-disabled": !_ctx.enableYearArrow }, "el-picker-panel__icon-btn d-arrow-left"]),
  15533. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.rightPrevYear && _ctx.rightPrevYear(...args))
  15534. }, [
  15535. createVNode(_component_el_icon, null, {
  15536. default: withCtx(() => [
  15537. createVNode(_component_d_arrow_left)
  15538. ]),
  15539. _: 1
  15540. })
  15541. ], 10, _hoisted_10$2)) : createCommentVNode("v-if", true),
  15542. createElementVNode("button", {
  15543. type: "button",
  15544. class: "el-picker-panel__icon-btn d-arrow-right",
  15545. onClick: _cache[3] || (_cache[3] = (...args) => _ctx.rightNextYear && _ctx.rightNextYear(...args))
  15546. }, [
  15547. createVNode(_component_el_icon, null, {
  15548. default: withCtx(() => [
  15549. createVNode(_component_d_arrow_right)
  15550. ]),
  15551. _: 1
  15552. })
  15553. ]),
  15554. createElementVNode("div", null, toDisplayString(_ctx.rightLabel), 1)
  15555. ]),
  15556. createVNode(_component_month_table, {
  15557. "selection-mode": "range",
  15558. date: _ctx.rightDate,
  15559. "min-date": _ctx.minDate,
  15560. "max-date": _ctx.maxDate,
  15561. "range-state": _ctx.rangeState,
  15562. "disabled-date": _ctx.disabledDate,
  15563. onChangerange: _ctx.handleChangeRange,
  15564. onPick: _ctx.handleRangePick,
  15565. onSelect: _ctx.onSelect
  15566. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onPick", "onSelect"])
  15567. ])
  15568. ])
  15569. ])
  15570. ], 2);
  15571. }
  15572. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$D, [["render", _sfc_render$h], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-month-range.vue"]]);
  15573. dayjs.extend(localeData);
  15574. dayjs.extend(advancedFormat);
  15575. dayjs.extend(customParseFormat);
  15576. dayjs.extend(weekOfYear);
  15577. dayjs.extend(weekYear);
  15578. dayjs.extend(dayOfYear);
  15579. dayjs.extend(isSameOrAfter);
  15580. dayjs.extend(isSameOrBefore);
  15581. const getPanel = function(type4) {
  15582. if (type4 === "daterange" || type4 === "datetimerange") {
  15583. return DateRangePickPanel;
  15584. } else if (type4 === "monthrange") {
  15585. return MonthRangePickPanel;
  15586. }
  15587. return DatePickPanel;
  15588. };
  15589. var DatePicker = defineComponent({
  15590. name: "ElDatePicker",
  15591. install: null,
  15592. props: __spreadProps(__spreadValues({}, timePickerDefaultProps), {
  15593. type: {
  15594. type: String,
  15595. default: "date"
  15596. }
  15597. }),
  15598. emits: ["update:modelValue"],
  15599. setup(props, ctx) {
  15600. provide("ElPopperOptions", props.popperOptions);
  15601. provide(ROOT_PICKER_INJECTION_KEY, {
  15602. ctx
  15603. });
  15604. const commonPicker = ref(null);
  15605. const refProps = __spreadProps(__spreadValues({}, props), {
  15606. focus: (focusStartInput = true) => {
  15607. var _a2;
  15608. (_a2 = commonPicker.value) == null ? void 0 : _a2.focus(focusStartInput);
  15609. }
  15610. });
  15611. ctx.expose(refProps);
  15612. return () => {
  15613. var _a2;
  15614. const format2 = (_a2 = props.format) != null ? _a2 : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  15615. return h$1(CommonPicker, __spreadProps(__spreadValues({}, props), {
  15616. format: format2,
  15617. type: props.type,
  15618. ref: commonPicker,
  15619. "onUpdate:modelValue": (value) => ctx.emit("update:modelValue", value)
  15620. }), {
  15621. default: (scopedProps) => h$1(getPanel(props.type), scopedProps),
  15622. "range-separator": () => renderSlot(ctx.slots, "range-separator")
  15623. });
  15624. };
  15625. }
  15626. });
  15627. const _DatePicker = DatePicker;
  15628. _DatePicker.install = (app) => {
  15629. app.component(_DatePicker.name, _DatePicker);
  15630. };
  15631. const ElDatePicker = _DatePicker;
  15632. const overlayProps = buildProps({
  15633. mask: {
  15634. type: Boolean,
  15635. default: true
  15636. },
  15637. customMaskEvent: {
  15638. type: Boolean,
  15639. default: false
  15640. },
  15641. overlayClass: {
  15642. type: definePropType([
  15643. String,
  15644. Array,
  15645. Object
  15646. ])
  15647. },
  15648. zIndex: {
  15649. type: definePropType([String, Number])
  15650. }
  15651. });
  15652. const overlayEmits = {
  15653. click: (evt) => evt instanceof MouseEvent
  15654. };
  15655. var Overlay = defineComponent({
  15656. name: "ElOverlay",
  15657. props: overlayProps,
  15658. emits: overlayEmits,
  15659. setup(props, { slots, emit }) {
  15660. const ns = useNamespace("overlay");
  15661. const onMaskClick = (e) => {
  15662. emit("click", e);
  15663. };
  15664. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  15665. return () => {
  15666. return props.mask ? createVNode("div", {
  15667. class: [ns.b(), props.overlayClass],
  15668. style: {
  15669. zIndex: props.zIndex
  15670. },
  15671. onClick,
  15672. onMousedown,
  15673. onMouseup
  15674. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
  15675. class: props.overlayClass,
  15676. style: {
  15677. zIndex: props.zIndex,
  15678. position: "fixed",
  15679. top: "0px",
  15680. right: "0px",
  15681. bottom: "0px",
  15682. left: "0px"
  15683. }
  15684. }, [renderSlot(slots, "default")]);
  15685. };
  15686. }
  15687. });
  15688. const ElOverlay = Overlay;
  15689. const dialogContentProps = buildProps({
  15690. center: {
  15691. type: Boolean,
  15692. default: false
  15693. },
  15694. closeIcon: {
  15695. type: iconPropType,
  15696. default: ""
  15697. },
  15698. customClass: {
  15699. type: String,
  15700. default: ""
  15701. },
  15702. draggable: {
  15703. type: Boolean,
  15704. default: false
  15705. },
  15706. fullscreen: {
  15707. type: Boolean,
  15708. default: false
  15709. },
  15710. showClose: {
  15711. type: Boolean,
  15712. default: true
  15713. },
  15714. title: {
  15715. type: String,
  15716. default: ""
  15717. }
  15718. });
  15719. const dialogContentEmits = {
  15720. close: () => true
  15721. };
  15722. const _hoisted_1$n = ["aria-label"];
  15723. const __default__$c = { name: "ElDialogContent" };
  15724. const _sfc_main$C = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$c), {
  15725. props: dialogContentProps,
  15726. emits: dialogContentEmits,
  15727. setup(__props) {
  15728. const { Close } = CloseComponents;
  15729. const { dialogRef, headerRef, ns, style } = inject(dialogInjectionKey);
  15730. return (_ctx, _cache) => {
  15731. return openBlock(), createElementBlock("div", {
  15732. ref_key: "dialogRef",
  15733. ref: dialogRef,
  15734. class: normalizeClass([
  15735. unref(ns).b(),
  15736. unref(ns).is("fullscreen", _ctx.fullscreen),
  15737. unref(ns).is("draggable", _ctx.draggable),
  15738. { [unref(ns).m("center")]: _ctx.center },
  15739. _ctx.customClass
  15740. ]),
  15741. "aria-modal": "true",
  15742. role: "dialog",
  15743. "aria-label": _ctx.title || "dialog",
  15744. style: normalizeStyle(unref(style)),
  15745. onClick: _cache[1] || (_cache[1] = withModifiers(() => {
  15746. }, ["stop"]))
  15747. }, [
  15748. createElementVNode("div", {
  15749. ref_key: "headerRef",
  15750. ref: headerRef,
  15751. class: normalizeClass(unref(ns).e("header"))
  15752. }, [
  15753. renderSlot(_ctx.$slots, "title", {}, () => [
  15754. createElementVNode("span", {
  15755. class: normalizeClass(unref(ns).e("title"))
  15756. }, toDisplayString(_ctx.title), 3)
  15757. ])
  15758. ], 2),
  15759. createElementVNode("div", {
  15760. class: normalizeClass(unref(ns).e("body"))
  15761. }, [
  15762. renderSlot(_ctx.$slots, "default")
  15763. ], 2),
  15764. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  15765. key: 0,
  15766. class: normalizeClass(unref(ns).e("footer"))
  15767. }, [
  15768. renderSlot(_ctx.$slots, "footer")
  15769. ], 2)) : createCommentVNode("v-if", true),
  15770. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  15771. key: 1,
  15772. "aria-label": "close",
  15773. class: normalizeClass(unref(ns).e("headerbtn")),
  15774. type: "button",
  15775. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  15776. }, [
  15777. createVNode(unref(ElIcon), {
  15778. class: normalizeClass(unref(ns).e("close"))
  15779. }, {
  15780. default: withCtx(() => [
  15781. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  15782. ]),
  15783. _: 1
  15784. }, 8, ["class"])
  15785. ], 2)) : createCommentVNode("v-if", true)
  15786. ], 14, _hoisted_1$n);
  15787. };
  15788. }
  15789. }));
  15790. var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$C, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
  15791. const dialogProps = buildProps(__spreadProps(__spreadValues({}, dialogContentProps), {
  15792. appendToBody: {
  15793. type: Boolean,
  15794. default: false
  15795. },
  15796. beforeClose: {
  15797. type: definePropType(Function)
  15798. },
  15799. destroyOnClose: {
  15800. type: Boolean,
  15801. default: false
  15802. },
  15803. closeOnClickModal: {
  15804. type: Boolean,
  15805. default: true
  15806. },
  15807. closeOnPressEscape: {
  15808. type: Boolean,
  15809. default: true
  15810. },
  15811. lockScroll: {
  15812. type: Boolean,
  15813. default: true
  15814. },
  15815. modal: {
  15816. type: Boolean,
  15817. default: true
  15818. },
  15819. openDelay: {
  15820. type: Number,
  15821. default: 0
  15822. },
  15823. closeDelay: {
  15824. type: Number,
  15825. default: 0
  15826. },
  15827. top: {
  15828. type: String
  15829. },
  15830. modelValue: {
  15831. type: Boolean,
  15832. required: true
  15833. },
  15834. modalClass: String,
  15835. width: {
  15836. type: [String, Number]
  15837. },
  15838. zIndex: {
  15839. type: Number
  15840. },
  15841. trapFocus: {
  15842. type: Boolean,
  15843. default: false
  15844. }
  15845. }));
  15846. const dialogEmits = {
  15847. open: () => true,
  15848. opened: () => true,
  15849. close: () => true,
  15850. closed: () => true,
  15851. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  15852. openAutoFocus: () => true,
  15853. closeAutoFocus: () => true
  15854. };
  15855. const useDialog = (props, targetRef) => {
  15856. const instance = getCurrentInstance();
  15857. const emit = instance.emit;
  15858. const { nextZIndex } = useZIndex();
  15859. let lastPosition = "";
  15860. const visible = ref(false);
  15861. const closed = ref(false);
  15862. const rendered = ref(false);
  15863. const zIndex2 = ref(props.zIndex || nextZIndex());
  15864. let openTimer = void 0;
  15865. let closeTimer = void 0;
  15866. const normalizeWidth = computed(() => isNumber(props.width) ? `${props.width}px` : props.width);
  15867. const style = computed(() => {
  15868. const style2 = {};
  15869. const varPrefix = `--el-dialog`;
  15870. if (!props.fullscreen) {
  15871. if (props.top) {
  15872. style2[`${varPrefix}-margin-top`] = props.top;
  15873. }
  15874. if (props.width) {
  15875. style2[`${varPrefix}-width`] = normalizeWidth.value;
  15876. }
  15877. }
  15878. return style2;
  15879. });
  15880. function afterEnter() {
  15881. emit("opened");
  15882. }
  15883. function afterLeave() {
  15884. emit("closed");
  15885. emit(UPDATE_MODEL_EVENT, false);
  15886. if (props.destroyOnClose) {
  15887. rendered.value = false;
  15888. }
  15889. }
  15890. function beforeLeave() {
  15891. emit("close");
  15892. }
  15893. function open() {
  15894. closeTimer == null ? void 0 : closeTimer();
  15895. openTimer == null ? void 0 : openTimer();
  15896. if (props.openDelay && props.openDelay > 0) {
  15897. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  15898. } else {
  15899. doOpen();
  15900. }
  15901. }
  15902. function close2() {
  15903. openTimer == null ? void 0 : openTimer();
  15904. closeTimer == null ? void 0 : closeTimer();
  15905. if (props.closeDelay && props.closeDelay > 0) {
  15906. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  15907. } else {
  15908. doClose();
  15909. }
  15910. }
  15911. function handleClose() {
  15912. function hide2(shouldCancel) {
  15913. if (shouldCancel)
  15914. return;
  15915. closed.value = true;
  15916. visible.value = false;
  15917. }
  15918. if (props.beforeClose) {
  15919. props.beforeClose(hide2);
  15920. } else {
  15921. close2();
  15922. }
  15923. }
  15924. function onModalClick() {
  15925. if (props.closeOnClickModal) {
  15926. handleClose();
  15927. }
  15928. }
  15929. function doOpen() {
  15930. if (!isClient)
  15931. return;
  15932. visible.value = true;
  15933. }
  15934. function doClose() {
  15935. visible.value = false;
  15936. }
  15937. if (props.lockScroll) {
  15938. useLockscreen(visible);
  15939. }
  15940. if (props.closeOnPressEscape) {
  15941. useModal({
  15942. handleClose
  15943. }, visible);
  15944. }
  15945. useRestoreActive(visible);
  15946. watch(() => props.modelValue, (val) => {
  15947. if (val) {
  15948. closed.value = false;
  15949. open();
  15950. rendered.value = true;
  15951. emit("open");
  15952. zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
  15953. nextTick(() => {
  15954. if (targetRef.value) {
  15955. targetRef.value.scrollTop = 0;
  15956. }
  15957. });
  15958. } else {
  15959. if (visible.value) {
  15960. close2();
  15961. }
  15962. }
  15963. });
  15964. watch(() => props.fullscreen, (val) => {
  15965. if (!targetRef.value)
  15966. return;
  15967. if (val) {
  15968. lastPosition = targetRef.value.style.transform;
  15969. targetRef.value.style.transform = "";
  15970. } else {
  15971. targetRef.value.style.transform = lastPosition;
  15972. }
  15973. });
  15974. onMounted(() => {
  15975. if (props.modelValue) {
  15976. visible.value = true;
  15977. rendered.value = true;
  15978. open();
  15979. }
  15980. });
  15981. return {
  15982. afterEnter,
  15983. afterLeave,
  15984. beforeLeave,
  15985. handleClose,
  15986. onModalClick,
  15987. close: close2,
  15988. doClose,
  15989. closed,
  15990. style,
  15991. rendered,
  15992. visible,
  15993. zIndex: zIndex2
  15994. };
  15995. };
  15996. const __default__$b = {
  15997. name: "ElDialog"
  15998. };
  15999. const _sfc_main$B = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$b), {
  16000. props: dialogProps,
  16001. emits: dialogEmits,
  16002. setup(__props, { expose }) {
  16003. const props = __props;
  16004. const ns = useNamespace("dialog");
  16005. const dialogRef = ref();
  16006. const headerRef = ref();
  16007. const {
  16008. visible,
  16009. style,
  16010. rendered,
  16011. zIndex: zIndex2,
  16012. afterEnter,
  16013. afterLeave,
  16014. beforeLeave,
  16015. handleClose,
  16016. onModalClick
  16017. } = useDialog(props, dialogRef);
  16018. provide(dialogInjectionKey, {
  16019. dialogRef,
  16020. headerRef,
  16021. ns,
  16022. rendered,
  16023. style
  16024. });
  16025. const overlayEvent = useSameTarget(onModalClick);
  16026. const draggable = computed(() => props.draggable && !props.fullscreen);
  16027. useDraggable(dialogRef, headerRef, draggable);
  16028. expose({
  16029. visible
  16030. });
  16031. return (_ctx, _cache) => {
  16032. return openBlock(), createBlock(Teleport, {
  16033. to: "body",
  16034. disabled: !_ctx.appendToBody
  16035. }, [
  16036. createVNode(Transition, {
  16037. name: "dialog-fade",
  16038. onAfterEnter: unref(afterEnter),
  16039. onAfterLeave: unref(afterLeave),
  16040. onBeforeLeave: unref(beforeLeave)
  16041. }, {
  16042. default: withCtx(() => [
  16043. withDirectives(createVNode(unref(ElOverlay), {
  16044. "custom-mask-event": "",
  16045. mask: _ctx.modal,
  16046. "overlay-class": _ctx.modalClass,
  16047. "z-index": unref(zIndex2)
  16048. }, {
  16049. default: withCtx(() => [
  16050. createElementVNode("div", {
  16051. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  16052. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  16053. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  16054. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  16055. }, [
  16056. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, {
  16057. key: 0,
  16058. "custom-class": _ctx.customClass,
  16059. center: _ctx.center,
  16060. "close-icon": _ctx.closeIcon,
  16061. draggable: unref(draggable),
  16062. fullscreen: _ctx.fullscreen,
  16063. "show-close": _ctx.showClose,
  16064. style: normalizeStyle(unref(style)),
  16065. title: _ctx.title,
  16066. onClose: unref(handleClose)
  16067. }, createSlots({
  16068. title: withCtx(() => [
  16069. renderSlot(_ctx.$slots, "title")
  16070. ]),
  16071. default: withCtx(() => [
  16072. renderSlot(_ctx.$slots, "default")
  16073. ]),
  16074. _: 2
  16075. }, [
  16076. _ctx.$slots.footer ? {
  16077. name: "footer",
  16078. fn: withCtx(() => [
  16079. renderSlot(_ctx.$slots, "footer")
  16080. ])
  16081. } : void 0
  16082. ]), 1032, ["custom-class", "center", "close-icon", "draggable", "fullscreen", "show-close", "style", "title", "onClose"])) : createCommentVNode("v-if", true)
  16083. ], 34)
  16084. ]),
  16085. _: 3
  16086. }, 8, ["mask", "overlay-class", "z-index"]), [
  16087. [vShow, unref(visible)]
  16088. ])
  16089. ]),
  16090. _: 3
  16091. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  16092. ], 8, ["disabled"]);
  16093. };
  16094. }
  16095. }));
  16096. var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
  16097. const ElDialog = withInstall(Dialog);
  16098. const dividerProps = buildProps({
  16099. direction: {
  16100. type: String,
  16101. values: ["horizontal", "vertical"],
  16102. default: "horizontal"
  16103. },
  16104. contentPosition: {
  16105. type: String,
  16106. values: ["left", "center", "right"],
  16107. default: "center"
  16108. },
  16109. borderStyle: {
  16110. type: definePropType(String),
  16111. default: "solid"
  16112. }
  16113. });
  16114. const __default__$a = {
  16115. name: "ElDivider"
  16116. };
  16117. const _sfc_main$A = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
  16118. props: dividerProps,
  16119. setup(__props) {
  16120. const props = __props;
  16121. const ns = useNamespace("divider");
  16122. const dividerStyle = computed(() => {
  16123. return {
  16124. "--el-border-style": props.borderStyle
  16125. };
  16126. });
  16127. return (_ctx, _cache) => {
  16128. return openBlock(), createElementBlock("div", {
  16129. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
  16130. style: normalizeStyle(unref(dividerStyle))
  16131. }, [
  16132. _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  16133. key: 0,
  16134. class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
  16135. }, [
  16136. renderSlot(_ctx.$slots, "default")
  16137. ], 2)) : createCommentVNode("v-if", true)
  16138. ], 6);
  16139. };
  16140. }
  16141. }));
  16142. var Divider = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/divider/src/divider.vue"]]);
  16143. const ElDivider = withInstall(Divider);
  16144. const formProps = buildProps({
  16145. model: Object,
  16146. rules: {
  16147. type: definePropType(Object)
  16148. },
  16149. labelPosition: String,
  16150. labelWidth: {
  16151. type: [String, Number],
  16152. default: ""
  16153. },
  16154. labelSuffix: {
  16155. type: String,
  16156. default: ""
  16157. },
  16158. inline: Boolean,
  16159. inlineMessage: Boolean,
  16160. statusIcon: Boolean,
  16161. showMessage: {
  16162. type: Boolean,
  16163. default: true
  16164. },
  16165. size: {
  16166. type: String,
  16167. values: componentSizes
  16168. },
  16169. disabled: Boolean,
  16170. validateOnRuleChange: {
  16171. type: Boolean,
  16172. default: true
  16173. },
  16174. hideRequiredAsterisk: {
  16175. type: Boolean,
  16176. default: false
  16177. },
  16178. scrollToError: Boolean
  16179. });
  16180. const formEmits = {
  16181. validate: (prop, isValid, message) => (isArray(prop) || isString(prop)) && isBoolean(isValid) && isString(message)
  16182. };
  16183. function useFormLabelWidth() {
  16184. const potentialLabelWidthArr = ref([]);
  16185. const autoLabelWidth = computed(() => {
  16186. if (!potentialLabelWidthArr.value.length)
  16187. return "0";
  16188. const max2 = Math.max(...potentialLabelWidthArr.value);
  16189. return max2 ? `${max2}px` : "";
  16190. });
  16191. function getLabelWidthIndex(width) {
  16192. const index = potentialLabelWidthArr.value.indexOf(width);
  16193. return index;
  16194. }
  16195. function registerLabelWidth(val, oldVal) {
  16196. if (val && oldVal) {
  16197. const index = getLabelWidthIndex(oldVal);
  16198. potentialLabelWidthArr.value.splice(index, 1, val);
  16199. } else if (val) {
  16200. potentialLabelWidthArr.value.push(val);
  16201. }
  16202. }
  16203. function deregisterLabelWidth(val) {
  16204. const index = getLabelWidthIndex(val);
  16205. if (index > -1) {
  16206. potentialLabelWidthArr.value.splice(index, 1);
  16207. }
  16208. }
  16209. return {
  16210. autoLabelWidth,
  16211. registerLabelWidth,
  16212. deregisterLabelWidth
  16213. };
  16214. }
  16215. const filterFields = (fields, props) => {
  16216. const normalized = castArray$1(props);
  16217. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  16218. };
  16219. const __default__$9 = {
  16220. name: "ElForm"
  16221. };
  16222. const _sfc_main$z = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
  16223. props: formProps,
  16224. emits: formEmits,
  16225. setup(__props, { expose, emit }) {
  16226. const props = __props;
  16227. const fields = [];
  16228. const formSize = useSize();
  16229. const ns = useNamespace("form");
  16230. const formClasses = computed(() => {
  16231. const { labelPosition, inline } = props;
  16232. return [
  16233. ns.b(),
  16234. ns.m(formSize.value || "default"),
  16235. {
  16236. [ns.m(`label-${labelPosition}`)]: labelPosition,
  16237. [ns.m("inline")]: inline
  16238. }
  16239. ];
  16240. });
  16241. const addField = (field) => {
  16242. fields.push(field);
  16243. };
  16244. const removeField = (field) => {
  16245. if (field.prop) {
  16246. fields.splice(fields.indexOf(field), 1);
  16247. }
  16248. };
  16249. const resetFields = (properties = []) => {
  16250. if (!props.model) {
  16251. return;
  16252. }
  16253. filterFields(fields, properties).forEach((field) => field.resetField());
  16254. };
  16255. const clearValidate = (props2 = []) => {
  16256. filterFields(fields, props2).forEach((field) => field.clearValidate());
  16257. };
  16258. const isValidatable = computed(() => {
  16259. const hasModel = !!props.model;
  16260. return hasModel;
  16261. });
  16262. const obtainValidateFields = (props2) => {
  16263. if (fields.length === 0)
  16264. return [];
  16265. const filteredFields = filterFields(fields, props2);
  16266. if (!filteredFields.length) {
  16267. return [];
  16268. }
  16269. return filteredFields;
  16270. };
  16271. const validate = async (callback) => validateField(void 0, callback);
  16272. const doValidateField = async (props2 = []) => {
  16273. if (!isValidatable.value)
  16274. return false;
  16275. const fields2 = obtainValidateFields(props2);
  16276. if (fields2.length === 0)
  16277. return true;
  16278. let validationErrors = {};
  16279. for (const field of fields2) {
  16280. try {
  16281. await field.validate("");
  16282. } catch (fields3) {
  16283. validationErrors = __spreadValues(__spreadValues({}, validationErrors), fields3);
  16284. }
  16285. }
  16286. if (Object.keys(validationErrors).length === 0)
  16287. return true;
  16288. return Promise.reject(validationErrors);
  16289. };
  16290. const validateField = async (modelProps = [], callback) => {
  16291. const shouldThrow = !isFunction(callback);
  16292. try {
  16293. const result = await doValidateField(modelProps);
  16294. if (result === true) {
  16295. callback == null ? void 0 : callback(result);
  16296. }
  16297. return result;
  16298. } catch (e) {
  16299. const invalidFields = e;
  16300. if (props.scrollToError) {
  16301. scrollToField(Object.keys(invalidFields)[0]);
  16302. }
  16303. callback == null ? void 0 : callback(false, invalidFields);
  16304. return shouldThrow && Promise.reject(invalidFields);
  16305. }
  16306. };
  16307. const scrollToField = (prop) => {
  16308. var _a2;
  16309. const field = filterFields(fields, prop)[0];
  16310. if (field) {
  16311. (_a2 = field.$el) == null ? void 0 : _a2.scrollIntoView();
  16312. }
  16313. };
  16314. watch(() => props.rules, () => {
  16315. if (props.validateOnRuleChange)
  16316. validate();
  16317. }, { deep: true });
  16318. provide(formContextKey, reactive(__spreadValues(__spreadProps(__spreadValues({}, toRefs(props)), {
  16319. emit,
  16320. resetFields,
  16321. clearValidate,
  16322. validateField,
  16323. addField,
  16324. removeField
  16325. }), useFormLabelWidth())));
  16326. expose({
  16327. validate,
  16328. validateField,
  16329. resetFields,
  16330. clearValidate,
  16331. scrollToField
  16332. });
  16333. return (_ctx, _cache) => {
  16334. return openBlock(), createElementBlock("form", {
  16335. class: normalizeClass(unref(formClasses))
  16336. }, [
  16337. renderSlot(_ctx.$slots, "default")
  16338. ], 2);
  16339. };
  16340. }
  16341. }));
  16342. var Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);
  16343. function _extends$1() {
  16344. _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
  16345. for (var i = 1; i < arguments.length; i++) {
  16346. var source = arguments[i];
  16347. for (var key in source) {
  16348. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16349. target[key] = source[key];
  16350. }
  16351. }
  16352. }
  16353. return target;
  16354. };
  16355. return _extends$1.apply(this, arguments);
  16356. }
  16357. function _inheritsLoose(subClass, superClass) {
  16358. subClass.prototype = Object.create(superClass.prototype);
  16359. subClass.prototype.constructor = subClass;
  16360. _setPrototypeOf(subClass, superClass);
  16361. }
  16362. function _getPrototypeOf(o2) {
  16363. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
  16364. return o3.__proto__ || Object.getPrototypeOf(o3);
  16365. };
  16366. return _getPrototypeOf(o2);
  16367. }
  16368. function _setPrototypeOf(o2, p2) {
  16369. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
  16370. o3.__proto__ = p3;
  16371. return o3;
  16372. };
  16373. return _setPrototypeOf(o2, p2);
  16374. }
  16375. function _isNativeReflectConstruct() {
  16376. if (typeof Reflect === "undefined" || !Reflect.construct)
  16377. return false;
  16378. if (Reflect.construct.sham)
  16379. return false;
  16380. if (typeof Proxy === "function")
  16381. return true;
  16382. try {
  16383. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  16384. }));
  16385. return true;
  16386. } catch (e) {
  16387. return false;
  16388. }
  16389. }
  16390. function _construct(Parent, args, Class) {
  16391. if (_isNativeReflectConstruct()) {
  16392. _construct = Reflect.construct.bind();
  16393. } else {
  16394. _construct = function _construct2(Parent2, args2, Class2) {
  16395. var a2 = [null];
  16396. a2.push.apply(a2, args2);
  16397. var Constructor = Function.bind.apply(Parent2, a2);
  16398. var instance = new Constructor();
  16399. if (Class2)
  16400. _setPrototypeOf(instance, Class2.prototype);
  16401. return instance;
  16402. };
  16403. }
  16404. return _construct.apply(null, arguments);
  16405. }
  16406. function _isNativeFunction(fn2) {
  16407. return Function.toString.call(fn2).indexOf("[native code]") !== -1;
  16408. }
  16409. function _wrapNativeSuper(Class) {
  16410. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  16411. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  16412. if (Class2 === null || !_isNativeFunction(Class2))
  16413. return Class2;
  16414. if (typeof Class2 !== "function") {
  16415. throw new TypeError("Super expression must either be null or a function");
  16416. }
  16417. if (typeof _cache !== "undefined") {
  16418. if (_cache.has(Class2))
  16419. return _cache.get(Class2);
  16420. _cache.set(Class2, Wrapper);
  16421. }
  16422. function Wrapper() {
  16423. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  16424. }
  16425. Wrapper.prototype = Object.create(Class2.prototype, {
  16426. constructor: {
  16427. value: Wrapper,
  16428. enumerable: false,
  16429. writable: true,
  16430. configurable: true
  16431. }
  16432. });
  16433. return _setPrototypeOf(Wrapper, Class2);
  16434. };
  16435. return _wrapNativeSuper(Class);
  16436. }
  16437. var formatRegExp = /%[sdj%]/g;
  16438. var warning = function warning2() {
  16439. };
  16440. if (typeof process !== "undefined" && process.env && false) {
  16441. warning = function warning3(type4, errors) {
  16442. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  16443. if (errors.every(function(e) {
  16444. return typeof e === "string";
  16445. })) {
  16446. console.warn(type4, errors);
  16447. }
  16448. }
  16449. };
  16450. }
  16451. function convertFieldsError(errors) {
  16452. if (!errors || !errors.length)
  16453. return null;
  16454. var fields = {};
  16455. errors.forEach(function(error) {
  16456. var field = error.field;
  16457. fields[field] = fields[field] || [];
  16458. fields[field].push(error);
  16459. });
  16460. return fields;
  16461. }
  16462. function format(template) {
  16463. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  16464. args[_key - 1] = arguments[_key];
  16465. }
  16466. var i = 0;
  16467. var len = args.length;
  16468. if (typeof template === "function") {
  16469. return template.apply(null, args);
  16470. }
  16471. if (typeof template === "string") {
  16472. var str = template.replace(formatRegExp, function(x2) {
  16473. if (x2 === "%%") {
  16474. return "%";
  16475. }
  16476. if (i >= len) {
  16477. return x2;
  16478. }
  16479. switch (x2) {
  16480. case "%s":
  16481. return String(args[i++]);
  16482. case "%d":
  16483. return Number(args[i++]);
  16484. case "%j":
  16485. try {
  16486. return JSON.stringify(args[i++]);
  16487. } catch (_2) {
  16488. return "[Circular]";
  16489. }
  16490. break;
  16491. default:
  16492. return x2;
  16493. }
  16494. });
  16495. return str;
  16496. }
  16497. return template;
  16498. }
  16499. function isNativeStringType(type4) {
  16500. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  16501. }
  16502. function isEmptyValue(value, type4) {
  16503. if (value === void 0 || value === null) {
  16504. return true;
  16505. }
  16506. if (type4 === "array" && Array.isArray(value) && !value.length) {
  16507. return true;
  16508. }
  16509. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  16510. return true;
  16511. }
  16512. return false;
  16513. }
  16514. function asyncParallelArray(arr, func, callback) {
  16515. var results = [];
  16516. var total2 = 0;
  16517. var arrLength = arr.length;
  16518. function count(errors) {
  16519. results.push.apply(results, errors || []);
  16520. total2++;
  16521. if (total2 === arrLength) {
  16522. callback(results);
  16523. }
  16524. }
  16525. arr.forEach(function(a2) {
  16526. func(a2, count);
  16527. });
  16528. }
  16529. function asyncSerialArray(arr, func, callback) {
  16530. var index = 0;
  16531. var arrLength = arr.length;
  16532. function next(errors) {
  16533. if (errors && errors.length) {
  16534. callback(errors);
  16535. return;
  16536. }
  16537. var original = index;
  16538. index = index + 1;
  16539. if (original < arrLength) {
  16540. func(arr[original], next);
  16541. } else {
  16542. callback([]);
  16543. }
  16544. }
  16545. next([]);
  16546. }
  16547. function flattenObjArr(objArr) {
  16548. var ret = [];
  16549. Object.keys(objArr).forEach(function(k) {
  16550. ret.push.apply(ret, objArr[k] || []);
  16551. });
  16552. return ret;
  16553. }
  16554. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  16555. _inheritsLoose(AsyncValidationError2, _Error);
  16556. function AsyncValidationError2(errors, fields) {
  16557. var _this;
  16558. _this = _Error.call(this, "Async Validation Error") || this;
  16559. _this.errors = errors;
  16560. _this.fields = fields;
  16561. return _this;
  16562. }
  16563. return AsyncValidationError2;
  16564. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  16565. function asyncMap(objArr, option, func, callback, source) {
  16566. if (option.first) {
  16567. var _pending = new Promise(function(resolve, reject) {
  16568. var next = function next2(errors) {
  16569. callback(errors);
  16570. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  16571. };
  16572. var flattenArr = flattenObjArr(objArr);
  16573. asyncSerialArray(flattenArr, func, next);
  16574. });
  16575. _pending["catch"](function(e) {
  16576. return e;
  16577. });
  16578. return _pending;
  16579. }
  16580. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  16581. var objArrKeys = Object.keys(objArr);
  16582. var objArrLength = objArrKeys.length;
  16583. var total2 = 0;
  16584. var results = [];
  16585. var pending = new Promise(function(resolve, reject) {
  16586. var next = function next2(errors) {
  16587. results.push.apply(results, errors);
  16588. total2++;
  16589. if (total2 === objArrLength) {
  16590. callback(results);
  16591. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  16592. }
  16593. };
  16594. if (!objArrKeys.length) {
  16595. callback(results);
  16596. resolve(source);
  16597. }
  16598. objArrKeys.forEach(function(key) {
  16599. var arr = objArr[key];
  16600. if (firstFields.indexOf(key) !== -1) {
  16601. asyncSerialArray(arr, func, next);
  16602. } else {
  16603. asyncParallelArray(arr, func, next);
  16604. }
  16605. });
  16606. });
  16607. pending["catch"](function(e) {
  16608. return e;
  16609. });
  16610. return pending;
  16611. }
  16612. function isErrorObj(obj) {
  16613. return !!(obj && obj.message !== void 0);
  16614. }
  16615. function getValue(value, path) {
  16616. var v2 = value;
  16617. for (var i = 0; i < path.length; i++) {
  16618. if (v2 == void 0) {
  16619. return v2;
  16620. }
  16621. v2 = v2[path[i]];
  16622. }
  16623. return v2;
  16624. }
  16625. function complementError(rule, source) {
  16626. return function(oe) {
  16627. var fieldValue;
  16628. if (rule.fullFields) {
  16629. fieldValue = getValue(source, rule.fullFields);
  16630. } else {
  16631. fieldValue = source[oe.field || rule.fullField];
  16632. }
  16633. if (isErrorObj(oe)) {
  16634. oe.field = oe.field || rule.fullField;
  16635. oe.fieldValue = fieldValue;
  16636. return oe;
  16637. }
  16638. return {
  16639. message: typeof oe === "function" ? oe() : oe,
  16640. fieldValue,
  16641. field: oe.field || rule.fullField
  16642. };
  16643. };
  16644. }
  16645. function deepMerge(target, source) {
  16646. if (source) {
  16647. for (var s2 in source) {
  16648. if (source.hasOwnProperty(s2)) {
  16649. var value = source[s2];
  16650. if (typeof value === "object" && typeof target[s2] === "object") {
  16651. target[s2] = _extends$1({}, target[s2], value);
  16652. } else {
  16653. target[s2] = value;
  16654. }
  16655. }
  16656. }
  16657. }
  16658. return target;
  16659. }
  16660. var required$1 = function required(rule, value, source, errors, options, type4) {
  16661. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  16662. errors.push(format(options.messages.required, rule.fullField));
  16663. }
  16664. };
  16665. var whitespace = function whitespace2(rule, value, source, errors, options) {
  16666. if (/^\s+$/.test(value) || value === "") {
  16667. errors.push(format(options.messages.whitespace, rule.fullField));
  16668. }
  16669. };
  16670. var urlReg;
  16671. var getUrlRegex = function() {
  16672. if (urlReg) {
  16673. return urlReg;
  16674. }
  16675. var word = "[a-fA-F\\d:]";
  16676. var b2 = function b3(options) {
  16677. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  16678. };
  16679. var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
  16680. var v6seg = "[a-fA-F\\d]{1,4}";
  16681. var v6 = ("\n(?:\n(?:" + v6seg + ":){7}(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
  16682. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  16683. var v4exact = new RegExp("^" + v4 + "$");
  16684. var v6exact = new RegExp("^" + v6 + "$");
  16685. var ip = function ip2(options) {
  16686. return options && options.exact ? v46Exact : new RegExp("(?:" + b2(options) + v4 + b2(options) + ")|(?:" + b2(options) + v6 + b2(options) + ")", "g");
  16687. };
  16688. ip.v4 = function(options) {
  16689. return options && options.exact ? v4exact : new RegExp("" + b2(options) + v4 + b2(options), "g");
  16690. };
  16691. ip.v6 = function(options) {
  16692. return options && options.exact ? v6exact : new RegExp("" + b2(options) + v6 + b2(options), "g");
  16693. };
  16694. var protocol = "(?:(?:[a-z]+:)?//)";
  16695. var auth = "(?:\\S+(?::\\S*)?@)?";
  16696. var ipv4 = ip.v4().source;
  16697. var ipv6 = ip.v6().source;
  16698. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  16699. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  16700. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  16701. var port = "(?::\\d{2,5})?";
  16702. var path = '(?:[/?#][^\\s"]*)?';
  16703. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  16704. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  16705. return urlReg;
  16706. };
  16707. var pattern$2 = {
  16708. 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,}))$/,
  16709. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  16710. };
  16711. var types = {
  16712. integer: function integer(value) {
  16713. return types.number(value) && parseInt(value, 10) === value;
  16714. },
  16715. "float": function float(value) {
  16716. return types.number(value) && !types.integer(value);
  16717. },
  16718. array: function array(value) {
  16719. return Array.isArray(value);
  16720. },
  16721. regexp: function regexp(value) {
  16722. if (value instanceof RegExp) {
  16723. return true;
  16724. }
  16725. try {
  16726. return !!new RegExp(value);
  16727. } catch (e) {
  16728. return false;
  16729. }
  16730. },
  16731. date: function date(value) {
  16732. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  16733. },
  16734. number: function number(value) {
  16735. if (isNaN(value)) {
  16736. return false;
  16737. }
  16738. return typeof value === "number";
  16739. },
  16740. object: function object(value) {
  16741. return typeof value === "object" && !types.array(value);
  16742. },
  16743. method: function method(value) {
  16744. return typeof value === "function";
  16745. },
  16746. email: function email(value) {
  16747. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  16748. },
  16749. url: function url(value) {
  16750. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  16751. },
  16752. hex: function hex(value) {
  16753. return typeof value === "string" && !!value.match(pattern$2.hex);
  16754. }
  16755. };
  16756. var type$1 = function type(rule, value, source, errors, options) {
  16757. if (rule.required && value === void 0) {
  16758. required$1(rule, value, source, errors, options);
  16759. return;
  16760. }
  16761. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  16762. var ruleType = rule.type;
  16763. if (custom.indexOf(ruleType) > -1) {
  16764. if (!types[ruleType](value)) {
  16765. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16766. }
  16767. } else if (ruleType && typeof value !== rule.type) {
  16768. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  16769. }
  16770. };
  16771. var range = function range2(rule, value, source, errors, options) {
  16772. var len = typeof rule.len === "number";
  16773. var min2 = typeof rule.min === "number";
  16774. var max2 = typeof rule.max === "number";
  16775. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  16776. var val = value;
  16777. var key = null;
  16778. var num = typeof value === "number";
  16779. var str = typeof value === "string";
  16780. var arr = Array.isArray(value);
  16781. if (num) {
  16782. key = "number";
  16783. } else if (str) {
  16784. key = "string";
  16785. } else if (arr) {
  16786. key = "array";
  16787. }
  16788. if (!key) {
  16789. return false;
  16790. }
  16791. if (arr) {
  16792. val = value.length;
  16793. }
  16794. if (str) {
  16795. val = value.replace(spRegexp, "_").length;
  16796. }
  16797. if (len) {
  16798. if (val !== rule.len) {
  16799. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  16800. }
  16801. } else if (min2 && !max2 && val < rule.min) {
  16802. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  16803. } else if (max2 && !min2 && val > rule.max) {
  16804. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  16805. } else if (min2 && max2 && (val < rule.min || val > rule.max)) {
  16806. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  16807. }
  16808. };
  16809. var ENUM$1 = "enum";
  16810. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  16811. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  16812. if (rule[ENUM$1].indexOf(value) === -1) {
  16813. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  16814. }
  16815. };
  16816. var pattern$1 = function pattern(rule, value, source, errors, options) {
  16817. if (rule.pattern) {
  16818. if (rule.pattern instanceof RegExp) {
  16819. rule.pattern.lastIndex = 0;
  16820. if (!rule.pattern.test(value)) {
  16821. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16822. }
  16823. } else if (typeof rule.pattern === "string") {
  16824. var _pattern = new RegExp(rule.pattern);
  16825. if (!_pattern.test(value)) {
  16826. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  16827. }
  16828. }
  16829. }
  16830. };
  16831. var rules = {
  16832. required: required$1,
  16833. whitespace,
  16834. type: type$1,
  16835. range,
  16836. "enum": enumerable$1,
  16837. pattern: pattern$1
  16838. };
  16839. var string = function string2(rule, value, callback, source, options) {
  16840. var errors = [];
  16841. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16842. if (validate) {
  16843. if (isEmptyValue(value, "string") && !rule.required) {
  16844. return callback();
  16845. }
  16846. rules.required(rule, value, source, errors, options, "string");
  16847. if (!isEmptyValue(value, "string")) {
  16848. rules.type(rule, value, source, errors, options);
  16849. rules.range(rule, value, source, errors, options);
  16850. rules.pattern(rule, value, source, errors, options);
  16851. if (rule.whitespace === true) {
  16852. rules.whitespace(rule, value, source, errors, options);
  16853. }
  16854. }
  16855. }
  16856. callback(errors);
  16857. };
  16858. var method2 = function method3(rule, value, callback, source, options) {
  16859. var errors = [];
  16860. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16861. if (validate) {
  16862. if (isEmptyValue(value) && !rule.required) {
  16863. return callback();
  16864. }
  16865. rules.required(rule, value, source, errors, options);
  16866. if (value !== void 0) {
  16867. rules.type(rule, value, source, errors, options);
  16868. }
  16869. }
  16870. callback(errors);
  16871. };
  16872. var number2 = function number3(rule, value, callback, source, options) {
  16873. var errors = [];
  16874. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16875. if (validate) {
  16876. if (value === "") {
  16877. value = void 0;
  16878. }
  16879. if (isEmptyValue(value) && !rule.required) {
  16880. return callback();
  16881. }
  16882. rules.required(rule, value, source, errors, options);
  16883. if (value !== void 0) {
  16884. rules.type(rule, value, source, errors, options);
  16885. rules.range(rule, value, source, errors, options);
  16886. }
  16887. }
  16888. callback(errors);
  16889. };
  16890. var _boolean = function _boolean2(rule, value, callback, source, options) {
  16891. var errors = [];
  16892. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16893. if (validate) {
  16894. if (isEmptyValue(value) && !rule.required) {
  16895. return callback();
  16896. }
  16897. rules.required(rule, value, source, errors, options);
  16898. if (value !== void 0) {
  16899. rules.type(rule, value, source, errors, options);
  16900. }
  16901. }
  16902. callback(errors);
  16903. };
  16904. var regexp2 = function regexp3(rule, value, callback, source, options) {
  16905. var errors = [];
  16906. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16907. if (validate) {
  16908. if (isEmptyValue(value) && !rule.required) {
  16909. return callback();
  16910. }
  16911. rules.required(rule, value, source, errors, options);
  16912. if (!isEmptyValue(value)) {
  16913. rules.type(rule, value, source, errors, options);
  16914. }
  16915. }
  16916. callback(errors);
  16917. };
  16918. var integer2 = function integer3(rule, value, callback, source, options) {
  16919. var errors = [];
  16920. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16921. if (validate) {
  16922. if (isEmptyValue(value) && !rule.required) {
  16923. return callback();
  16924. }
  16925. rules.required(rule, value, source, errors, options);
  16926. if (value !== void 0) {
  16927. rules.type(rule, value, source, errors, options);
  16928. rules.range(rule, value, source, errors, options);
  16929. }
  16930. }
  16931. callback(errors);
  16932. };
  16933. var floatFn = function floatFn2(rule, value, callback, source, options) {
  16934. var errors = [];
  16935. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16936. if (validate) {
  16937. if (isEmptyValue(value) && !rule.required) {
  16938. return callback();
  16939. }
  16940. rules.required(rule, value, source, errors, options);
  16941. if (value !== void 0) {
  16942. rules.type(rule, value, source, errors, options);
  16943. rules.range(rule, value, source, errors, options);
  16944. }
  16945. }
  16946. callback(errors);
  16947. };
  16948. var array2 = function array3(rule, value, callback, source, options) {
  16949. var errors = [];
  16950. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16951. if (validate) {
  16952. if ((value === void 0 || value === null) && !rule.required) {
  16953. return callback();
  16954. }
  16955. rules.required(rule, value, source, errors, options, "array");
  16956. if (value !== void 0 && value !== null) {
  16957. rules.type(rule, value, source, errors, options);
  16958. rules.range(rule, value, source, errors, options);
  16959. }
  16960. }
  16961. callback(errors);
  16962. };
  16963. var object2 = function object3(rule, value, callback, source, options) {
  16964. var errors = [];
  16965. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16966. if (validate) {
  16967. if (isEmptyValue(value) && !rule.required) {
  16968. return callback();
  16969. }
  16970. rules.required(rule, value, source, errors, options);
  16971. if (value !== void 0) {
  16972. rules.type(rule, value, source, errors, options);
  16973. }
  16974. }
  16975. callback(errors);
  16976. };
  16977. var ENUM = "enum";
  16978. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  16979. var errors = [];
  16980. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16981. if (validate) {
  16982. if (isEmptyValue(value) && !rule.required) {
  16983. return callback();
  16984. }
  16985. rules.required(rule, value, source, errors, options);
  16986. if (value !== void 0) {
  16987. rules[ENUM](rule, value, source, errors, options);
  16988. }
  16989. }
  16990. callback(errors);
  16991. };
  16992. var pattern2 = function pattern3(rule, value, callback, source, options) {
  16993. var errors = [];
  16994. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  16995. if (validate) {
  16996. if (isEmptyValue(value, "string") && !rule.required) {
  16997. return callback();
  16998. }
  16999. rules.required(rule, value, source, errors, options);
  17000. if (!isEmptyValue(value, "string")) {
  17001. rules.pattern(rule, value, source, errors, options);
  17002. }
  17003. }
  17004. callback(errors);
  17005. };
  17006. var date2 = function date3(rule, value, callback, source, options) {
  17007. var errors = [];
  17008. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  17009. if (validate) {
  17010. if (isEmptyValue(value, "date") && !rule.required) {
  17011. return callback();
  17012. }
  17013. rules.required(rule, value, source, errors, options);
  17014. if (!isEmptyValue(value, "date")) {
  17015. var dateObject;
  17016. if (value instanceof Date) {
  17017. dateObject = value;
  17018. } else {
  17019. dateObject = new Date(value);
  17020. }
  17021. rules.type(rule, dateObject, source, errors, options);
  17022. if (dateObject) {
  17023. rules.range(rule, dateObject.getTime(), source, errors, options);
  17024. }
  17025. }
  17026. }
  17027. callback(errors);
  17028. };
  17029. var required2 = function required3(rule, value, callback, source, options) {
  17030. var errors = [];
  17031. var type4 = Array.isArray(value) ? "array" : typeof value;
  17032. rules.required(rule, value, source, errors, options, type4);
  17033. callback(errors);
  17034. };
  17035. var type2 = function type3(rule, value, callback, source, options) {
  17036. var ruleType = rule.type;
  17037. var errors = [];
  17038. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  17039. if (validate) {
  17040. if (isEmptyValue(value, ruleType) && !rule.required) {
  17041. return callback();
  17042. }
  17043. rules.required(rule, value, source, errors, options, ruleType);
  17044. if (!isEmptyValue(value, ruleType)) {
  17045. rules.type(rule, value, source, errors, options);
  17046. }
  17047. }
  17048. callback(errors);
  17049. };
  17050. var any = function any2(rule, value, callback, source, options) {
  17051. var errors = [];
  17052. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  17053. if (validate) {
  17054. if (isEmptyValue(value) && !rule.required) {
  17055. return callback();
  17056. }
  17057. rules.required(rule, value, source, errors, options);
  17058. }
  17059. callback(errors);
  17060. };
  17061. var validators = {
  17062. string,
  17063. method: method2,
  17064. number: number2,
  17065. "boolean": _boolean,
  17066. regexp: regexp2,
  17067. integer: integer2,
  17068. "float": floatFn,
  17069. array: array2,
  17070. object: object2,
  17071. "enum": enumerable2,
  17072. pattern: pattern2,
  17073. date: date2,
  17074. url: type2,
  17075. hex: type2,
  17076. email: type2,
  17077. required: required2,
  17078. any
  17079. };
  17080. function newMessages() {
  17081. return {
  17082. "default": "Validation error on field %s",
  17083. required: "%s is required",
  17084. "enum": "%s must be one of %s",
  17085. whitespace: "%s cannot be empty",
  17086. date: {
  17087. format: "%s date %s is invalid for format %s",
  17088. parse: "%s date could not be parsed, %s is invalid ",
  17089. invalid: "%s date %s is invalid"
  17090. },
  17091. types: {
  17092. string: "%s is not a %s",
  17093. method: "%s is not a %s (function)",
  17094. array: "%s is not an %s",
  17095. object: "%s is not an %s",
  17096. number: "%s is not a %s",
  17097. date: "%s is not a %s",
  17098. "boolean": "%s is not a %s",
  17099. integer: "%s is not an %s",
  17100. "float": "%s is not a %s",
  17101. regexp: "%s is not a valid %s",
  17102. email: "%s is not a valid %s",
  17103. url: "%s is not a valid %s",
  17104. hex: "%s is not a valid %s"
  17105. },
  17106. string: {
  17107. len: "%s must be exactly %s characters",
  17108. min: "%s must be at least %s characters",
  17109. max: "%s cannot be longer than %s characters",
  17110. range: "%s must be between %s and %s characters"
  17111. },
  17112. number: {
  17113. len: "%s must equal %s",
  17114. min: "%s cannot be less than %s",
  17115. max: "%s cannot be greater than %s",
  17116. range: "%s must be between %s and %s"
  17117. },
  17118. array: {
  17119. len: "%s must be exactly %s in length",
  17120. min: "%s cannot be less than %s in length",
  17121. max: "%s cannot be greater than %s in length",
  17122. range: "%s must be between %s and %s in length"
  17123. },
  17124. pattern: {
  17125. mismatch: "%s value %s does not match pattern %s"
  17126. },
  17127. clone: function clone2() {
  17128. var cloned = JSON.parse(JSON.stringify(this));
  17129. cloned.clone = this.clone;
  17130. return cloned;
  17131. }
  17132. };
  17133. }
  17134. var messages = newMessages();
  17135. var Schema = /* @__PURE__ */ function() {
  17136. function Schema2(descriptor) {
  17137. this.rules = null;
  17138. this._messages = messages;
  17139. this.define(descriptor);
  17140. }
  17141. var _proto = Schema2.prototype;
  17142. _proto.define = function define(rules2) {
  17143. var _this = this;
  17144. if (!rules2) {
  17145. throw new Error("Cannot configure a schema with no rules");
  17146. }
  17147. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  17148. throw new Error("Rules must be an object");
  17149. }
  17150. this.rules = {};
  17151. Object.keys(rules2).forEach(function(name) {
  17152. var item = rules2[name];
  17153. _this.rules[name] = Array.isArray(item) ? item : [item];
  17154. });
  17155. };
  17156. _proto.messages = function messages2(_messages) {
  17157. if (_messages) {
  17158. this._messages = deepMerge(newMessages(), _messages);
  17159. }
  17160. return this._messages;
  17161. };
  17162. _proto.validate = function validate(source_, o2, oc) {
  17163. var _this2 = this;
  17164. if (o2 === void 0) {
  17165. o2 = {};
  17166. }
  17167. if (oc === void 0) {
  17168. oc = function oc2() {
  17169. };
  17170. }
  17171. var source = source_;
  17172. var options = o2;
  17173. var callback = oc;
  17174. if (typeof options === "function") {
  17175. callback = options;
  17176. options = {};
  17177. }
  17178. if (!this.rules || Object.keys(this.rules).length === 0) {
  17179. if (callback) {
  17180. callback(null, source);
  17181. }
  17182. return Promise.resolve(source);
  17183. }
  17184. function complete(results) {
  17185. var errors = [];
  17186. var fields = {};
  17187. function add(e) {
  17188. if (Array.isArray(e)) {
  17189. var _errors;
  17190. errors = (_errors = errors).concat.apply(_errors, e);
  17191. } else {
  17192. errors.push(e);
  17193. }
  17194. }
  17195. for (var i = 0; i < results.length; i++) {
  17196. add(results[i]);
  17197. }
  17198. if (!errors.length) {
  17199. callback(null, source);
  17200. } else {
  17201. fields = convertFieldsError(errors);
  17202. callback(errors, fields);
  17203. }
  17204. }
  17205. if (options.messages) {
  17206. var messages$1 = this.messages();
  17207. if (messages$1 === messages) {
  17208. messages$1 = newMessages();
  17209. }
  17210. deepMerge(messages$1, options.messages);
  17211. options.messages = messages$1;
  17212. } else {
  17213. options.messages = this.messages();
  17214. }
  17215. var series = {};
  17216. var keys2 = options.keys || Object.keys(this.rules);
  17217. keys2.forEach(function(z) {
  17218. var arr = _this2.rules[z];
  17219. var value = source[z];
  17220. arr.forEach(function(r) {
  17221. var rule = r;
  17222. if (typeof rule.transform === "function") {
  17223. if (source === source_) {
  17224. source = _extends$1({}, source);
  17225. }
  17226. value = source[z] = rule.transform(value);
  17227. }
  17228. if (typeof rule === "function") {
  17229. rule = {
  17230. validator: rule
  17231. };
  17232. } else {
  17233. rule = _extends$1({}, rule);
  17234. }
  17235. rule.validator = _this2.getValidationMethod(rule);
  17236. if (!rule.validator) {
  17237. return;
  17238. }
  17239. rule.field = z;
  17240. rule.fullField = rule.fullField || z;
  17241. rule.type = _this2.getType(rule);
  17242. series[z] = series[z] || [];
  17243. series[z].push({
  17244. rule,
  17245. value,
  17246. source,
  17247. field: z
  17248. });
  17249. });
  17250. });
  17251. var errorFields = {};
  17252. return asyncMap(series, options, function(data2, doIt) {
  17253. var rule = data2.rule;
  17254. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  17255. deep = deep && (rule.required || !rule.required && data2.value);
  17256. rule.field = data2.field;
  17257. function addFullField(key, schema) {
  17258. return _extends$1({}, schema, {
  17259. fullField: rule.fullField + "." + key,
  17260. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  17261. });
  17262. }
  17263. function cb(e) {
  17264. if (e === void 0) {
  17265. e = [];
  17266. }
  17267. var errorList = Array.isArray(e) ? e : [e];
  17268. if (!options.suppressWarning && errorList.length) {
  17269. Schema2.warning("async-validator:", errorList);
  17270. }
  17271. if (errorList.length && rule.message !== void 0) {
  17272. errorList = [].concat(rule.message);
  17273. }
  17274. var filledErrors = errorList.map(complementError(rule, source));
  17275. if (options.first && filledErrors.length) {
  17276. errorFields[rule.field] = 1;
  17277. return doIt(filledErrors);
  17278. }
  17279. if (!deep) {
  17280. doIt(filledErrors);
  17281. } else {
  17282. if (rule.required && !data2.value) {
  17283. if (rule.message !== void 0) {
  17284. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  17285. } else if (options.error) {
  17286. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  17287. }
  17288. return doIt(filledErrors);
  17289. }
  17290. var fieldsSchema = {};
  17291. if (rule.defaultField) {
  17292. Object.keys(data2.value).map(function(key) {
  17293. fieldsSchema[key] = rule.defaultField;
  17294. });
  17295. }
  17296. fieldsSchema = _extends$1({}, fieldsSchema, data2.rule.fields);
  17297. var paredFieldsSchema = {};
  17298. Object.keys(fieldsSchema).forEach(function(field) {
  17299. var fieldSchema = fieldsSchema[field];
  17300. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  17301. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  17302. });
  17303. var schema = new Schema2(paredFieldsSchema);
  17304. schema.messages(options.messages);
  17305. if (data2.rule.options) {
  17306. data2.rule.options.messages = options.messages;
  17307. data2.rule.options.error = options.error;
  17308. }
  17309. schema.validate(data2.value, data2.rule.options || options, function(errs) {
  17310. var finalErrors = [];
  17311. if (filledErrors && filledErrors.length) {
  17312. finalErrors.push.apply(finalErrors, filledErrors);
  17313. }
  17314. if (errs && errs.length) {
  17315. finalErrors.push.apply(finalErrors, errs);
  17316. }
  17317. doIt(finalErrors.length ? finalErrors : null);
  17318. });
  17319. }
  17320. }
  17321. var res;
  17322. if (rule.asyncValidator) {
  17323. res = rule.asyncValidator(rule, data2.value, cb, data2.source, options);
  17324. } else if (rule.validator) {
  17325. try {
  17326. res = rule.validator(rule, data2.value, cb, data2.source, options);
  17327. } catch (error) {
  17328. console.error == null ? void 0 : console.error(error);
  17329. if (!options.suppressValidatorError) {
  17330. setTimeout(function() {
  17331. throw error;
  17332. }, 0);
  17333. }
  17334. cb(error.message);
  17335. }
  17336. if (res === true) {
  17337. cb();
  17338. } else if (res === false) {
  17339. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  17340. } else if (res instanceof Array) {
  17341. cb(res);
  17342. } else if (res instanceof Error) {
  17343. cb(res.message);
  17344. }
  17345. }
  17346. if (res && res.then) {
  17347. res.then(function() {
  17348. return cb();
  17349. }, function(e) {
  17350. return cb(e);
  17351. });
  17352. }
  17353. }, function(results) {
  17354. complete(results);
  17355. }, source);
  17356. };
  17357. _proto.getType = function getType(rule) {
  17358. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  17359. rule.type = "pattern";
  17360. }
  17361. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  17362. throw new Error(format("Unknown rule type %s", rule.type));
  17363. }
  17364. return rule.type || "string";
  17365. };
  17366. _proto.getValidationMethod = function getValidationMethod(rule) {
  17367. if (typeof rule.validator === "function") {
  17368. return rule.validator;
  17369. }
  17370. var keys2 = Object.keys(rule);
  17371. var messageIndex = keys2.indexOf("message");
  17372. if (messageIndex !== -1) {
  17373. keys2.splice(messageIndex, 1);
  17374. }
  17375. if (keys2.length === 1 && keys2[0] === "required") {
  17376. return validators.required;
  17377. }
  17378. return validators[this.getType(rule)] || void 0;
  17379. };
  17380. return Schema2;
  17381. }();
  17382. Schema.register = function register(type4, validator) {
  17383. if (typeof validator !== "function") {
  17384. throw new Error("Cannot register a validator by type, validator is not a function");
  17385. }
  17386. validators[type4] = validator;
  17387. };
  17388. Schema.warning = warning;
  17389. Schema.messages = messages;
  17390. Schema.validators = validators;
  17391. const formItemValidateStates = [
  17392. "",
  17393. "error",
  17394. "validating",
  17395. "success"
  17396. ];
  17397. const formItemProps = buildProps({
  17398. label: String,
  17399. labelWidth: {
  17400. type: [String, Number],
  17401. default: ""
  17402. },
  17403. prop: {
  17404. type: definePropType([String, Array])
  17405. },
  17406. required: {
  17407. type: Boolean,
  17408. default: void 0
  17409. },
  17410. rules: {
  17411. type: definePropType([Object, Array])
  17412. },
  17413. error: String,
  17414. validateStatus: {
  17415. type: String,
  17416. values: formItemValidateStates
  17417. },
  17418. for: String,
  17419. inlineMessage: {
  17420. type: [String, Boolean],
  17421. default: ""
  17422. },
  17423. showMessage: {
  17424. type: Boolean,
  17425. default: true
  17426. },
  17427. size: {
  17428. type: String,
  17429. values: componentSizes
  17430. }
  17431. });
  17432. const COMPONENT_NAME$3 = "ElLabelWrap";
  17433. var FormLabelWrap = defineComponent({
  17434. name: COMPONENT_NAME$3,
  17435. props: {
  17436. isAutoWidth: Boolean,
  17437. updateAll: Boolean
  17438. },
  17439. setup(props, {
  17440. slots
  17441. }) {
  17442. const formContext = inject(formContextKey, void 0);
  17443. const formItemContext = inject(formItemContextKey);
  17444. if (!formItemContext)
  17445. throwError(COMPONENT_NAME$3, "usage: <el-form-item><label-wrap /></el-form-item>");
  17446. const ns = useNamespace("form");
  17447. const el = ref();
  17448. const computedWidth = ref(0);
  17449. const getLabelWidth = () => {
  17450. var _a2;
  17451. if ((_a2 = el.value) == null ? void 0 : _a2.firstElementChild) {
  17452. const width = window.getComputedStyle(el.value.firstElementChild).width;
  17453. return Math.ceil(Number.parseFloat(width));
  17454. } else {
  17455. return 0;
  17456. }
  17457. };
  17458. const updateLabelWidth = (action = "update") => {
  17459. nextTick(() => {
  17460. if (slots.default && props.isAutoWidth) {
  17461. if (action === "update") {
  17462. computedWidth.value = getLabelWidth();
  17463. } else if (action === "remove") {
  17464. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  17465. }
  17466. }
  17467. });
  17468. };
  17469. const updateLabelWidthFn = () => updateLabelWidth("update");
  17470. onMounted(() => {
  17471. updateLabelWidthFn();
  17472. });
  17473. onBeforeUnmount(() => {
  17474. updateLabelWidth("remove");
  17475. });
  17476. onUpdated(() => updateLabelWidthFn());
  17477. watch(computedWidth, (val, oldVal) => {
  17478. if (props.updateAll) {
  17479. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  17480. }
  17481. });
  17482. useResizeObserver(computed(() => {
  17483. var _a2, _b2;
  17484. return (_b2 = (_a2 = el.value) == null ? void 0 : _a2.firstElementChild) != null ? _b2 : null;
  17485. }), updateLabelWidthFn);
  17486. return () => {
  17487. var _a2, _b2;
  17488. if (!slots)
  17489. return null;
  17490. const {
  17491. isAutoWidth
  17492. } = props;
  17493. if (isAutoWidth) {
  17494. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  17495. const style = {};
  17496. if (autoLabelWidth && autoLabelWidth !== "auto") {
  17497. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  17498. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  17499. if (marginWidth) {
  17500. style[marginPosition] = `${marginWidth}px`;
  17501. }
  17502. }
  17503. return createVNode("div", {
  17504. "ref": el,
  17505. "class": [ns.be("item", "label-wrap")],
  17506. "style": style
  17507. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
  17508. } else {
  17509. return createVNode(Fragment, {
  17510. "ref": el
  17511. }, [(_b2 = slots.default) == null ? void 0 : _b2.call(slots)]);
  17512. }
  17513. };
  17514. }
  17515. });
  17516. const _hoisted_1$m = ["for"];
  17517. const __default__$8 = {
  17518. name: "ElFormItem"
  17519. };
  17520. const _sfc_main$y = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
  17521. props: formItemProps,
  17522. setup(__props, { expose }) {
  17523. const props = __props;
  17524. const slots = useSlots();
  17525. const formContext = inject(formContextKey, void 0);
  17526. const parentFormItemContext = inject(formItemContextKey, void 0);
  17527. const _size = useSize(void 0, { formItem: false });
  17528. const ns = useNamespace("form-item");
  17529. const validateState = ref("");
  17530. const validateStateDebounced = refDebounced(validateState, 100);
  17531. const validateMessage = ref("");
  17532. const formItemRef = ref();
  17533. let initialValue = void 0;
  17534. let isResettingField = false;
  17535. const labelStyle = computed(() => {
  17536. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  17537. return {};
  17538. }
  17539. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17540. if (labelWidth)
  17541. return { width: labelWidth };
  17542. return {};
  17543. });
  17544. const contentStyle = computed(() => {
  17545. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  17546. return {};
  17547. }
  17548. if (!props.label && !props.labelWidth && isNested) {
  17549. return {};
  17550. }
  17551. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  17552. if (!props.label && !slots.label) {
  17553. return { marginLeft: labelWidth };
  17554. }
  17555. return {};
  17556. });
  17557. const formItemClasses = computed(() => [
  17558. ns.b(),
  17559. ns.m(_size.value),
  17560. ns.is("error", validateState.value === "error"),
  17561. ns.is("validating", validateState.value === "validating"),
  17562. ns.is("success", validateState.value === "success"),
  17563. ns.is("required", isRequired.value || props.required),
  17564. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  17565. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  17566. ]);
  17567. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  17568. const validateClasses = computed(() => [
  17569. ns.e("error"),
  17570. { [ns.em("error", "inline")]: _inlineMessage.value }
  17571. ]);
  17572. const propString = computed(() => {
  17573. if (!props.prop)
  17574. return "";
  17575. return isString(props.prop) ? props.prop : props.prop.join(".");
  17576. });
  17577. const labelFor = computed(() => props.for || propString.value);
  17578. const isNested = !!parentFormItemContext;
  17579. const fieldValue = computed(() => {
  17580. const model = formContext == null ? void 0 : formContext.model;
  17581. if (!model || !props.prop) {
  17582. return;
  17583. }
  17584. return getProp(model, props.prop).value;
  17585. });
  17586. const _rules = computed(() => {
  17587. const rules2 = props.rules ? castArray$1(props.rules) : [];
  17588. const formRules = formContext == null ? void 0 : formContext.rules;
  17589. if (formRules && props.prop) {
  17590. const _rules2 = getProp(formRules, props.prop).value;
  17591. if (_rules2) {
  17592. rules2.push(...castArray$1(_rules2));
  17593. }
  17594. }
  17595. if (props.required !== void 0) {
  17596. rules2.push({ required: !!props.required });
  17597. }
  17598. return rules2;
  17599. });
  17600. const validateEnabled = computed(() => _rules.value.length > 0);
  17601. const getFilteredRule = (trigger) => {
  17602. const rules2 = _rules.value;
  17603. return rules2.filter((rule) => {
  17604. if (!rule.trigger || !trigger)
  17605. return true;
  17606. if (Array.isArray(rule.trigger)) {
  17607. return rule.trigger.includes(trigger);
  17608. } else {
  17609. return rule.trigger === trigger;
  17610. }
  17611. }).map((_a2) => {
  17612. var _b2 = _a2, { trigger: trigger2 } = _b2, rule = __objRest(_b2, ["trigger"]);
  17613. return rule;
  17614. });
  17615. };
  17616. const isRequired = computed(() => _rules.value.some((rule) => rule.required === true));
  17617. const shouldShowError = computed(() => {
  17618. var _a2;
  17619. return validateStateDebounced.value === "error" && props.showMessage && ((_a2 = formContext == null ? void 0 : formContext.showMessage) != null ? _a2 : true);
  17620. });
  17621. const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  17622. const setValidationState = (state) => {
  17623. validateState.value = state;
  17624. };
  17625. const onValidationFailed = (error) => {
  17626. var _a2, _b2;
  17627. const { errors, fields } = error;
  17628. if (!errors || !fields) {
  17629. console.error(error);
  17630. }
  17631. setValidationState("error");
  17632. validateMessage.value = errors ? (_b2 = (_a2 = errors == null ? void 0 : errors[0]) == null ? void 0 : _a2.message) != null ? _b2 : `${props.prop} is required` : "";
  17633. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  17634. };
  17635. const onValidationSucceeded = () => {
  17636. setValidationState("success");
  17637. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  17638. };
  17639. const doValidate = async (rules2) => {
  17640. const modelName = propString.value;
  17641. const validator = new Schema({
  17642. [modelName]: rules2
  17643. });
  17644. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  17645. onValidationSucceeded();
  17646. return true;
  17647. }).catch((err) => {
  17648. onValidationFailed(err);
  17649. return Promise.reject(err);
  17650. });
  17651. };
  17652. const validate = async (trigger, callback) => {
  17653. if (isResettingField) {
  17654. isResettingField = false;
  17655. return false;
  17656. }
  17657. const hasCallback = isFunction(callback);
  17658. if (!validateEnabled.value) {
  17659. callback == null ? void 0 : callback(false);
  17660. return false;
  17661. }
  17662. const rules2 = getFilteredRule(trigger);
  17663. if (rules2.length === 0) {
  17664. callback == null ? void 0 : callback(true);
  17665. return true;
  17666. }
  17667. setValidationState("validating");
  17668. return doValidate(rules2).then(() => {
  17669. callback == null ? void 0 : callback(true);
  17670. return true;
  17671. }).catch((err) => {
  17672. const { fields } = err;
  17673. callback == null ? void 0 : callback(false, fields);
  17674. return hasCallback ? false : Promise.reject(fields);
  17675. });
  17676. };
  17677. const clearValidate = () => {
  17678. setValidationState("");
  17679. validateMessage.value = "";
  17680. };
  17681. const resetField = async () => {
  17682. const model = formContext == null ? void 0 : formContext.model;
  17683. if (!model || !props.prop)
  17684. return;
  17685. const computedValue = getProp(model, props.prop);
  17686. if (!isEqual$1(computedValue.value, initialValue)) {
  17687. isResettingField = true;
  17688. }
  17689. computedValue.value = initialValue;
  17690. await nextTick();
  17691. clearValidate();
  17692. };
  17693. watch(() => props.error, (val) => {
  17694. validateMessage.value = val || "";
  17695. setValidationState(val ? "error" : "");
  17696. }, { immediate: true });
  17697. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  17698. const context = reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  17699. $el: formItemRef,
  17700. size: _size,
  17701. validateState,
  17702. resetField,
  17703. clearValidate,
  17704. validate
  17705. }));
  17706. provide(formItemContextKey, context);
  17707. onMounted(() => {
  17708. if (props.prop) {
  17709. formContext == null ? void 0 : formContext.addField(context);
  17710. initialValue = clone(fieldValue.value);
  17711. }
  17712. });
  17713. onBeforeUnmount(() => {
  17714. formContext == null ? void 0 : formContext.removeField(context);
  17715. });
  17716. expose({
  17717. size: _size,
  17718. validateMessage,
  17719. validateState,
  17720. validate,
  17721. clearValidate,
  17722. resetField
  17723. });
  17724. return (_ctx, _cache) => {
  17725. var _a2;
  17726. return openBlock(), createElementBlock("div", {
  17727. ref_key: "formItemRef",
  17728. ref: formItemRef,
  17729. class: normalizeClass(unref(formItemClasses))
  17730. }, [
  17731. createVNode(unref(FormLabelWrap), {
  17732. "is-auto-width": unref(labelStyle).width === "auto",
  17733. "update-all": ((_a2 = unref(formContext)) == null ? void 0 : _a2.labelWidth) === "auto"
  17734. }, {
  17735. default: withCtx(() => [
  17736. _ctx.label || _ctx.$slots.label ? (openBlock(), createElementBlock("label", {
  17737. key: 0,
  17738. for: unref(labelFor),
  17739. class: normalizeClass(unref(ns).e("label")),
  17740. style: normalizeStyle(unref(labelStyle))
  17741. }, [
  17742. renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
  17743. createTextVNode(toDisplayString(unref(currentLabel)), 1)
  17744. ])
  17745. ], 14, _hoisted_1$m)) : createCommentVNode("v-if", true)
  17746. ]),
  17747. _: 3
  17748. }, 8, ["is-auto-width", "update-all"]),
  17749. createElementVNode("div", {
  17750. class: normalizeClass(unref(ns).e("content")),
  17751. style: normalizeStyle(unref(contentStyle))
  17752. }, [
  17753. renderSlot(_ctx.$slots, "default"),
  17754. createVNode(Transition, {
  17755. name: `${unref(ns).namespace.value}-zoom-in-top`
  17756. }, {
  17757. default: withCtx(() => [
  17758. unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
  17759. key: 0,
  17760. error: validateMessage.value
  17761. }, () => [
  17762. createElementVNode("div", {
  17763. class: normalizeClass(unref(validateClasses))
  17764. }, toDisplayString(validateMessage.value), 3)
  17765. ]) : createCommentVNode("v-if", true)
  17766. ]),
  17767. _: 3
  17768. }, 8, ["name"])
  17769. ], 6)
  17770. ], 2);
  17771. };
  17772. }
  17773. }));
  17774. var FormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form-item.vue"]]);
  17775. const ElForm = withInstall(Form, {
  17776. FormItem
  17777. });
  17778. const ElFormItem = withNoopInstall(FormItem);
  17779. const imageViewerProps = buildProps({
  17780. urlList: {
  17781. type: definePropType(Array),
  17782. default: () => mutable([])
  17783. },
  17784. zIndex: {
  17785. type: Number
  17786. },
  17787. initialIndex: {
  17788. type: Number,
  17789. default: 0
  17790. },
  17791. infinite: {
  17792. type: Boolean,
  17793. default: true
  17794. },
  17795. hideOnClickModal: {
  17796. type: Boolean,
  17797. default: false
  17798. },
  17799. teleported: {
  17800. type: Boolean,
  17801. default: false
  17802. }
  17803. });
  17804. const imageViewerEmits = {
  17805. close: () => true,
  17806. switch: (index) => typeof index === "number"
  17807. };
  17808. const _hoisted_1$l = ["src"];
  17809. const __default__$7 = {
  17810. name: "ElImageViewer"
  17811. };
  17812. const _sfc_main$x = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
  17813. props: imageViewerProps,
  17814. emits: imageViewerEmits,
  17815. setup(__props, { emit }) {
  17816. const props = __props;
  17817. const Mode = {
  17818. CONTAIN: {
  17819. name: "contain",
  17820. icon: markRaw(fullScreen)
  17821. },
  17822. ORIGINAL: {
  17823. name: "original",
  17824. icon: markRaw(scaleToOriginal)
  17825. }
  17826. };
  17827. const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
  17828. const { t } = useLocale();
  17829. const ns = useNamespace("image-viewer");
  17830. const { nextZIndex } = useZIndex();
  17831. const wrapper = ref();
  17832. const imgRefs = ref([]);
  17833. const scopeEventListener = effectScope();
  17834. const loading2 = ref(true);
  17835. const index = ref(props.initialIndex);
  17836. const mode = ref(Mode.CONTAIN);
  17837. const transform = ref({
  17838. scale: 1,
  17839. deg: 0,
  17840. offsetX: 0,
  17841. offsetY: 0,
  17842. enableTransition: false
  17843. });
  17844. const isSingle = computed(() => {
  17845. const { urlList } = props;
  17846. return urlList.length <= 1;
  17847. });
  17848. const isFirst = computed(() => {
  17849. return index.value === 0;
  17850. });
  17851. const isLast = computed(() => {
  17852. return index.value === props.urlList.length - 1;
  17853. });
  17854. const currentImg = computed(() => {
  17855. return props.urlList[index.value];
  17856. });
  17857. const imgStyle = computed(() => {
  17858. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  17859. let translateX = offsetX / scale;
  17860. let translateY = offsetY / scale;
  17861. switch (deg % 360) {
  17862. case 90:
  17863. case -270:
  17864. [translateX, translateY] = [translateY, -translateX];
  17865. break;
  17866. case 180:
  17867. case -180:
  17868. [translateX, translateY] = [-translateX, -translateY];
  17869. break;
  17870. case 270:
  17871. case -90:
  17872. [translateX, translateY] = [-translateY, translateX];
  17873. break;
  17874. }
  17875. const style = {
  17876. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  17877. transition: enableTransition ? "transform .3s" : ""
  17878. };
  17879. if (mode.value.name === Mode.CONTAIN.name) {
  17880. style.maxWidth = style.maxHeight = "100%";
  17881. }
  17882. return style;
  17883. });
  17884. const computedZIndex = computed(() => {
  17885. return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  17886. });
  17887. function hide2() {
  17888. unregisterEventListener();
  17889. emit("close");
  17890. }
  17891. function registerEventListener() {
  17892. const keydownHandler = throttle((e) => {
  17893. switch (e.code) {
  17894. case EVENT_CODE.esc:
  17895. hide2();
  17896. break;
  17897. case EVENT_CODE.space:
  17898. toggleMode();
  17899. break;
  17900. case EVENT_CODE.left:
  17901. prev();
  17902. break;
  17903. case EVENT_CODE.up:
  17904. handleActions("zoomIn");
  17905. break;
  17906. case EVENT_CODE.right:
  17907. next();
  17908. break;
  17909. case EVENT_CODE.down:
  17910. handleActions("zoomOut");
  17911. break;
  17912. }
  17913. });
  17914. const mousewheelHandler = throttle((e) => {
  17915. const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
  17916. if (delta > 0) {
  17917. handleActions("zoomIn", {
  17918. zoomRate: 1.2,
  17919. enableTransition: false
  17920. });
  17921. } else {
  17922. handleActions("zoomOut", {
  17923. zoomRate: 1.2,
  17924. enableTransition: false
  17925. });
  17926. }
  17927. });
  17928. scopeEventListener.run(() => {
  17929. useEventListener(document, "keydown", keydownHandler);
  17930. useEventListener(document, mousewheelEventName, mousewheelHandler);
  17931. });
  17932. }
  17933. function unregisterEventListener() {
  17934. scopeEventListener.stop();
  17935. }
  17936. function handleImgLoad() {
  17937. loading2.value = false;
  17938. }
  17939. function handleImgError(e) {
  17940. loading2.value = false;
  17941. e.target.alt = t("el.image.error");
  17942. }
  17943. function handleMouseDown(e) {
  17944. if (loading2.value || e.button !== 0 || !wrapper.value)
  17945. return;
  17946. transform.value.enableTransition = false;
  17947. const { offsetX, offsetY } = transform.value;
  17948. const startX = e.pageX;
  17949. const startY = e.pageY;
  17950. const dragHandler = throttle((ev) => {
  17951. transform.value = __spreadProps(__spreadValues({}, transform.value), {
  17952. offsetX: offsetX + ev.pageX - startX,
  17953. offsetY: offsetY + ev.pageY - startY
  17954. });
  17955. });
  17956. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  17957. useEventListener(document, "mouseup", () => {
  17958. removeMousemove();
  17959. });
  17960. e.preventDefault();
  17961. }
  17962. function reset() {
  17963. transform.value = {
  17964. scale: 1,
  17965. deg: 0,
  17966. offsetX: 0,
  17967. offsetY: 0,
  17968. enableTransition: false
  17969. };
  17970. }
  17971. function toggleMode() {
  17972. if (loading2.value)
  17973. return;
  17974. const modeNames = Object.keys(Mode);
  17975. const modeValues = Object.values(Mode);
  17976. const currentMode = mode.value.name;
  17977. const index2 = modeValues.findIndex((i) => i.name === currentMode);
  17978. const nextIndex = (index2 + 1) % modeNames.length;
  17979. mode.value = Mode[modeNames[nextIndex]];
  17980. reset();
  17981. }
  17982. function prev() {
  17983. if (isFirst.value && !props.infinite)
  17984. return;
  17985. const len = props.urlList.length;
  17986. index.value = (index.value - 1 + len) % len;
  17987. }
  17988. function next() {
  17989. if (isLast.value && !props.infinite)
  17990. return;
  17991. const len = props.urlList.length;
  17992. index.value = (index.value + 1) % len;
  17993. }
  17994. function handleActions(action, options = {}) {
  17995. if (loading2.value)
  17996. return;
  17997. const { zoomRate, rotateDeg, enableTransition } = __spreadValues({
  17998. zoomRate: 1.4,
  17999. rotateDeg: 90,
  18000. enableTransition: true
  18001. }, options);
  18002. switch (action) {
  18003. case "zoomOut":
  18004. if (transform.value.scale > 0.2) {
  18005. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  18006. }
  18007. break;
  18008. case "zoomIn":
  18009. if (transform.value.scale < 7) {
  18010. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  18011. }
  18012. break;
  18013. case "clockwise":
  18014. transform.value.deg += rotateDeg;
  18015. break;
  18016. case "anticlockwise":
  18017. transform.value.deg -= rotateDeg;
  18018. break;
  18019. }
  18020. transform.value.enableTransition = enableTransition;
  18021. }
  18022. watch(currentImg, () => {
  18023. nextTick(() => {
  18024. const $img = imgRefs.value[0];
  18025. if (!($img == null ? void 0 : $img.complete)) {
  18026. loading2.value = true;
  18027. }
  18028. });
  18029. });
  18030. watch(index, (val) => {
  18031. reset();
  18032. emit("switch", val);
  18033. });
  18034. onMounted(() => {
  18035. var _a2, _b2;
  18036. registerEventListener();
  18037. (_b2 = (_a2 = wrapper.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  18038. });
  18039. return (_ctx, _cache) => {
  18040. return openBlock(), createBlock(Teleport, {
  18041. to: "body",
  18042. disabled: !_ctx.teleported
  18043. }, [
  18044. createVNode(Transition, {
  18045. name: "viewer-fade",
  18046. appear: ""
  18047. }, {
  18048. default: withCtx(() => [
  18049. createElementVNode("div", {
  18050. ref_key: "wrapper",
  18051. ref: wrapper,
  18052. tabindex: -1,
  18053. class: normalizeClass(unref(ns).e("wrapper")),
  18054. style: normalizeStyle({ zIndex: unref(computedZIndex) })
  18055. }, [
  18056. createElementVNode("div", {
  18057. class: normalizeClass(unref(ns).e("mask")),
  18058. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.hideOnClickModal && hide2(), ["self"]))
  18059. }, null, 2),
  18060. createCommentVNode(" CLOSE "),
  18061. createElementVNode("span", {
  18062. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  18063. onClick: hide2
  18064. }, [
  18065. createVNode(unref(ElIcon), null, {
  18066. default: withCtx(() => [
  18067. createVNode(unref(close))
  18068. ]),
  18069. _: 1
  18070. })
  18071. ], 2),
  18072. createCommentVNode(" ARROW "),
  18073. !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  18074. createElementVNode("span", {
  18075. class: normalizeClass([
  18076. unref(ns).e("btn"),
  18077. unref(ns).e("prev"),
  18078. unref(ns).is("disabled", !_ctx.infinite && unref(isFirst))
  18079. ]),
  18080. onClick: prev
  18081. }, [
  18082. createVNode(unref(ElIcon), null, {
  18083. default: withCtx(() => [
  18084. createVNode(unref(arrowLeft))
  18085. ]),
  18086. _: 1
  18087. })
  18088. ], 2),
  18089. createElementVNode("span", {
  18090. class: normalizeClass([
  18091. unref(ns).e("btn"),
  18092. unref(ns).e("next"),
  18093. unref(ns).is("disabled", !_ctx.infinite && unref(isLast))
  18094. ]),
  18095. onClick: next
  18096. }, [
  18097. createVNode(unref(ElIcon), null, {
  18098. default: withCtx(() => [
  18099. createVNode(unref(arrowRight))
  18100. ]),
  18101. _: 1
  18102. })
  18103. ], 2)
  18104. ], 64)) : createCommentVNode("v-if", true),
  18105. createCommentVNode(" ACTIONS "),
  18106. createElementVNode("div", {
  18107. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
  18108. }, [
  18109. createElementVNode("div", {
  18110. class: normalizeClass(unref(ns).e("actions__inner"))
  18111. }, [
  18112. createVNode(unref(ElIcon), {
  18113. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  18114. }, {
  18115. default: withCtx(() => [
  18116. createVNode(unref(zoomOut))
  18117. ]),
  18118. _: 1
  18119. }),
  18120. createVNode(unref(ElIcon), {
  18121. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  18122. }, {
  18123. default: withCtx(() => [
  18124. createVNode(unref(zoomIn))
  18125. ]),
  18126. _: 1
  18127. }),
  18128. createElementVNode("i", {
  18129. class: normalizeClass(unref(ns).e("actions__divider"))
  18130. }, null, 2),
  18131. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  18132. default: withCtx(() => [
  18133. (openBlock(), createBlock(resolveDynamicComponent(mode.value.icon)))
  18134. ]),
  18135. _: 1
  18136. }),
  18137. createElementVNode("i", {
  18138. class: normalizeClass(unref(ns).e("actions__divider"))
  18139. }, null, 2),
  18140. createVNode(unref(ElIcon), {
  18141. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  18142. }, {
  18143. default: withCtx(() => [
  18144. createVNode(unref(refreshLeft))
  18145. ]),
  18146. _: 1
  18147. }),
  18148. createVNode(unref(ElIcon), {
  18149. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  18150. }, {
  18151. default: withCtx(() => [
  18152. createVNode(unref(refreshRight))
  18153. ]),
  18154. _: 1
  18155. })
  18156. ], 2)
  18157. ], 2),
  18158. createCommentVNode(" CANVAS "),
  18159. createElementVNode("div", {
  18160. class: normalizeClass(unref(ns).e("canvas"))
  18161. }, [
  18162. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url2, i) => {
  18163. return withDirectives((openBlock(), createElementBlock("img", {
  18164. ref_for: true,
  18165. ref: (el) => imgRefs.value[i] = el,
  18166. key: url2,
  18167. src: url2,
  18168. style: normalizeStyle(unref(imgStyle)),
  18169. class: normalizeClass(unref(ns).e("img")),
  18170. onLoad: handleImgLoad,
  18171. onError: handleImgError,
  18172. onMousedown: handleMouseDown
  18173. }, null, 46, _hoisted_1$l)), [
  18174. [vShow, i === index.value]
  18175. ]);
  18176. }), 128))
  18177. ], 2),
  18178. renderSlot(_ctx.$slots, "default")
  18179. ], 6)
  18180. ]),
  18181. _: 3
  18182. })
  18183. ], 8, ["disabled"]);
  18184. };
  18185. }
  18186. }));
  18187. var ImageViewer = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image-viewer/src/image-viewer.vue"]]);
  18188. const ElImageViewer = withInstall(ImageViewer);
  18189. const imageProps = buildProps({
  18190. appendToBody: {
  18191. type: Boolean,
  18192. default: void 0
  18193. },
  18194. hideOnClickModal: {
  18195. type: Boolean,
  18196. default: false
  18197. },
  18198. src: {
  18199. type: String,
  18200. default: ""
  18201. },
  18202. fit: {
  18203. type: String,
  18204. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  18205. default: ""
  18206. },
  18207. lazy: {
  18208. type: Boolean,
  18209. default: false
  18210. },
  18211. scrollContainer: {
  18212. type: definePropType([String, Object])
  18213. },
  18214. previewSrcList: {
  18215. type: definePropType(Array),
  18216. default: () => mutable([])
  18217. },
  18218. previewTeleported: {
  18219. type: Boolean,
  18220. default: false
  18221. },
  18222. zIndex: {
  18223. type: Number
  18224. },
  18225. initialIndex: {
  18226. type: Number,
  18227. default: 0
  18228. },
  18229. infinite: {
  18230. type: Boolean,
  18231. default: true
  18232. }
  18233. });
  18234. const imageEmits = {
  18235. error: (evt) => evt instanceof Event,
  18236. switch: (val) => isNumber(val),
  18237. close: () => true
  18238. };
  18239. const _hoisted_1$k = ["src"];
  18240. const _hoisted_2$h = { key: 0 };
  18241. const __default__$6 = {
  18242. name: "ElImage"
  18243. };
  18244. const _sfc_main$w = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
  18245. props: imageProps,
  18246. emits: imageEmits,
  18247. setup(__props, { emit }) {
  18248. const props = __props;
  18249. let prevOverflow = "";
  18250. useDeprecated({
  18251. scope: "el-image",
  18252. from: "append-to-body",
  18253. replacement: "preview-teleported",
  18254. version: "2.2.0",
  18255. ref: "https://element-plus.org/en-US/component/image.html#image-attributess"
  18256. }, computed(() => isBoolean(props.appendToBody)));
  18257. const { t } = useLocale();
  18258. const ns = useNamespace("image");
  18259. const attrs = useAttrs();
  18260. const hasLoadError = ref(false);
  18261. const loading2 = ref(true);
  18262. const imgWidth = ref(0);
  18263. const imgHeight = ref(0);
  18264. const showViewer = ref(false);
  18265. const container = ref();
  18266. const _scrollContainer = ref();
  18267. let stopScrollListener;
  18268. let stopWheelListener;
  18269. const containerStyle = computed(() => attrs.value.style);
  18270. const imageStyle = computed(() => {
  18271. const { fit } = props;
  18272. if (isClient && fit) {
  18273. return { objectFit: fit };
  18274. }
  18275. return {};
  18276. });
  18277. const preview = computed(() => {
  18278. const { previewSrcList } = props;
  18279. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  18280. });
  18281. const teleported = computed(() => {
  18282. return props.appendToBody || props.previewTeleported;
  18283. });
  18284. const imageIndex = computed(() => {
  18285. const { previewSrcList, initialIndex } = props;
  18286. let previewIndex = initialIndex;
  18287. if (initialIndex > previewSrcList.length - 1) {
  18288. previewIndex = 0;
  18289. }
  18290. return previewIndex;
  18291. });
  18292. const loadImage = () => {
  18293. if (!isClient)
  18294. return;
  18295. loading2.value = true;
  18296. hasLoadError.value = false;
  18297. const img = new Image();
  18298. const currentImageSrc = props.src;
  18299. img.addEventListener("load", (e) => {
  18300. if (currentImageSrc !== props.src) {
  18301. return;
  18302. }
  18303. handleLoad(e, img);
  18304. });
  18305. img.addEventListener("error", (e) => {
  18306. if (currentImageSrc !== props.src) {
  18307. return;
  18308. }
  18309. handleError(e);
  18310. });
  18311. Object.entries(attrs.value).forEach(([key, value]) => {
  18312. if (key.toLowerCase() === "onload")
  18313. return;
  18314. img.setAttribute(key, value);
  18315. });
  18316. img.src = currentImageSrc;
  18317. };
  18318. function handleLoad(e, img) {
  18319. imgWidth.value = img.width;
  18320. imgHeight.value = img.height;
  18321. loading2.value = false;
  18322. hasLoadError.value = false;
  18323. }
  18324. function handleError(event) {
  18325. loading2.value = false;
  18326. hasLoadError.value = true;
  18327. emit("error", event);
  18328. }
  18329. function handleLazyLoad() {
  18330. if (isInContainer(container.value, _scrollContainer.value)) {
  18331. loadImage();
  18332. removeLazyLoadListener();
  18333. }
  18334. }
  18335. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200);
  18336. async function addLazyLoadListener() {
  18337. var _a2;
  18338. if (!isClient)
  18339. return;
  18340. await nextTick();
  18341. const { scrollContainer } = props;
  18342. if (isElement$1(scrollContainer)) {
  18343. _scrollContainer.value = scrollContainer;
  18344. } else if (isString(scrollContainer) && scrollContainer !== "") {
  18345. _scrollContainer.value = (_a2 = document.querySelector(scrollContainer)) != null ? _a2 : void 0;
  18346. } else if (container.value) {
  18347. _scrollContainer.value = getScrollContainer(container.value);
  18348. }
  18349. if (_scrollContainer.value) {
  18350. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  18351. setTimeout(() => handleLazyLoad(), 100);
  18352. }
  18353. }
  18354. function removeLazyLoadListener() {
  18355. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  18356. return;
  18357. stopScrollListener();
  18358. _scrollContainer.value = void 0;
  18359. }
  18360. function wheelHandler(e) {
  18361. if (!e.ctrlKey)
  18362. return;
  18363. if (e.deltaY < 0) {
  18364. e.preventDefault();
  18365. return false;
  18366. } else if (e.deltaY > 0) {
  18367. e.preventDefault();
  18368. return false;
  18369. }
  18370. }
  18371. function clickHandler() {
  18372. if (!preview.value)
  18373. return;
  18374. stopWheelListener = useEventListener("wheel", wheelHandler, {
  18375. passive: false
  18376. });
  18377. prevOverflow = document.body.style.overflow;
  18378. document.body.style.overflow = "hidden";
  18379. showViewer.value = true;
  18380. }
  18381. function closeViewer() {
  18382. stopWheelListener == null ? void 0 : stopWheelListener();
  18383. document.body.style.overflow = prevOverflow;
  18384. showViewer.value = false;
  18385. emit("close");
  18386. }
  18387. function switchViewer(val) {
  18388. emit("switch", val);
  18389. }
  18390. watch(() => props.src, () => {
  18391. if (props.lazy) {
  18392. loading2.value = true;
  18393. hasLoadError.value = false;
  18394. removeLazyLoadListener();
  18395. addLazyLoadListener();
  18396. } else {
  18397. loadImage();
  18398. }
  18399. });
  18400. onMounted(() => {
  18401. if (props.lazy) {
  18402. addLazyLoadListener();
  18403. } else {
  18404. loadImage();
  18405. }
  18406. });
  18407. return (_ctx, _cache) => {
  18408. return openBlock(), createElementBlock("div", {
  18409. ref_key: "container",
  18410. ref: container,
  18411. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  18412. style: normalizeStyle(unref(containerStyle))
  18413. }, [
  18414. loading2.value ? renderSlot(_ctx.$slots, "placeholder", { key: 0 }, () => [
  18415. createElementVNode("div", {
  18416. class: normalizeClass(unref(ns).e("placeholder"))
  18417. }, null, 2)
  18418. ]) : hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 1 }, () => [
  18419. createElementVNode("div", {
  18420. class: normalizeClass(unref(ns).e("error"))
  18421. }, toDisplayString(unref(t)("el.image.error")), 3)
  18422. ]) : (openBlock(), createElementBlock("img", mergeProps({ key: 2 }, unref(attrs), {
  18423. src: _ctx.src,
  18424. style: unref(imageStyle),
  18425. class: [unref(ns).e("inner"), unref(preview) ? unref(ns).e("preview") : ""],
  18426. onClick: clickHandler
  18427. }), null, 16, _hoisted_1$k)),
  18428. unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  18429. showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  18430. key: 0,
  18431. "z-index": _ctx.zIndex,
  18432. "initial-index": unref(imageIndex),
  18433. infinite: _ctx.infinite,
  18434. "url-list": _ctx.previewSrcList,
  18435. "hide-on-click-modal": _ctx.hideOnClickModal,
  18436. teleported: unref(teleported),
  18437. onClose: closeViewer,
  18438. onSwitch: switchViewer
  18439. }, {
  18440. default: withCtx(() => [
  18441. _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", _hoisted_2$h, [
  18442. renderSlot(_ctx.$slots, "viewer")
  18443. ])) : createCommentVNode("v-if", true)
  18444. ]),
  18445. _: 3
  18446. }, 8, ["z-index", "initial-index", "infinite", "url-list", "hide-on-click-modal", "teleported"])) : createCommentVNode("v-if", true)
  18447. ], 2112)) : createCommentVNode("v-if", true)
  18448. ], 6);
  18449. };
  18450. }
  18451. }));
  18452. var Image$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/image/src/image.vue"]]);
  18453. const ElImage = withInstall(Image$1);
  18454. const inputNumberProps = buildProps({
  18455. step: {
  18456. type: Number,
  18457. default: 1
  18458. },
  18459. stepStrictly: {
  18460. type: Boolean,
  18461. default: false
  18462. },
  18463. max: {
  18464. type: Number,
  18465. default: Number.POSITIVE_INFINITY
  18466. },
  18467. min: {
  18468. type: Number,
  18469. default: Number.NEGATIVE_INFINITY
  18470. },
  18471. modelValue: {
  18472. type: Number
  18473. },
  18474. disabled: {
  18475. type: Boolean,
  18476. default: false
  18477. },
  18478. size: {
  18479. type: String,
  18480. values: componentSizes
  18481. },
  18482. controls: {
  18483. type: Boolean,
  18484. default: true
  18485. },
  18486. controlsPosition: {
  18487. type: String,
  18488. default: "",
  18489. values: ["", "right"]
  18490. },
  18491. name: String,
  18492. label: String,
  18493. placeholder: String,
  18494. precision: {
  18495. type: Number,
  18496. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  18497. }
  18498. });
  18499. const inputNumberEmits = {
  18500. change: (prev, cur) => prev !== cur,
  18501. blur: (e) => e instanceof FocusEvent,
  18502. focus: (e) => e instanceof FocusEvent,
  18503. input: (val) => isNumber(val),
  18504. "update:modelValue": (val) => isNumber(val) || val === void 0
  18505. };
  18506. const _sfc_main$v = defineComponent({
  18507. name: "ElInputNumber",
  18508. components: {
  18509. ElInput,
  18510. ElIcon,
  18511. ArrowUp: arrowUp,
  18512. ArrowDown: arrowDown,
  18513. Plus: plus,
  18514. Minus: minus
  18515. },
  18516. directives: {
  18517. RepeatClick
  18518. },
  18519. props: inputNumberProps,
  18520. emits: inputNumberEmits,
  18521. setup(props, { emit }) {
  18522. const input = ref();
  18523. const data2 = reactive({
  18524. currentValue: props.modelValue,
  18525. userInput: null
  18526. });
  18527. const { formItem } = useFormItem();
  18528. const ns = useNamespace("input-number");
  18529. const minDisabled = computed(() => ensurePrecision(props.modelValue, -1) < props.min);
  18530. const maxDisabled = computed(() => ensurePrecision(props.modelValue) > props.max);
  18531. const numPrecision = computed(() => {
  18532. const stepPrecision = getPrecision(props.step);
  18533. if (!isUndefined(props.precision)) {
  18534. if (stepPrecision > props.precision)
  18535. ;
  18536. return props.precision;
  18537. } else {
  18538. return Math.max(getPrecision(props.modelValue), stepPrecision);
  18539. }
  18540. });
  18541. const controlsAtRight = computed(() => {
  18542. return props.controls && props.controlsPosition === "right";
  18543. });
  18544. const inputNumberSize = useSize();
  18545. const inputNumberDisabled = useDisabled$1();
  18546. const displayValue = computed(() => {
  18547. if (data2.userInput !== null) {
  18548. return data2.userInput;
  18549. }
  18550. let currentValue = data2.currentValue;
  18551. if (isNumber(currentValue)) {
  18552. if (Number.isNaN(currentValue))
  18553. return "";
  18554. if (!isUndefined(props.precision)) {
  18555. currentValue = currentValue.toFixed(props.precision);
  18556. }
  18557. }
  18558. return currentValue;
  18559. });
  18560. const toPrecision = (num, pre) => {
  18561. if (isUndefined(pre))
  18562. pre = numPrecision.value;
  18563. return Number.parseFloat(`${Math.round(num * 10 ** pre) / 10 ** pre}`);
  18564. };
  18565. const getPrecision = (value) => {
  18566. if (isUndefined(value))
  18567. return 0;
  18568. const valueString = value.toString();
  18569. const dotPosition = valueString.indexOf(".");
  18570. let precision = 0;
  18571. if (dotPosition !== -1) {
  18572. precision = valueString.length - dotPosition - 1;
  18573. }
  18574. return precision;
  18575. };
  18576. const ensurePrecision = (val, coefficient = 1) => {
  18577. if (!isNumber(val))
  18578. return data2.currentValue;
  18579. val = isNumber(val) ? val : Number.NaN;
  18580. return toPrecision(val + props.step * coefficient);
  18581. };
  18582. const increase = () => {
  18583. if (inputNumberDisabled.value || maxDisabled.value)
  18584. return;
  18585. const value = props.modelValue || 0;
  18586. const newVal = ensurePrecision(value);
  18587. setCurrentValue(newVal);
  18588. };
  18589. const decrease = () => {
  18590. if (inputNumberDisabled.value || minDisabled.value)
  18591. return;
  18592. const value = props.modelValue || 0;
  18593. const newVal = ensurePrecision(value, -1);
  18594. setCurrentValue(newVal);
  18595. };
  18596. const verifyValue = (value, update) => {
  18597. const { max: max2, min: min2, step, precision, stepStrictly } = props;
  18598. let newVal = Number(value);
  18599. if (value === null) {
  18600. newVal = Number.NaN;
  18601. }
  18602. if (!Number.isNaN(newVal)) {
  18603. if (stepStrictly) {
  18604. newVal = Math.round(newVal / step) * step;
  18605. }
  18606. if (!isUndefined(precision)) {
  18607. newVal = toPrecision(newVal, precision);
  18608. }
  18609. if (newVal > max2 || newVal < min2) {
  18610. newVal = newVal > max2 ? max2 : min2;
  18611. update && emit("update:modelValue", newVal);
  18612. }
  18613. }
  18614. return newVal;
  18615. };
  18616. const setCurrentValue = (value) => {
  18617. var _a2;
  18618. const oldVal = data2.currentValue;
  18619. let newVal = verifyValue(value);
  18620. if (oldVal === newVal)
  18621. return;
  18622. if (Number.isNaN(newVal)) {
  18623. newVal = void 0;
  18624. }
  18625. data2.userInput = null;
  18626. emit("update:modelValue", newVal);
  18627. emit("input", newVal);
  18628. emit("change", newVal, oldVal);
  18629. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  18630. data2.currentValue = newVal;
  18631. };
  18632. const handleInput = (value) => {
  18633. return data2.userInput = value;
  18634. };
  18635. const handleInputChange = (value) => {
  18636. const newVal = value !== "" ? Number(value) : "";
  18637. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  18638. setCurrentValue(newVal);
  18639. }
  18640. data2.userInput = null;
  18641. };
  18642. const focus = () => {
  18643. var _a2, _b2;
  18644. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  18645. };
  18646. const blur = () => {
  18647. var _a2, _b2;
  18648. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b2.call(_a2);
  18649. };
  18650. const handleFocus = (event) => {
  18651. emit("focus", event);
  18652. };
  18653. const handleBlur = (event) => {
  18654. var _a2;
  18655. emit("blur", event);
  18656. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  18657. };
  18658. watch(() => props.modelValue, (value) => {
  18659. const newVal = verifyValue(value, true);
  18660. data2.currentValue = newVal;
  18661. data2.userInput = null;
  18662. }, { immediate: true });
  18663. onMounted(() => {
  18664. var _a2;
  18665. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18666. innerInput.setAttribute("role", "spinbutton");
  18667. innerInput.setAttribute("aria-valuemax", String(props.max));
  18668. innerInput.setAttribute("aria-valuemin", String(props.min));
  18669. innerInput.setAttribute("aria-valuenow", String(data2.currentValue));
  18670. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  18671. if (!isNumber(props.modelValue)) {
  18672. let val = Number(props.modelValue);
  18673. if (Number.isNaN(val)) {
  18674. val = void 0;
  18675. }
  18676. emit("update:modelValue", val);
  18677. }
  18678. });
  18679. onUpdated(() => {
  18680. var _a2;
  18681. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  18682. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", data2.currentValue);
  18683. });
  18684. return {
  18685. input,
  18686. displayValue,
  18687. handleInput,
  18688. handleInputChange,
  18689. controlsAtRight,
  18690. decrease,
  18691. increase,
  18692. inputNumberSize,
  18693. inputNumberDisabled,
  18694. maxDisabled,
  18695. minDisabled,
  18696. focus,
  18697. blur,
  18698. handleFocus,
  18699. handleBlur,
  18700. ns
  18701. };
  18702. }
  18703. });
  18704. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  18705. const _component_arrow_down = resolveComponent("arrow-down");
  18706. const _component_minus = resolveComponent("minus");
  18707. const _component_el_icon = resolveComponent("el-icon");
  18708. const _component_arrow_up = resolveComponent("arrow-up");
  18709. const _component_plus = resolveComponent("plus");
  18710. const _component_el_input = resolveComponent("el-input");
  18711. const _directive_repeat_click = resolveDirective("repeat-click");
  18712. return openBlock(), createElementBlock("div", {
  18713. class: normalizeClass([
  18714. _ctx.ns.b(),
  18715. _ctx.ns.m(_ctx.inputNumberSize),
  18716. _ctx.ns.is("disabled", _ctx.inputNumberDisabled),
  18717. _ctx.ns.is("without-controls", !_ctx.controls),
  18718. _ctx.ns.is("controls-right", _ctx.controlsAtRight)
  18719. ]),
  18720. onDragstart: _cache[2] || (_cache[2] = withModifiers(() => {
  18721. }, ["prevent"]))
  18722. }, [
  18723. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18724. key: 0,
  18725. role: "button",
  18726. class: normalizeClass([_ctx.ns.e("decrease"), _ctx.ns.is("disabled", _ctx.minDisabled)]),
  18727. onKeydown: _cache[0] || (_cache[0] = withKeys((...args) => _ctx.decrease && _ctx.decrease(...args), ["enter"]))
  18728. }, [
  18729. createVNode(_component_el_icon, null, {
  18730. default: withCtx(() => [
  18731. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_down, { key: 0 })) : (openBlock(), createBlock(_component_minus, { key: 1 }))
  18732. ]),
  18733. _: 1
  18734. })
  18735. ], 34)), [
  18736. [_directive_repeat_click, _ctx.decrease]
  18737. ]) : createCommentVNode("v-if", true),
  18738. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  18739. key: 1,
  18740. role: "button",
  18741. class: normalizeClass([_ctx.ns.e("increase"), _ctx.ns.is("disabled", _ctx.maxDisabled)]),
  18742. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.increase && _ctx.increase(...args), ["enter"]))
  18743. }, [
  18744. createVNode(_component_el_icon, null, {
  18745. default: withCtx(() => [
  18746. _ctx.controlsAtRight ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_plus, { key: 1 }))
  18747. ]),
  18748. _: 1
  18749. })
  18750. ], 34)), [
  18751. [_directive_repeat_click, _ctx.increase]
  18752. ]) : createCommentVNode("v-if", true),
  18753. createVNode(_component_el_input, {
  18754. ref: "input",
  18755. type: "number",
  18756. step: _ctx.step,
  18757. "model-value": _ctx.displayValue,
  18758. placeholder: _ctx.placeholder,
  18759. disabled: _ctx.inputNumberDisabled,
  18760. size: _ctx.inputNumberSize,
  18761. max: _ctx.max,
  18762. min: _ctx.min,
  18763. name: _ctx.name,
  18764. label: _ctx.label,
  18765. "validate-event": false,
  18766. onKeydown: [
  18767. withKeys(withModifiers(_ctx.increase, ["prevent"]), ["up"]),
  18768. withKeys(withModifiers(_ctx.decrease, ["prevent"]), ["down"])
  18769. ],
  18770. onBlur: _ctx.handleBlur,
  18771. onFocus: _ctx.handleFocus,
  18772. onInput: _ctx.handleInput,
  18773. onChange: _ctx.handleInputChange
  18774. }, null, 8, ["step", "model-value", "placeholder", "disabled", "size", "max", "min", "name", "label", "onKeydown", "onBlur", "onFocus", "onInput", "onChange"])
  18775. ], 34);
  18776. }
  18777. var InputNumber = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$g], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);
  18778. const ElInputNumber = withInstall(InputNumber);
  18779. const selectGroupKey = "ElSelectGroup";
  18780. const selectKey = "ElSelect";
  18781. function useOption$1(props, states) {
  18782. const select = inject(selectKey);
  18783. const selectGroup = inject(selectGroupKey, { disabled: false });
  18784. const isObject2 = computed(() => {
  18785. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  18786. });
  18787. const itemSelected = computed(() => {
  18788. if (!select.props.multiple) {
  18789. return isEqual2(props.value, select.props.modelValue);
  18790. } else {
  18791. return contains2(select.props.modelValue, props.value);
  18792. }
  18793. });
  18794. const limitReached = computed(() => {
  18795. if (select.props.multiple) {
  18796. const modelValue = select.props.modelValue || [];
  18797. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  18798. } else {
  18799. return false;
  18800. }
  18801. });
  18802. const currentLabel = computed(() => {
  18803. return props.label || (isObject2.value ? "" : props.value);
  18804. });
  18805. const currentValue = computed(() => {
  18806. return props.value || props.label || "";
  18807. });
  18808. const isDisabled = computed(() => {
  18809. return props.disabled || states.groupDisabled || limitReached.value;
  18810. });
  18811. const instance = getCurrentInstance();
  18812. const contains2 = (arr = [], target) => {
  18813. if (!isObject2.value) {
  18814. return arr && arr.includes(target);
  18815. } else {
  18816. const valueKey = select.props.valueKey;
  18817. return arr && arr.some((item) => {
  18818. return get(item, valueKey) === get(target, valueKey);
  18819. });
  18820. }
  18821. };
  18822. const isEqual2 = (a2, b2) => {
  18823. if (!isObject2.value) {
  18824. return a2 === b2;
  18825. } else {
  18826. const { valueKey } = select.props;
  18827. return get(a2, valueKey) === get(b2, valueKey);
  18828. }
  18829. };
  18830. const hoverItem = () => {
  18831. if (!props.disabled && !selectGroup.disabled) {
  18832. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  18833. }
  18834. };
  18835. watch(() => currentLabel.value, () => {
  18836. if (!props.created && !select.props.remote)
  18837. select.setSelected();
  18838. });
  18839. watch(() => props.value, (val, oldVal) => {
  18840. const { remote, valueKey } = select.props;
  18841. if (!props.created && !remote) {
  18842. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  18843. return;
  18844. }
  18845. select.setSelected();
  18846. }
  18847. });
  18848. watch(() => selectGroup.disabled, () => {
  18849. states.groupDisabled = selectGroup.disabled;
  18850. }, { immediate: true });
  18851. const { queryChange } = toRaw(select);
  18852. watch(queryChange, (changes) => {
  18853. const { query } = unref(changes);
  18854. const regexp4 = new RegExp(escapeStringRegexp(query), "i");
  18855. states.visible = regexp4.test(currentLabel.value) || props.created;
  18856. if (!states.visible) {
  18857. select.filteredOptionsCount--;
  18858. }
  18859. });
  18860. return {
  18861. select,
  18862. currentLabel,
  18863. currentValue,
  18864. itemSelected,
  18865. isDisabled,
  18866. hoverItem
  18867. };
  18868. }
  18869. const _sfc_main$u = defineComponent({
  18870. name: "ElOption",
  18871. componentName: "ElOption",
  18872. props: {
  18873. value: {
  18874. required: true,
  18875. type: [String, Number, Boolean, Object]
  18876. },
  18877. label: [String, Number],
  18878. created: Boolean,
  18879. disabled: {
  18880. type: Boolean,
  18881. default: false
  18882. }
  18883. },
  18884. setup(props) {
  18885. const ns = useNamespace("select");
  18886. const states = reactive({
  18887. index: -1,
  18888. groupDisabled: false,
  18889. visible: true,
  18890. hitState: false,
  18891. hover: false
  18892. });
  18893. const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption$1(props, states);
  18894. const { visible, hover } = toRefs(states);
  18895. const vm = getCurrentInstance().proxy;
  18896. const key = vm.value;
  18897. select.onOptionCreate(vm);
  18898. onBeforeUnmount(() => {
  18899. const { selected } = select;
  18900. const selectedOptions = select.props.multiple ? selected : [selected];
  18901. const doesSelected = selectedOptions.some((item) => {
  18902. return item.value === vm.value;
  18903. });
  18904. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  18905. nextTick(() => {
  18906. select.cachedOptions.delete(key);
  18907. });
  18908. }
  18909. select.onOptionDestroy(key, vm);
  18910. });
  18911. function selectOptionClick() {
  18912. if (props.disabled !== true && states.groupDisabled !== true) {
  18913. select.handleOptionSelect(vm, true);
  18914. }
  18915. }
  18916. return {
  18917. ns,
  18918. currentLabel,
  18919. itemSelected,
  18920. isDisabled,
  18921. select,
  18922. hoverItem,
  18923. visible,
  18924. hover,
  18925. selectOptionClick,
  18926. states
  18927. };
  18928. }
  18929. });
  18930. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  18931. return withDirectives((openBlock(), createElementBlock("li", {
  18932. class: normalizeClass([
  18933. _ctx.ns.be("dropdown", "item"),
  18934. _ctx.ns.is("disabled", _ctx.isDisabled),
  18935. {
  18936. selected: _ctx.itemSelected,
  18937. hover: _ctx.hover
  18938. }
  18939. ]),
  18940. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  18941. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  18942. }, [
  18943. renderSlot(_ctx.$slots, "default", {}, () => [
  18944. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  18945. ])
  18946. ], 34)), [
  18947. [vShow, _ctx.visible]
  18948. ]);
  18949. }
  18950. var Option = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["render", _sfc_render$f], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);
  18951. const _sfc_main$t = defineComponent({
  18952. name: "ElSelectDropdown",
  18953. componentName: "ElSelectDropdown",
  18954. setup() {
  18955. const select = inject(selectKey);
  18956. const ns = useNamespace("select");
  18957. const popperClass = computed(() => select.props.popperClass);
  18958. const isMultiple = computed(() => select.props.multiple);
  18959. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  18960. const minWidth = ref("");
  18961. function updateMinWidth() {
  18962. var _a2;
  18963. minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.getBoundingClientRect().width}px`;
  18964. }
  18965. onMounted(() => {
  18966. updateMinWidth();
  18967. addResizeListener(select.selectWrapper, updateMinWidth);
  18968. });
  18969. onBeforeUnmount(() => {
  18970. removeResizeListener(select.selectWrapper, updateMinWidth);
  18971. });
  18972. return {
  18973. ns,
  18974. minWidth,
  18975. popperClass,
  18976. isMultiple,
  18977. isFitInputWidth
  18978. };
  18979. }
  18980. });
  18981. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  18982. return openBlock(), createElementBlock("div", {
  18983. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  18984. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  18985. }, [
  18986. renderSlot(_ctx.$slots, "default")
  18987. ], 6);
  18988. }
  18989. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["render", _sfc_render$e], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);
  18990. function useSelectStates(props) {
  18991. const { t } = useLocale();
  18992. return reactive({
  18993. options: /* @__PURE__ */ new Map(),
  18994. cachedOptions: /* @__PURE__ */ new Map(),
  18995. createdLabel: null,
  18996. createdSelected: false,
  18997. selected: props.multiple ? [] : {},
  18998. inputLength: 20,
  18999. inputWidth: 0,
  19000. initialInputHeight: 0,
  19001. optionsCount: 0,
  19002. filteredOptionsCount: 0,
  19003. visible: false,
  19004. softFocus: false,
  19005. selectedLabel: "",
  19006. hoverIndex: -1,
  19007. query: "",
  19008. previousQuery: null,
  19009. inputHovering: false,
  19010. cachedPlaceHolder: "",
  19011. currentPlaceholder: t("el.select.placeholder"),
  19012. menuVisibleOnFocus: false,
  19013. isOnComposition: false,
  19014. isSilentBlur: false,
  19015. prefixWidth: 11,
  19016. tagInMultiLine: false
  19017. });
  19018. }
  19019. const useSelect$1 = (props, states, ctx) => {
  19020. const { t } = useLocale();
  19021. const ns = useNamespace("select");
  19022. const reference2 = ref(null);
  19023. const input = ref(null);
  19024. const tooltipRef = ref(null);
  19025. const tags = ref(null);
  19026. const selectWrapper = ref(null);
  19027. const scrollbar = ref(null);
  19028. const hoverOption = ref(-1);
  19029. const queryChange = shallowRef({ query: "" });
  19030. const groupQueryChange = shallowRef("");
  19031. const elForm2 = inject(formContextKey, {});
  19032. const elFormItem2 = inject(formItemContextKey, {});
  19033. const readonly2 = computed(() => !props.filterable || props.multiple || !states.visible);
  19034. const selectDisabled = computed(() => props.disabled || elForm2.disabled);
  19035. const showClose = computed(() => {
  19036. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  19037. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  19038. return criteria;
  19039. });
  19040. const iconComponent = computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
  19041. const iconReverse = computed(() => ns.is("reverse", iconComponent.value && states.visible));
  19042. const debounce$1$1 = computed(() => props.remote ? 300 : 0);
  19043. const emptyText = computed(() => {
  19044. if (props.loading) {
  19045. return props.loadingText || t("el.select.loading");
  19046. } else {
  19047. if (props.remote && states.query === "" && states.options.size === 0)
  19048. return false;
  19049. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  19050. return props.noMatchText || t("el.select.noMatch");
  19051. }
  19052. if (states.options.size === 0) {
  19053. return props.noDataText || t("el.select.noData");
  19054. }
  19055. }
  19056. return null;
  19057. });
  19058. const optionsArray = computed(() => Array.from(states.options.values()));
  19059. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  19060. const showNewOption = computed(() => {
  19061. const hasExistingOption = optionsArray.value.filter((option) => {
  19062. return !option.created;
  19063. }).some((option) => {
  19064. return option.currentLabel === states.query;
  19065. });
  19066. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  19067. });
  19068. const selectSize = useSize();
  19069. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  19070. const dropMenuVisible = computed({
  19071. get() {
  19072. return states.visible && emptyText.value !== false;
  19073. },
  19074. set(val) {
  19075. states.visible = val;
  19076. }
  19077. });
  19078. watch(() => selectDisabled.value, () => {
  19079. nextTick(() => {
  19080. resetInputHeight();
  19081. });
  19082. });
  19083. watch(() => props.placeholder, (val) => {
  19084. states.cachedPlaceHolder = states.currentPlaceholder = val;
  19085. });
  19086. watch(() => props.modelValue, (val, oldVal) => {
  19087. var _a2;
  19088. if (props.multiple) {
  19089. resetInputHeight();
  19090. if (val && val.length > 0 || input.value && states.query !== "") {
  19091. states.currentPlaceholder = "";
  19092. } else {
  19093. states.currentPlaceholder = states.cachedPlaceHolder;
  19094. }
  19095. if (props.filterable && !props.reserveKeyword) {
  19096. states.query = "";
  19097. handleQueryChange(states.query);
  19098. }
  19099. }
  19100. setSelected();
  19101. if (props.filterable && !props.multiple) {
  19102. states.inputLength = 20;
  19103. }
  19104. if (!isEqual$1(val, oldVal)) {
  19105. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  19106. }
  19107. }, {
  19108. flush: "post",
  19109. deep: true
  19110. });
  19111. watch(() => states.visible, (val) => {
  19112. var _a2, _b2, _c;
  19113. if (!val) {
  19114. input.value && input.value.blur();
  19115. states.query = "";
  19116. states.previousQuery = null;
  19117. states.selectedLabel = "";
  19118. states.inputLength = 20;
  19119. states.menuVisibleOnFocus = false;
  19120. resetHoverIndex();
  19121. nextTick(() => {
  19122. if (input.value && input.value.value === "" && states.selected.length === 0) {
  19123. states.currentPlaceholder = states.cachedPlaceHolder;
  19124. }
  19125. });
  19126. if (!props.multiple) {
  19127. if (states.selected) {
  19128. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  19129. states.selectedLabel = states.createdLabel;
  19130. } else {
  19131. states.selectedLabel = states.selected.currentLabel;
  19132. }
  19133. if (props.filterable)
  19134. states.query = states.selectedLabel;
  19135. }
  19136. if (props.filterable) {
  19137. states.currentPlaceholder = states.cachedPlaceHolder;
  19138. }
  19139. }
  19140. } else {
  19141. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19142. if (props.filterable) {
  19143. states.filteredOptionsCount = states.optionsCount;
  19144. states.query = props.remote ? "" : states.selectedLabel;
  19145. if (props.multiple) {
  19146. (_c = input.value) == null ? void 0 : _c.focus();
  19147. } else {
  19148. if (states.selectedLabel) {
  19149. states.currentPlaceholder = `${states.selectedLabel}`;
  19150. states.selectedLabel = "";
  19151. }
  19152. }
  19153. handleQueryChange(states.query);
  19154. if (!props.multiple && !props.remote) {
  19155. queryChange.value.query = "";
  19156. triggerRef(queryChange);
  19157. triggerRef(groupQueryChange);
  19158. }
  19159. }
  19160. }
  19161. ctx.emit("visible-change", val);
  19162. });
  19163. watch(() => states.options.entries(), () => {
  19164. var _a2, _b2, _c;
  19165. if (!isClient)
  19166. return;
  19167. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19168. if (props.multiple) {
  19169. resetInputHeight();
  19170. }
  19171. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  19172. if (!Array.from(inputs).includes(document.activeElement)) {
  19173. setSelected();
  19174. }
  19175. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  19176. checkDefaultFirstOption();
  19177. }
  19178. }, {
  19179. flush: "post"
  19180. });
  19181. watch(() => states.hoverIndex, (val) => {
  19182. if (typeof val === "number" && val > -1) {
  19183. hoverOption.value = optionsArray.value[val] || {};
  19184. }
  19185. optionsArray.value.forEach((option) => {
  19186. option.hover = hoverOption.value === option;
  19187. });
  19188. });
  19189. const resetInputHeight = () => {
  19190. if (props.collapseTags && !props.filterable)
  19191. return;
  19192. nextTick(() => {
  19193. var _a2, _b2;
  19194. if (!reference2.value)
  19195. return;
  19196. const input2 = reference2.value.$el.querySelector("input");
  19197. const _tags = tags.value;
  19198. const sizeInMap = states.initialInputHeight || getComponentSize(selectSize.value || elForm2.size);
  19199. input2.style.height = states.selected.length === 0 ? `${sizeInMap}px` : `${Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)}px`;
  19200. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  19201. if (states.visible && emptyText.value !== false) {
  19202. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19203. }
  19204. });
  19205. };
  19206. const handleQueryChange = (val) => {
  19207. if (states.previousQuery === val || states.isOnComposition)
  19208. return;
  19209. if (states.previousQuery === null && (typeof props.filterMethod === "function" || typeof props.remoteMethod === "function")) {
  19210. states.previousQuery = val;
  19211. return;
  19212. }
  19213. states.previousQuery = val;
  19214. nextTick(() => {
  19215. var _a2, _b2;
  19216. if (states.visible)
  19217. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19218. });
  19219. states.hoverIndex = -1;
  19220. if (props.multiple && props.filterable) {
  19221. nextTick(() => {
  19222. const length = input.value.value.length * 15 + 20;
  19223. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  19224. managePlaceholder();
  19225. resetInputHeight();
  19226. });
  19227. }
  19228. if (props.remote && typeof props.remoteMethod === "function") {
  19229. states.hoverIndex = -1;
  19230. props.remoteMethod(val);
  19231. } else if (typeof props.filterMethod === "function") {
  19232. props.filterMethod(val);
  19233. triggerRef(groupQueryChange);
  19234. } else {
  19235. states.filteredOptionsCount = states.optionsCount;
  19236. queryChange.value.query = val;
  19237. triggerRef(queryChange);
  19238. triggerRef(groupQueryChange);
  19239. }
  19240. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  19241. checkDefaultFirstOption();
  19242. }
  19243. };
  19244. const managePlaceholder = () => {
  19245. if (states.currentPlaceholder !== "") {
  19246. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  19247. }
  19248. };
  19249. const checkDefaultFirstOption = () => {
  19250. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  19251. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  19252. const firstOriginOption = optionsInDropdown[0];
  19253. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  19254. };
  19255. const setSelected = () => {
  19256. var _a2;
  19257. if (!props.multiple) {
  19258. const option = getOption(props.modelValue);
  19259. if ((_a2 = option.props) == null ? void 0 : _a2.created) {
  19260. states.createdLabel = option.props.value;
  19261. states.createdSelected = true;
  19262. } else {
  19263. states.createdSelected = false;
  19264. }
  19265. states.selectedLabel = option.currentLabel;
  19266. states.selected = option;
  19267. if (props.filterable)
  19268. states.query = states.selectedLabel;
  19269. return;
  19270. } else {
  19271. states.selectedLabel = "";
  19272. }
  19273. const result = [];
  19274. if (Array.isArray(props.modelValue)) {
  19275. props.modelValue.forEach((value) => {
  19276. result.push(getOption(value));
  19277. });
  19278. }
  19279. states.selected = result;
  19280. nextTick(() => {
  19281. resetInputHeight();
  19282. });
  19283. };
  19284. const getOption = (value) => {
  19285. let option;
  19286. const isObjectValue = toRawType(value).toLowerCase() === "object";
  19287. const isNull = toRawType(value).toLowerCase() === "null";
  19288. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  19289. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  19290. const cachedOption = cachedOptionsArray.value[i];
  19291. const isEqualValue = isObjectValue ? get(cachedOption, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  19292. if (isEqualValue) {
  19293. option = {
  19294. value,
  19295. currentLabel: cachedOption.currentLabel,
  19296. isDisabled: cachedOption.isDisabled
  19297. };
  19298. break;
  19299. }
  19300. }
  19301. if (option)
  19302. return option;
  19303. const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  19304. const newOption = {
  19305. value,
  19306. currentLabel: label
  19307. };
  19308. if (props.multiple) {
  19309. newOption.hitState = false;
  19310. }
  19311. return newOption;
  19312. };
  19313. const resetHoverIndex = () => {
  19314. setTimeout(() => {
  19315. const valueKey = props.valueKey;
  19316. if (!props.multiple) {
  19317. states.hoverIndex = optionsArray.value.findIndex((item) => {
  19318. return getValueKey(item) === getValueKey(states.selected);
  19319. });
  19320. } else {
  19321. if (states.selected.length > 0) {
  19322. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  19323. return optionsArray.value.findIndex((item) => {
  19324. return get(item, valueKey) === get(selected, valueKey);
  19325. });
  19326. }));
  19327. } else {
  19328. states.hoverIndex = -1;
  19329. }
  19330. }
  19331. }, 300);
  19332. };
  19333. const handleResize = () => {
  19334. var _a2, _b2;
  19335. resetInputWidth();
  19336. (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  19337. if (props.multiple && !props.filterable)
  19338. resetInputHeight();
  19339. };
  19340. const resetInputWidth = () => {
  19341. var _a2;
  19342. states.inputWidth = (_a2 = reference2.value) == null ? void 0 : _a2.$el.getBoundingClientRect().width;
  19343. };
  19344. const onInputChange = () => {
  19345. if (props.filterable && states.query !== states.selectedLabel) {
  19346. states.query = states.selectedLabel;
  19347. handleQueryChange(states.query);
  19348. }
  19349. };
  19350. const debouncedOnInputChange = debounce$1(() => {
  19351. onInputChange();
  19352. }, debounce$1$1.value);
  19353. const debouncedQueryChange = debounce$1((e) => {
  19354. handleQueryChange(e.target.value);
  19355. }, debounce$1$1.value);
  19356. const emitChange = (val) => {
  19357. if (!isEqual$1(props.modelValue, val)) {
  19358. ctx.emit(CHANGE_EVENT, val);
  19359. }
  19360. };
  19361. const deletePrevTag = (e) => {
  19362. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  19363. const value = props.modelValue.slice();
  19364. value.pop();
  19365. ctx.emit(UPDATE_MODEL_EVENT, value);
  19366. emitChange(value);
  19367. }
  19368. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  19369. states.currentPlaceholder = states.cachedPlaceHolder;
  19370. }
  19371. };
  19372. const deleteTag = (event, tag) => {
  19373. const index = states.selected.indexOf(tag);
  19374. if (index > -1 && !selectDisabled.value) {
  19375. const value = props.modelValue.slice();
  19376. value.splice(index, 1);
  19377. ctx.emit(UPDATE_MODEL_EVENT, value);
  19378. emitChange(value);
  19379. ctx.emit("remove-tag", tag.value);
  19380. }
  19381. event.stopPropagation();
  19382. };
  19383. const deleteSelected = (event) => {
  19384. event.stopPropagation();
  19385. const value = props.multiple ? [] : "";
  19386. if (typeof value !== "string") {
  19387. for (const item of states.selected) {
  19388. if (item.isDisabled)
  19389. value.push(item.value);
  19390. }
  19391. }
  19392. ctx.emit(UPDATE_MODEL_EVENT, value);
  19393. emitChange(value);
  19394. states.visible = false;
  19395. ctx.emit("clear");
  19396. };
  19397. const handleOptionSelect = (option, byClick) => {
  19398. var _a2;
  19399. if (props.multiple) {
  19400. const value = (props.modelValue || []).slice();
  19401. const optionIndex = getValueIndex(value, option.value);
  19402. if (optionIndex > -1) {
  19403. value.splice(optionIndex, 1);
  19404. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  19405. value.push(option.value);
  19406. }
  19407. ctx.emit(UPDATE_MODEL_EVENT, value);
  19408. emitChange(value);
  19409. if (option.created) {
  19410. states.query = "";
  19411. handleQueryChange("");
  19412. states.inputLength = 20;
  19413. }
  19414. if (props.filterable)
  19415. (_a2 = input.value) == null ? void 0 : _a2.focus();
  19416. } else {
  19417. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  19418. emitChange(option.value);
  19419. states.visible = false;
  19420. }
  19421. states.isSilentBlur = byClick;
  19422. setSoftFocus();
  19423. if (states.visible)
  19424. return;
  19425. nextTick(() => {
  19426. scrollToOption(option);
  19427. });
  19428. };
  19429. const getValueIndex = (arr = [], value) => {
  19430. if (!isObject$1(value))
  19431. return arr.indexOf(value);
  19432. const valueKey = props.valueKey;
  19433. let index = -1;
  19434. arr.some((item, i) => {
  19435. if (get(item, valueKey) === get(value, valueKey)) {
  19436. index = i;
  19437. return true;
  19438. }
  19439. return false;
  19440. });
  19441. return index;
  19442. };
  19443. const setSoftFocus = () => {
  19444. states.softFocus = true;
  19445. const _input = input.value || reference2.value;
  19446. if (_input) {
  19447. _input == null ? void 0 : _input.focus();
  19448. }
  19449. };
  19450. const scrollToOption = (option) => {
  19451. var _a2, _b2, _c, _d, _e;
  19452. const targetOption = Array.isArray(option) ? option[0] : option;
  19453. let target = null;
  19454. if (targetOption == null ? void 0 : targetOption.value) {
  19455. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  19456. if (options.length > 0) {
  19457. target = options[0].$el;
  19458. }
  19459. }
  19460. if (tooltipRef.value && target) {
  19461. 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")}`);
  19462. if (menu) {
  19463. scrollIntoView(menu, target);
  19464. }
  19465. }
  19466. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  19467. };
  19468. const onOptionCreate = (vm) => {
  19469. states.optionsCount++;
  19470. states.filteredOptionsCount++;
  19471. states.options.set(vm.value, vm);
  19472. states.cachedOptions.set(vm.value, vm);
  19473. };
  19474. const onOptionDestroy = (key, vm) => {
  19475. if (states.options.get(key) === vm) {
  19476. states.optionsCount--;
  19477. states.filteredOptionsCount--;
  19478. states.options.delete(key);
  19479. }
  19480. };
  19481. const resetInputState = (e) => {
  19482. if (e.code !== EVENT_CODE.backspace)
  19483. toggleLastOptionHitState(false);
  19484. states.inputLength = input.value.value.length * 15 + 20;
  19485. resetInputHeight();
  19486. };
  19487. const toggleLastOptionHitState = (hit) => {
  19488. if (!Array.isArray(states.selected))
  19489. return;
  19490. const option = states.selected[states.selected.length - 1];
  19491. if (!option)
  19492. return;
  19493. if (hit === true || hit === false) {
  19494. option.hitState = hit;
  19495. return hit;
  19496. }
  19497. option.hitState = !option.hitState;
  19498. return option.hitState;
  19499. };
  19500. const handleComposition = (event) => {
  19501. const text = event.target.value;
  19502. if (event.type === "compositionend") {
  19503. states.isOnComposition = false;
  19504. nextTick(() => handleQueryChange(text));
  19505. } else {
  19506. const lastCharacter = text[text.length - 1] || "";
  19507. states.isOnComposition = !isKorean(lastCharacter);
  19508. }
  19509. };
  19510. const handleMenuEnter = () => {
  19511. nextTick(() => scrollToOption(states.selected));
  19512. };
  19513. const handleFocus = (event) => {
  19514. if (!states.softFocus) {
  19515. if (props.automaticDropdown || props.filterable) {
  19516. if (props.filterable && !states.visible) {
  19517. states.menuVisibleOnFocus = true;
  19518. }
  19519. states.visible = true;
  19520. }
  19521. ctx.emit("focus", event);
  19522. } else {
  19523. states.softFocus = false;
  19524. }
  19525. };
  19526. const blur = () => {
  19527. var _a2;
  19528. states.visible = false;
  19529. (_a2 = reference2.value) == null ? void 0 : _a2.blur();
  19530. };
  19531. const handleBlur = (event) => {
  19532. nextTick(() => {
  19533. if (states.isSilentBlur) {
  19534. states.isSilentBlur = false;
  19535. } else {
  19536. ctx.emit("blur", event);
  19537. }
  19538. });
  19539. states.softFocus = false;
  19540. };
  19541. const handleClearClick = (event) => {
  19542. deleteSelected(event);
  19543. };
  19544. const handleClose = () => {
  19545. states.visible = false;
  19546. };
  19547. const toggleMenu = () => {
  19548. var _a2;
  19549. if (props.automaticDropdown)
  19550. return;
  19551. if (!selectDisabled.value) {
  19552. if (states.menuVisibleOnFocus) {
  19553. states.menuVisibleOnFocus = false;
  19554. } else {
  19555. states.visible = !states.visible;
  19556. }
  19557. if (states.visible) {
  19558. (_a2 = input.value || reference2.value) == null ? void 0 : _a2.focus();
  19559. }
  19560. }
  19561. };
  19562. const selectOption = () => {
  19563. if (!states.visible) {
  19564. toggleMenu();
  19565. } else {
  19566. if (optionsArray.value[states.hoverIndex]) {
  19567. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  19568. }
  19569. }
  19570. };
  19571. const getValueKey = (item) => {
  19572. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  19573. };
  19574. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  19575. const navigateOptions = (direction2) => {
  19576. if (!states.visible) {
  19577. states.visible = true;
  19578. return;
  19579. }
  19580. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  19581. return;
  19582. if (states.isOnComposition)
  19583. return;
  19584. if (!optionsAllDisabled.value) {
  19585. if (direction2 === "next") {
  19586. states.hoverIndex++;
  19587. if (states.hoverIndex === states.options.size) {
  19588. states.hoverIndex = 0;
  19589. }
  19590. } else if (direction2 === "prev") {
  19591. states.hoverIndex--;
  19592. if (states.hoverIndex < 0) {
  19593. states.hoverIndex = states.options.size - 1;
  19594. }
  19595. }
  19596. const option = optionsArray.value[states.hoverIndex];
  19597. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  19598. navigateOptions(direction2);
  19599. }
  19600. nextTick(() => scrollToOption(hoverOption.value));
  19601. }
  19602. };
  19603. return {
  19604. optionsArray,
  19605. selectSize,
  19606. handleResize,
  19607. debouncedOnInputChange,
  19608. debouncedQueryChange,
  19609. deletePrevTag,
  19610. deleteTag,
  19611. deleteSelected,
  19612. handleOptionSelect,
  19613. scrollToOption,
  19614. readonly: readonly2,
  19615. resetInputHeight,
  19616. showClose,
  19617. iconComponent,
  19618. iconReverse,
  19619. showNewOption,
  19620. collapseTagSize,
  19621. setSelected,
  19622. managePlaceholder,
  19623. selectDisabled,
  19624. emptyText,
  19625. toggleLastOptionHitState,
  19626. resetInputState,
  19627. handleComposition,
  19628. onOptionCreate,
  19629. onOptionDestroy,
  19630. handleMenuEnter,
  19631. handleFocus,
  19632. blur,
  19633. handleBlur,
  19634. handleClearClick,
  19635. handleClose,
  19636. toggleMenu,
  19637. selectOption,
  19638. getValueKey,
  19639. navigateOptions,
  19640. dropMenuVisible,
  19641. queryChange,
  19642. groupQueryChange,
  19643. reference: reference2,
  19644. input,
  19645. tooltipRef,
  19646. tags,
  19647. selectWrapper,
  19648. scrollbar
  19649. };
  19650. };
  19651. const COMPONENT_NAME$2 = "ElSelect";
  19652. const _sfc_main$s = defineComponent({
  19653. name: COMPONENT_NAME$2,
  19654. componentName: COMPONENT_NAME$2,
  19655. components: {
  19656. ElInput,
  19657. ElSelectMenu: ElSelectMenu$1,
  19658. ElOption: Option,
  19659. ElTag,
  19660. ElScrollbar,
  19661. ElTooltip,
  19662. ElIcon
  19663. },
  19664. directives: { ClickOutside },
  19665. props: {
  19666. name: String,
  19667. id: String,
  19668. modelValue: {
  19669. type: [Array, String, Number, Boolean, Object],
  19670. default: void 0
  19671. },
  19672. autocomplete: {
  19673. type: String,
  19674. default: "off"
  19675. },
  19676. automaticDropdown: Boolean,
  19677. size: {
  19678. type: String,
  19679. validator: isValidComponentSize
  19680. },
  19681. effect: {
  19682. type: String,
  19683. default: "light"
  19684. },
  19685. disabled: Boolean,
  19686. clearable: Boolean,
  19687. filterable: Boolean,
  19688. allowCreate: Boolean,
  19689. loading: Boolean,
  19690. popperClass: {
  19691. type: String,
  19692. default: ""
  19693. },
  19694. remote: Boolean,
  19695. loadingText: String,
  19696. noMatchText: String,
  19697. noDataText: String,
  19698. remoteMethod: Function,
  19699. filterMethod: Function,
  19700. multiple: Boolean,
  19701. multipleLimit: {
  19702. type: Number,
  19703. default: 0
  19704. },
  19705. placeholder: {
  19706. type: String
  19707. },
  19708. defaultFirstOption: Boolean,
  19709. reserveKeyword: {
  19710. type: Boolean,
  19711. default: true
  19712. },
  19713. valueKey: {
  19714. type: String,
  19715. default: "value"
  19716. },
  19717. collapseTags: Boolean,
  19718. collapseTagsTooltip: {
  19719. type: Boolean,
  19720. default: false
  19721. },
  19722. popperAppendToBody: {
  19723. type: Boolean,
  19724. default: void 0
  19725. },
  19726. teleported: useTooltipContentProps.teleported,
  19727. persistent: {
  19728. type: Boolean,
  19729. default: true
  19730. },
  19731. clearIcon: {
  19732. type: [String, Object],
  19733. default: circleClose
  19734. },
  19735. fitInputWidth: {
  19736. type: Boolean,
  19737. default: false
  19738. },
  19739. suffixIcon: {
  19740. type: [String, Object],
  19741. default: arrowUp
  19742. },
  19743. tagType: __spreadProps(__spreadValues({}, tagProps.type), { default: "info" })
  19744. },
  19745. emits: [
  19746. UPDATE_MODEL_EVENT,
  19747. CHANGE_EVENT,
  19748. "remove-tag",
  19749. "clear",
  19750. "visible-change",
  19751. "focus",
  19752. "blur"
  19753. ],
  19754. setup(props, ctx) {
  19755. const nsSelect = useNamespace("select");
  19756. const nsInput = useNamespace("input");
  19757. const { t } = useLocale();
  19758. const states = useSelectStates(props);
  19759. const {
  19760. optionsArray,
  19761. selectSize,
  19762. readonly: readonly2,
  19763. handleResize,
  19764. collapseTagSize,
  19765. debouncedOnInputChange,
  19766. debouncedQueryChange,
  19767. deletePrevTag,
  19768. deleteTag,
  19769. deleteSelected,
  19770. handleOptionSelect,
  19771. scrollToOption,
  19772. setSelected,
  19773. resetInputHeight,
  19774. managePlaceholder,
  19775. showClose,
  19776. selectDisabled,
  19777. iconComponent,
  19778. iconReverse,
  19779. showNewOption,
  19780. emptyText,
  19781. toggleLastOptionHitState,
  19782. resetInputState,
  19783. handleComposition,
  19784. onOptionCreate,
  19785. onOptionDestroy,
  19786. handleMenuEnter,
  19787. handleFocus,
  19788. blur,
  19789. handleBlur,
  19790. handleClearClick,
  19791. handleClose,
  19792. toggleMenu,
  19793. selectOption,
  19794. getValueKey,
  19795. navigateOptions,
  19796. dropMenuVisible,
  19797. reference: reference2,
  19798. input,
  19799. tooltipRef,
  19800. tags,
  19801. selectWrapper,
  19802. scrollbar,
  19803. queryChange,
  19804. groupQueryChange
  19805. } = useSelect$1(props, states, ctx);
  19806. const { focus } = useFocus(reference2);
  19807. const {
  19808. inputWidth,
  19809. selected,
  19810. inputLength,
  19811. filteredOptionsCount,
  19812. visible,
  19813. softFocus,
  19814. selectedLabel,
  19815. hoverIndex,
  19816. query,
  19817. inputHovering,
  19818. currentPlaceholder,
  19819. menuVisibleOnFocus,
  19820. isOnComposition,
  19821. isSilentBlur,
  19822. options,
  19823. cachedOptions,
  19824. optionsCount,
  19825. prefixWidth,
  19826. tagInMultiLine
  19827. } = toRefs(states);
  19828. const wrapperKls = computed(() => {
  19829. const classList = [nsSelect.b()];
  19830. const _selectSize = unref(selectSize);
  19831. if (_selectSize) {
  19832. classList.push(nsSelect.m(_selectSize));
  19833. }
  19834. if (props.disabled) {
  19835. classList.push(nsSelect.m("disabled"));
  19836. }
  19837. return classList;
  19838. });
  19839. const selectTagsStyle = computed(() => ({
  19840. maxWidth: `${unref(inputWidth) - 32}px`,
  19841. width: "100%"
  19842. }));
  19843. provide(selectKey, reactive({
  19844. props,
  19845. options,
  19846. optionsArray,
  19847. cachedOptions,
  19848. optionsCount,
  19849. filteredOptionsCount,
  19850. hoverIndex,
  19851. handleOptionSelect,
  19852. onOptionCreate,
  19853. onOptionDestroy,
  19854. selectWrapper,
  19855. selected,
  19856. setSelected,
  19857. queryChange,
  19858. groupQueryChange
  19859. }));
  19860. onMounted(() => {
  19861. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || t("el.select.placeholder");
  19862. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  19863. currentPlaceholder.value = "";
  19864. }
  19865. addResizeListener(selectWrapper.value, handleResize);
  19866. if (reference2.value && reference2.value.$el) {
  19867. const input2 = reference2.value.input;
  19868. states.initialInputHeight = input2.getBoundingClientRect().height || getComponentSize(selectSize.value);
  19869. }
  19870. if (props.remote && props.multiple) {
  19871. resetInputHeight();
  19872. }
  19873. nextTick(() => {
  19874. if (!reference2.value)
  19875. return;
  19876. if (reference2.value.$el) {
  19877. inputWidth.value = reference2.value.$el.getBoundingClientRect().width;
  19878. }
  19879. if (ctx.slots.prefix) {
  19880. const inputChildNodes = reference2.value.$el.childNodes;
  19881. const input2 = Array.from(inputChildNodes).find((item) => item.tagName === "INPUT");
  19882. const prefix = reference2.value.$el.querySelector(`.${nsInput.e("prefix")}`);
  19883. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  19884. if (states.prefixWidth) {
  19885. input2.style.paddingLeft = `${Math.max(states.prefixWidth, 30)}px`;
  19886. }
  19887. }
  19888. });
  19889. setSelected();
  19890. });
  19891. onBeforeUnmount(() => {
  19892. removeResizeListener(selectWrapper.value, handleResize);
  19893. });
  19894. if (props.multiple && !Array.isArray(props.modelValue)) {
  19895. ctx.emit(UPDATE_MODEL_EVENT, []);
  19896. }
  19897. if (!props.multiple && Array.isArray(props.modelValue)) {
  19898. ctx.emit(UPDATE_MODEL_EVENT, "");
  19899. }
  19900. const popperPaneRef = computed(() => {
  19901. var _a2, _b2;
  19902. return (_b2 = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  19903. });
  19904. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$2, "popperAppendToBody");
  19905. return {
  19906. tagInMultiLine,
  19907. prefixWidth,
  19908. selectSize,
  19909. readonly: readonly2,
  19910. handleResize,
  19911. collapseTagSize,
  19912. debouncedOnInputChange,
  19913. debouncedQueryChange,
  19914. deletePrevTag,
  19915. deleteTag,
  19916. deleteSelected,
  19917. handleOptionSelect,
  19918. scrollToOption,
  19919. inputWidth,
  19920. selected,
  19921. inputLength,
  19922. filteredOptionsCount,
  19923. visible,
  19924. softFocus,
  19925. selectedLabel,
  19926. hoverIndex,
  19927. query,
  19928. inputHovering,
  19929. currentPlaceholder,
  19930. menuVisibleOnFocus,
  19931. isOnComposition,
  19932. isSilentBlur,
  19933. options,
  19934. resetInputHeight,
  19935. managePlaceholder,
  19936. showClose,
  19937. selectDisabled,
  19938. iconComponent,
  19939. iconReverse,
  19940. showNewOption,
  19941. emptyText,
  19942. toggleLastOptionHitState,
  19943. resetInputState,
  19944. handleComposition,
  19945. handleMenuEnter,
  19946. handleFocus,
  19947. blur,
  19948. handleBlur,
  19949. handleClearClick,
  19950. handleClose,
  19951. toggleMenu,
  19952. selectOption,
  19953. getValueKey,
  19954. navigateOptions,
  19955. dropMenuVisible,
  19956. focus,
  19957. reference: reference2,
  19958. input,
  19959. tooltipRef,
  19960. popperPaneRef,
  19961. tags,
  19962. selectWrapper,
  19963. scrollbar,
  19964. wrapperKls,
  19965. selectTagsStyle,
  19966. compatTeleported,
  19967. nsSelect
  19968. };
  19969. }
  19970. });
  19971. const _hoisted_1$j = { class: "select-trigger" };
  19972. const _hoisted_2$g = ["disabled", "autocomplete"];
  19973. const _hoisted_3$b = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  19974. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  19975. const _component_el_tag = resolveComponent("el-tag");
  19976. const _component_el_tooltip = resolveComponent("el-tooltip");
  19977. const _component_el_icon = resolveComponent("el-icon");
  19978. const _component_el_input = resolveComponent("el-input");
  19979. const _component_el_option = resolveComponent("el-option");
  19980. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  19981. const _component_el_select_menu = resolveComponent("el-select-menu");
  19982. const _directive_click_outside = resolveDirective("click-outside");
  19983. return withDirectives((openBlock(), createElementBlock("div", {
  19984. ref: "selectWrapper",
  19985. class: normalizeClass(_ctx.wrapperKls),
  19986. onClick: _cache[24] || (_cache[24] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  19987. }, [
  19988. createVNode(_component_el_tooltip, {
  19989. ref: "tooltipRef",
  19990. visible: _ctx.dropMenuVisible,
  19991. "onUpdate:visible": _cache[23] || (_cache[23] = ($event) => _ctx.dropMenuVisible = $event),
  19992. placement: "bottom-start",
  19993. teleported: _ctx.compatTeleported,
  19994. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  19995. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  19996. effect: _ctx.effect,
  19997. pure: "",
  19998. trigger: "click",
  19999. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  20000. "stop-popper-mouse-event": false,
  20001. "gpu-acceleration": false,
  20002. persistent: _ctx.persistent,
  20003. onShow: _ctx.handleMenuEnter
  20004. }, {
  20005. default: withCtx(() => [
  20006. createElementVNode("div", _hoisted_1$j, [
  20007. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  20008. key: 0,
  20009. ref: "tags",
  20010. class: normalizeClass(_ctx.nsSelect.e("tags")),
  20011. style: normalizeStyle(_ctx.selectTagsStyle)
  20012. }, [
  20013. _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createElementBlock("span", {
  20014. key: 0,
  20015. class: normalizeClass([
  20016. _ctx.nsSelect.b("tags-wrapper"),
  20017. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  20018. ])
  20019. }, [
  20020. createVNode(_component_el_tag, {
  20021. closable: !_ctx.selectDisabled && !_ctx.selected[0].isDisabled,
  20022. size: _ctx.collapseTagSize,
  20023. hit: _ctx.selected[0].hitState,
  20024. type: _ctx.tagType,
  20025. "disable-transitions": "",
  20026. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.selected[0]))
  20027. }, {
  20028. default: withCtx(() => [
  20029. createElementVNode("span", {
  20030. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  20031. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 123 + "px" })
  20032. }, toDisplayString(_ctx.selected[0].currentLabel), 7)
  20033. ]),
  20034. _: 1
  20035. }, 8, ["closable", "size", "hit", "type"]),
  20036. _ctx.selected.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
  20037. key: 0,
  20038. closable: false,
  20039. size: _ctx.collapseTagSize,
  20040. type: _ctx.tagType,
  20041. "disable-transitions": ""
  20042. }, {
  20043. default: withCtx(() => [
  20044. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  20045. key: 0,
  20046. disabled: _ctx.dropMenuVisible,
  20047. "fallback-placements": ["bottom", "top", "right", "left"],
  20048. effect: _ctx.effect,
  20049. placement: "bottom",
  20050. teleported: false
  20051. }, {
  20052. default: withCtx(() => [
  20053. createElementVNode("span", {
  20054. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  20055. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3)
  20056. ]),
  20057. content: withCtx(() => [
  20058. createElementVNode("div", {
  20059. class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  20060. }, [
  20061. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item, idx) => {
  20062. return openBlock(), createElementBlock("div", {
  20063. key: idx,
  20064. class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  20065. }, [
  20066. (openBlock(), createBlock(_component_el_tag, {
  20067. key: _ctx.getValueKey(item),
  20068. class: "in-tooltip",
  20069. closable: !_ctx.selectDisabled && !item.isDisabled,
  20070. size: _ctx.collapseTagSize,
  20071. hit: item.hitState,
  20072. type: _ctx.tagType,
  20073. "disable-transitions": "",
  20074. style: { margin: "2px" },
  20075. onClose: ($event) => _ctx.deleteTag($event, item)
  20076. }, {
  20077. default: withCtx(() => [
  20078. createElementVNode("span", {
  20079. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  20080. style: normalizeStyle({
  20081. maxWidth: _ctx.inputWidth - 75 + "px"
  20082. })
  20083. }, toDisplayString(item.currentLabel), 7)
  20084. ]),
  20085. _: 2
  20086. }, 1032, ["closable", "size", "hit", "type", "onClose"]))
  20087. ], 2);
  20088. }), 128))
  20089. ], 2)
  20090. ]),
  20091. _: 1
  20092. }, 8, ["disabled", "effect"])) : (openBlock(), createElementBlock("span", {
  20093. key: 1,
  20094. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  20095. }, "+ " + toDisplayString(_ctx.selected.length - 1), 3))
  20096. ]),
  20097. _: 1
  20098. }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
  20099. ], 2)) : createCommentVNode("v-if", true),
  20100. createCommentVNode(" <div> "),
  20101. !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
  20102. key: 1,
  20103. onAfterLeave: _ctx.resetInputHeight
  20104. }, {
  20105. default: withCtx(() => [
  20106. createElementVNode("span", {
  20107. class: normalizeClass([
  20108. _ctx.nsSelect.b("tags-wrapper"),
  20109. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  20110. ])
  20111. }, [
  20112. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
  20113. return openBlock(), createBlock(_component_el_tag, {
  20114. key: _ctx.getValueKey(item),
  20115. closable: !_ctx.selectDisabled && !item.isDisabled,
  20116. size: _ctx.collapseTagSize,
  20117. hit: item.hitState,
  20118. type: _ctx.tagType,
  20119. "disable-transitions": "",
  20120. onClose: ($event) => _ctx.deleteTag($event, item)
  20121. }, {
  20122. default: withCtx(() => [
  20123. createElementVNode("span", {
  20124. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  20125. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  20126. }, toDisplayString(item.currentLabel), 7)
  20127. ]),
  20128. _: 2
  20129. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  20130. }), 128))
  20131. ], 2)
  20132. ]),
  20133. _: 1
  20134. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  20135. createCommentVNode(" </div> "),
  20136. _ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
  20137. key: 2,
  20138. ref: "input",
  20139. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.query = $event),
  20140. type: "text",
  20141. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  20142. disabled: _ctx.selectDisabled,
  20143. autocomplete: _ctx.autocomplete,
  20144. style: normalizeStyle({
  20145. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  20146. flexGrow: 1,
  20147. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  20148. maxWidth: `${_ctx.inputWidth - 42}px`
  20149. }),
  20150. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  20151. onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  20152. onKeyup: _cache[4] || (_cache[4] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  20153. onKeydown: [
  20154. _cache[5] || (_cache[5] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  20155. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  20156. _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  20157. _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  20158. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  20159. _cache[10] || (_cache[10] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  20160. _cache[11] || (_cache[11] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  20161. ],
  20162. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20163. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20164. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20165. onInput: _cache[15] || (_cache[15] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  20166. }, null, 46, _hoisted_2$g)), [
  20167. [vModelText, _ctx.query]
  20168. ]) : createCommentVNode("v-if", true)
  20169. ], 6)) : createCommentVNode("v-if", true),
  20170. createVNode(_component_el_input, {
  20171. id: _ctx.id,
  20172. ref: "reference",
  20173. modelValue: _ctx.selectedLabel,
  20174. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.selectedLabel = $event),
  20175. type: "text",
  20176. placeholder: _ctx.currentPlaceholder,
  20177. name: _ctx.name,
  20178. autocomplete: _ctx.autocomplete,
  20179. size: _ctx.selectSize,
  20180. disabled: _ctx.selectDisabled,
  20181. readonly: _ctx.readonly,
  20182. "validate-event": false,
  20183. class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  20184. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  20185. onFocus: _ctx.handleFocus,
  20186. onBlur: _ctx.handleBlur,
  20187. onInput: _ctx.debouncedOnInputChange,
  20188. onPaste: _ctx.debouncedOnInputChange,
  20189. onCompositionstart: _ctx.handleComposition,
  20190. onCompositionupdate: _ctx.handleComposition,
  20191. onCompositionend: _ctx.handleComposition,
  20192. onKeydown: [
  20193. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  20194. _cache[18] || (_cache[18] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  20195. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  20196. _cache[19] || (_cache[19] = withKeys(withModifiers(($event) => _ctx.visible = false, ["stop", "prevent"]), ["esc"])),
  20197. _cache[20] || (_cache[20] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  20198. ],
  20199. onMouseenter: _cache[21] || (_cache[21] = ($event) => _ctx.inputHovering = true),
  20200. onMouseleave: _cache[22] || (_cache[22] = ($event) => _ctx.inputHovering = false)
  20201. }, createSlots({
  20202. suffix: withCtx(() => [
  20203. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  20204. key: 0,
  20205. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  20206. }, {
  20207. default: withCtx(() => [
  20208. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  20209. ]),
  20210. _: 1
  20211. }, 8, ["class"])) : createCommentVNode("v-if", true),
  20212. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  20213. key: 1,
  20214. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  20215. onClick: _ctx.handleClearClick
  20216. }, {
  20217. default: withCtx(() => [
  20218. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  20219. ]),
  20220. _: 1
  20221. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  20222. ]),
  20223. _: 2
  20224. }, [
  20225. _ctx.$slots.prefix ? {
  20226. name: "prefix",
  20227. fn: withCtx(() => [
  20228. createElementVNode("div", _hoisted_3$b, [
  20229. renderSlot(_ctx.$slots, "prefix")
  20230. ])
  20231. ])
  20232. } : void 0
  20233. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  20234. ])
  20235. ]),
  20236. content: withCtx(() => [
  20237. createVNode(_component_el_select_menu, null, {
  20238. default: withCtx(() => [
  20239. withDirectives(createVNode(_component_el_scrollbar, {
  20240. ref: "scrollbar",
  20241. tag: "ul",
  20242. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  20243. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  20244. class: normalizeClass([
  20245. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  20246. ])
  20247. }, {
  20248. default: withCtx(() => [
  20249. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  20250. key: 0,
  20251. value: _ctx.query,
  20252. created: true
  20253. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  20254. renderSlot(_ctx.$slots, "default")
  20255. ]),
  20256. _: 3
  20257. }, 8, ["wrap-class", "view-class", "class"]), [
  20258. [vShow, _ctx.options.size > 0 && !_ctx.loading]
  20259. ]),
  20260. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  20261. _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
  20262. key: 1,
  20263. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  20264. }, toDisplayString(_ctx.emptyText), 3))
  20265. ], 2112)) : createCommentVNode("v-if", true)
  20266. ]),
  20267. _: 3
  20268. })
  20269. ]),
  20270. _: 3
  20271. }, 8, ["visible", "teleported", "popper-class", "effect", "transition", "persistent", "onShow"])
  20272. ], 2)), [
  20273. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  20274. ]);
  20275. }
  20276. var Select$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["render", _sfc_render$d], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);
  20277. const _sfc_main$r = defineComponent({
  20278. name: "ElOptionGroup",
  20279. componentName: "ElOptionGroup",
  20280. props: {
  20281. label: String,
  20282. disabled: {
  20283. type: Boolean,
  20284. default: false
  20285. }
  20286. },
  20287. setup(props) {
  20288. const ns = useNamespace("select");
  20289. const visible = ref(true);
  20290. const instance = getCurrentInstance();
  20291. const children = ref([]);
  20292. provide(selectGroupKey, reactive(__spreadValues({}, toRefs(props))));
  20293. const select = inject(selectKey);
  20294. onMounted(() => {
  20295. children.value = flattedChildren(instance.subTree);
  20296. });
  20297. const flattedChildren = (node) => {
  20298. const children2 = [];
  20299. if (Array.isArray(node.children)) {
  20300. node.children.forEach((child) => {
  20301. var _a2;
  20302. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  20303. children2.push(child.component.proxy);
  20304. } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
  20305. children2.push(...flattedChildren(child));
  20306. }
  20307. });
  20308. }
  20309. return children2;
  20310. };
  20311. const { groupQueryChange } = toRaw(select);
  20312. watch(groupQueryChange, () => {
  20313. visible.value = children.value.some((option) => option.visible === true);
  20314. });
  20315. return {
  20316. visible,
  20317. ns
  20318. };
  20319. }
  20320. });
  20321. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  20322. return withDirectives((openBlock(), createElementBlock("ul", {
  20323. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  20324. }, [
  20325. createElementVNode("li", {
  20326. class: normalizeClass(_ctx.ns.be("group", "title"))
  20327. }, toDisplayString(_ctx.label), 3),
  20328. createElementVNode("li", null, [
  20329. createElementVNode("ul", {
  20330. class: normalizeClass(_ctx.ns.b("group"))
  20331. }, [
  20332. renderSlot(_ctx.$slots, "default")
  20333. ], 2)
  20334. ])
  20335. ], 2)), [
  20336. [vShow, _ctx.visible]
  20337. ]);
  20338. }
  20339. var OptionGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["render", _sfc_render$c], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);
  20340. const ElSelect = withInstall(Select$1, {
  20341. Option,
  20342. OptionGroup
  20343. });
  20344. const ElOption = withNoopInstall(Option);
  20345. withNoopInstall(OptionGroup);
  20346. const progressProps = buildProps({
  20347. type: {
  20348. type: String,
  20349. default: "line",
  20350. values: ["line", "circle", "dashboard"]
  20351. },
  20352. percentage: {
  20353. type: Number,
  20354. default: 0,
  20355. validator: (val) => val >= 0 && val <= 100
  20356. },
  20357. status: {
  20358. type: String,
  20359. default: "",
  20360. values: ["", "success", "exception", "warning"]
  20361. },
  20362. indeterminate: {
  20363. type: Boolean,
  20364. default: false
  20365. },
  20366. duration: {
  20367. type: Number,
  20368. default: 3
  20369. },
  20370. strokeWidth: {
  20371. type: Number,
  20372. default: 6
  20373. },
  20374. strokeLinecap: {
  20375. type: definePropType(String),
  20376. default: "round"
  20377. },
  20378. textInside: {
  20379. type: Boolean,
  20380. default: false
  20381. },
  20382. width: {
  20383. type: Number,
  20384. default: 126
  20385. },
  20386. showText: {
  20387. type: Boolean,
  20388. default: true
  20389. },
  20390. color: {
  20391. type: definePropType([
  20392. String,
  20393. Array,
  20394. Function
  20395. ]),
  20396. default: ""
  20397. },
  20398. format: {
  20399. type: definePropType(Function),
  20400. default: (percentage) => `${percentage}%`
  20401. }
  20402. });
  20403. const _sfc_main$q = defineComponent({
  20404. name: "ElProgress",
  20405. components: {
  20406. ElIcon,
  20407. CircleCheck: circleCheck,
  20408. CircleClose: circleClose,
  20409. Check: check,
  20410. Close: close,
  20411. WarningFilled: warningFilled
  20412. },
  20413. props: progressProps,
  20414. setup(props) {
  20415. const ns = useNamespace("progress");
  20416. const barStyle = computed(() => ({
  20417. width: `${props.percentage}%`,
  20418. animationDuration: `${props.duration}s`,
  20419. backgroundColor: getCurrentColor(props.percentage)
  20420. }));
  20421. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  20422. const radius = computed(() => {
  20423. if (props.type === "circle" || props.type === "dashboard") {
  20424. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  20425. } else {
  20426. return 0;
  20427. }
  20428. });
  20429. const trackPath = computed(() => {
  20430. const r = radius.value;
  20431. const isDashboard = props.type === "dashboard";
  20432. return `
  20433. M 50 50
  20434. m 0 ${isDashboard ? "" : "-"}${r}
  20435. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  20436. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  20437. `;
  20438. });
  20439. const perimeter = computed(() => 2 * Math.PI * radius.value);
  20440. const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
  20441. const strokeDashoffset = computed(() => {
  20442. const offset2 = -1 * perimeter.value * (1 - rate.value) / 2;
  20443. return `${offset2}px`;
  20444. });
  20445. const trailPathStyle = computed(() => ({
  20446. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  20447. strokeDashoffset: strokeDashoffset.value
  20448. }));
  20449. const circlePathStyle = computed(() => ({
  20450. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  20451. strokeDashoffset: strokeDashoffset.value,
  20452. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"
  20453. }));
  20454. const stroke = computed(() => {
  20455. let ret;
  20456. if (props.color) {
  20457. ret = getCurrentColor(props.percentage);
  20458. } else {
  20459. switch (props.status) {
  20460. case "success":
  20461. ret = "#13ce66";
  20462. break;
  20463. case "exception":
  20464. ret = "#ff4949";
  20465. break;
  20466. case "warning":
  20467. ret = "#e6a23c";
  20468. break;
  20469. default:
  20470. ret = "#20a0ff";
  20471. }
  20472. }
  20473. return ret;
  20474. });
  20475. const statusIcon = computed(() => {
  20476. if (props.status === "warning") {
  20477. return warningFilled;
  20478. }
  20479. if (props.type === "line") {
  20480. return props.status === "success" ? circleCheck : circleClose;
  20481. } else {
  20482. return props.status === "success" ? check : close;
  20483. }
  20484. });
  20485. const progressTextSize = computed(() => {
  20486. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  20487. });
  20488. const content2 = computed(() => props.format(props.percentage));
  20489. const getCurrentColor = (percentage) => {
  20490. var _a2;
  20491. const { color } = props;
  20492. if (typeof color === "function") {
  20493. return color(percentage);
  20494. } else if (typeof color === "string") {
  20495. return color;
  20496. } else {
  20497. const span = 100 / color.length;
  20498. const seriesColors = color.map((seriesColor, index) => {
  20499. if (typeof seriesColor === "string") {
  20500. return {
  20501. color: seriesColor,
  20502. percentage: (index + 1) * span
  20503. };
  20504. }
  20505. return seriesColor;
  20506. });
  20507. const colors = seriesColors.sort((a2, b2) => a2.percentage - b2.percentage);
  20508. for (const color2 of colors) {
  20509. if (color2.percentage > percentage)
  20510. return color2.color;
  20511. }
  20512. return (_a2 = colors[colors.length - 1]) == null ? void 0 : _a2.color;
  20513. }
  20514. };
  20515. const slotData = computed(() => {
  20516. return {
  20517. percentage: props.percentage
  20518. };
  20519. });
  20520. return {
  20521. ns,
  20522. barStyle,
  20523. relativeStrokeWidth,
  20524. radius,
  20525. trackPath,
  20526. perimeter,
  20527. rate,
  20528. strokeDashoffset,
  20529. trailPathStyle,
  20530. circlePathStyle,
  20531. stroke,
  20532. statusIcon,
  20533. progressTextSize,
  20534. content: content2,
  20535. slotData
  20536. };
  20537. }
  20538. });
  20539. const _hoisted_1$i = ["aria-valuenow"];
  20540. const _hoisted_2$f = { viewBox: "0 0 100 100" };
  20541. const _hoisted_3$a = ["d", "stroke-width"];
  20542. const _hoisted_4$9 = ["d", "stroke", "stroke-linecap", "stroke-width"];
  20543. const _hoisted_5$9 = { key: 0 };
  20544. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  20545. const _component_el_icon = resolveComponent("el-icon");
  20546. return openBlock(), createElementBlock("div", {
  20547. class: normalizeClass([
  20548. _ctx.ns.b(),
  20549. _ctx.ns.m(_ctx.type),
  20550. _ctx.ns.is(_ctx.status),
  20551. {
  20552. [_ctx.ns.m("without-text")]: !_ctx.showText,
  20553. [_ctx.ns.m("text-inside")]: _ctx.textInside
  20554. }
  20555. ]),
  20556. role: "progressbar",
  20557. "aria-valuenow": _ctx.percentage,
  20558. "aria-valuemin": "0",
  20559. "aria-valuemax": "100"
  20560. }, [
  20561. _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
  20562. key: 0,
  20563. class: normalizeClass(_ctx.ns.b("bar"))
  20564. }, [
  20565. createElementVNode("div", {
  20566. class: normalizeClass(_ctx.ns.be("bar", "outer")),
  20567. style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  20568. }, [
  20569. createElementVNode("div", {
  20570. class: normalizeClass([
  20571. _ctx.ns.be("bar", "inner"),
  20572. { [_ctx.ns.bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }
  20573. ]),
  20574. style: normalizeStyle(_ctx.barStyle)
  20575. }, [
  20576. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
  20577. key: 0,
  20578. class: normalizeClass(_ctx.ns.be("bar", "innerText"))
  20579. }, [
  20580. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20581. createElementVNode("span", null, toDisplayString(_ctx.content), 1)
  20582. ])
  20583. ], 2)) : createCommentVNode("v-if", true)
  20584. ], 6)
  20585. ], 6)
  20586. ], 2)) : (openBlock(), createElementBlock("div", {
  20587. key: 1,
  20588. class: normalizeClass(_ctx.ns.b("circle")),
  20589. style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  20590. }, [
  20591. (openBlock(), createElementBlock("svg", _hoisted_2$f, [
  20592. createElementVNode("path", {
  20593. class: normalizeClass(_ctx.ns.be("circle", "track")),
  20594. d: _ctx.trackPath,
  20595. stroke: "var(--el-fill-color-light, #e5e9f2)",
  20596. "stroke-width": _ctx.relativeStrokeWidth,
  20597. fill: "none",
  20598. style: normalizeStyle(_ctx.trailPathStyle)
  20599. }, null, 14, _hoisted_3$a),
  20600. createElementVNode("path", {
  20601. class: normalizeClass(_ctx.ns.be("circle", "path")),
  20602. d: _ctx.trackPath,
  20603. stroke: _ctx.stroke,
  20604. fill: "none",
  20605. "stroke-linecap": _ctx.strokeLinecap,
  20606. "stroke-width": _ctx.percentage ? _ctx.relativeStrokeWidth : 0,
  20607. style: normalizeStyle(_ctx.circlePathStyle)
  20608. }, null, 14, _hoisted_4$9)
  20609. ]))
  20610. ], 6)),
  20611. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
  20612. key: 2,
  20613. class: normalizeClass(_ctx.ns.e("text")),
  20614. style: normalizeStyle({ fontSize: `${_ctx.progressTextSize}px` })
  20615. }, [
  20616. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(_ctx.slotData)), () => [
  20617. !_ctx.status ? (openBlock(), createElementBlock("span", _hoisted_5$9, toDisplayString(_ctx.content), 1)) : (openBlock(), createBlock(_component_el_icon, { key: 1 }, {
  20618. default: withCtx(() => [
  20619. (openBlock(), createBlock(resolveDynamicComponent(_ctx.statusIcon)))
  20620. ]),
  20621. _: 1
  20622. }))
  20623. ])
  20624. ], 6)) : createCommentVNode("v-if", true)
  20625. ], 10, _hoisted_1$i);
  20626. }
  20627. var Progress = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["render", _sfc_render$b], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/progress/src/progress.vue"]]);
  20628. const ElProgress = withInstall(Progress);
  20629. const rateProps = buildProps({
  20630. modelValue: {
  20631. type: Number,
  20632. default: 0
  20633. },
  20634. lowThreshold: {
  20635. type: Number,
  20636. default: 2
  20637. },
  20638. highThreshold: {
  20639. type: Number,
  20640. default: 4
  20641. },
  20642. max: {
  20643. type: Number,
  20644. default: 5
  20645. },
  20646. colors: {
  20647. type: definePropType([Array, Object]),
  20648. default: () => mutable(["", "", ""])
  20649. },
  20650. voidColor: {
  20651. type: String,
  20652. default: ""
  20653. },
  20654. disabledVoidColor: {
  20655. type: String,
  20656. default: ""
  20657. },
  20658. icons: {
  20659. type: definePropType([Array, Object]),
  20660. default: () => [starFilled, starFilled, starFilled]
  20661. },
  20662. voidIcon: {
  20663. type: iconPropType,
  20664. default: () => star
  20665. },
  20666. disabledVoidIcon: {
  20667. type: iconPropType,
  20668. default: () => starFilled
  20669. },
  20670. disabled: {
  20671. type: Boolean,
  20672. default: false
  20673. },
  20674. allowHalf: {
  20675. type: Boolean,
  20676. default: false
  20677. },
  20678. showText: {
  20679. type: Boolean,
  20680. default: false
  20681. },
  20682. showScore: {
  20683. type: Boolean,
  20684. default: false
  20685. },
  20686. textColor: {
  20687. type: String,
  20688. default: ""
  20689. },
  20690. texts: {
  20691. type: definePropType(Array),
  20692. default: () => mutable([
  20693. "Extremely bad",
  20694. "Disappointed",
  20695. "Fair",
  20696. "Satisfied",
  20697. "Surprise"
  20698. ])
  20699. },
  20700. scoreTemplate: {
  20701. type: String,
  20702. default: "{value}"
  20703. },
  20704. size: {
  20705. type: String,
  20706. validator: isValidComponentSize
  20707. }
  20708. });
  20709. const rateEmits = {
  20710. change: (value) => typeof value === "number",
  20711. [UPDATE_MODEL_EVENT]: (value) => typeof value === "number"
  20712. };
  20713. const _hoisted_1$h = ["aria-valuenow", "aria-valuetext", "aria-valuemax"];
  20714. const _hoisted_2$e = ["onMousemove", "onClick"];
  20715. const __default__$5 = {
  20716. name: "ElRate"
  20717. };
  20718. const _sfc_main$p = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
  20719. props: rateProps,
  20720. emits: rateEmits,
  20721. setup(__props, { expose, emit }) {
  20722. const props = __props;
  20723. function getValueFromMap(value, map) {
  20724. const isExcludedObject = (val) => isObject$1(val);
  20725. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  20726. const val = map[key];
  20727. const excluded = isExcludedObject(val) ? val.excluded : false;
  20728. return excluded ? value < key : value <= key;
  20729. }).sort((a2, b2) => a2 - b2);
  20730. const matchedValue = map[matchedKeys[0]];
  20731. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  20732. }
  20733. const formContext = inject(formContextKey, void 0);
  20734. const rateSize = useSize();
  20735. const ns = useNamespace("rate");
  20736. const currentValue = ref(props.modelValue);
  20737. const hoverIndex = ref(-1);
  20738. const pointerAtLeftHalf = ref(true);
  20739. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  20740. const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  20741. const rateStyles = computed(() => {
  20742. return {
  20743. "--el-rate-void-color": props.voidColor,
  20744. "--el-rate-disabled-void-color": props.disabledVoidColor,
  20745. "--el-rate-fill-color": activeColor.value
  20746. };
  20747. });
  20748. const text = computed(() => {
  20749. let result = "";
  20750. if (props.showScore) {
  20751. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  20752. } else if (props.showText) {
  20753. result = props.texts[Math.ceil(currentValue.value) - 1];
  20754. }
  20755. return result;
  20756. });
  20757. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  20758. const colorMap = computed(() => isArray(props.colors) ? {
  20759. [props.lowThreshold]: props.colors[0],
  20760. [props.highThreshold]: { value: props.colors[1], excluded: true },
  20761. [props.max]: props.colors[2]
  20762. } : props.colors);
  20763. const activeColor = computed(() => {
  20764. const color = getValueFromMap(currentValue.value, colorMap.value);
  20765. return isObject$1(color) ? "" : color;
  20766. });
  20767. const decimalStyle = computed(() => {
  20768. let width = "";
  20769. if (rateDisabled.value) {
  20770. width = `${valueDecimal.value}%`;
  20771. } else if (props.allowHalf) {
  20772. width = "50%";
  20773. }
  20774. return {
  20775. color: activeColor.value,
  20776. width
  20777. };
  20778. });
  20779. const componentMap = computed(() => isArray(props.icons) ? {
  20780. [props.lowThreshold]: props.icons[0],
  20781. [props.highThreshold]: {
  20782. value: props.icons[1],
  20783. excluded: true
  20784. },
  20785. [props.max]: props.icons[2]
  20786. } : props.icons);
  20787. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  20788. const voidComponent = computed(() => rateDisabled.value ? props.disabledVoidIcon : props.voidIcon);
  20789. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  20790. const iconComponents = computed(() => {
  20791. const result = Array.from({ length: props.max });
  20792. const threshold = currentValue.value;
  20793. result.fill(activeComponent.value, 0, threshold);
  20794. result.fill(voidComponent.value, threshold, props.max);
  20795. return result;
  20796. });
  20797. function showDecimalIcon(item) {
  20798. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  20799. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  20800. return showWhenDisabled || showWhenAllowHalf;
  20801. }
  20802. function selectValue(value) {
  20803. if (rateDisabled.value) {
  20804. return;
  20805. }
  20806. if (props.allowHalf && pointerAtLeftHalf.value) {
  20807. emit(UPDATE_MODEL_EVENT, currentValue.value);
  20808. if (props.modelValue !== currentValue.value) {
  20809. emit("change", currentValue.value);
  20810. }
  20811. } else {
  20812. emit(UPDATE_MODEL_EVENT, value);
  20813. if (props.modelValue !== value) {
  20814. emit("change", value);
  20815. }
  20816. }
  20817. }
  20818. function handleKey(e) {
  20819. if (rateDisabled.value) {
  20820. return;
  20821. }
  20822. let _currentValue = currentValue.value;
  20823. const code = e.code;
  20824. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  20825. if (props.allowHalf) {
  20826. _currentValue += 0.5;
  20827. } else {
  20828. _currentValue += 1;
  20829. }
  20830. e.stopPropagation();
  20831. e.preventDefault();
  20832. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  20833. if (props.allowHalf) {
  20834. _currentValue -= 0.5;
  20835. } else {
  20836. _currentValue -= 1;
  20837. }
  20838. e.stopPropagation();
  20839. e.preventDefault();
  20840. }
  20841. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  20842. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  20843. emit(UPDATE_MODEL_EVENT, _currentValue);
  20844. emit("change", _currentValue);
  20845. return _currentValue;
  20846. }
  20847. function setCurrentValue(value, event) {
  20848. if (rateDisabled.value) {
  20849. return;
  20850. }
  20851. if (props.allowHalf) {
  20852. let target = event.target;
  20853. if (hasClass(target, ns.e("item"))) {
  20854. target = target.querySelector(`.${ns.e("icon")}`);
  20855. }
  20856. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  20857. target = target.parentNode;
  20858. }
  20859. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  20860. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  20861. } else {
  20862. currentValue.value = value;
  20863. }
  20864. hoverIndex.value = value;
  20865. }
  20866. function resetCurrentValue() {
  20867. if (rateDisabled.value) {
  20868. return;
  20869. }
  20870. if (props.allowHalf) {
  20871. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20872. }
  20873. currentValue.value = props.modelValue;
  20874. hoverIndex.value = -1;
  20875. }
  20876. watch(() => props.modelValue, (val) => {
  20877. currentValue.value = val;
  20878. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  20879. });
  20880. if (!props.modelValue) {
  20881. emit(UPDATE_MODEL_EVENT, 0);
  20882. }
  20883. expose({
  20884. setCurrentValue,
  20885. resetCurrentValue
  20886. });
  20887. return (_ctx, _cache) => {
  20888. return openBlock(), createElementBlock("div", {
  20889. class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
  20890. role: "slider",
  20891. "aria-valuenow": currentValue.value,
  20892. "aria-valuetext": unref(text),
  20893. "aria-valuemin": "0",
  20894. "aria-valuemax": _ctx.max,
  20895. tabindex: "0",
  20896. style: normalizeStyle(unref(rateStyles)),
  20897. onKeydown: handleKey
  20898. }, [
  20899. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
  20900. return openBlock(), createElementBlock("span", {
  20901. key,
  20902. class: normalizeClass(unref(ns).e("item")),
  20903. onMousemove: ($event) => setCurrentValue(item, $event),
  20904. onMouseleave: resetCurrentValue,
  20905. onClick: ($event) => selectValue(item)
  20906. }, [
  20907. createVNode(unref(ElIcon), {
  20908. class: normalizeClass([
  20909. unref(ns).e("icon"),
  20910. { hover: hoverIndex.value === item },
  20911. unref(ns).is("active", item <= currentValue.value)
  20912. ])
  20913. }, {
  20914. default: withCtx(() => [
  20915. !showDecimalIcon(item) ? (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponents)[item - 1]), { key: 0 })) : createCommentVNode("v-if", true),
  20916. showDecimalIcon(item) ? (openBlock(), createBlock(unref(ElIcon), {
  20917. key: 1,
  20918. style: normalizeStyle(unref(decimalStyle)),
  20919. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  20920. }, {
  20921. default: withCtx(() => [
  20922. (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
  20923. ]),
  20924. _: 1
  20925. }, 8, ["style", "class"])) : createCommentVNode("v-if", true)
  20926. ]),
  20927. _: 2
  20928. }, 1032, ["class"])
  20929. ], 42, _hoisted_2$e);
  20930. }), 128)),
  20931. _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
  20932. key: 0,
  20933. class: normalizeClass(unref(ns).e("text"))
  20934. }, toDisplayString(unref(text)), 3)) : createCommentVNode("v-if", true)
  20935. ], 46, _hoisted_1$h);
  20936. };
  20937. }
  20938. }));
  20939. var Rate = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/rate/src/rate.vue"]]);
  20940. const ElRate = withInstall(Rate);
  20941. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  20942. return typeof value === "number" && value !== value;
  20943. };
  20944. function isEqual(first, second) {
  20945. if (first === second) {
  20946. return true;
  20947. }
  20948. if (safeIsNaN(first) && safeIsNaN(second)) {
  20949. return true;
  20950. }
  20951. return false;
  20952. }
  20953. function areInputsEqual(newInputs, lastInputs) {
  20954. if (newInputs.length !== lastInputs.length) {
  20955. return false;
  20956. }
  20957. for (var i = 0; i < newInputs.length; i++) {
  20958. if (!isEqual(newInputs[i], lastInputs[i])) {
  20959. return false;
  20960. }
  20961. }
  20962. return true;
  20963. }
  20964. function memoizeOne(resultFn, isEqual2) {
  20965. if (isEqual2 === void 0) {
  20966. isEqual2 = areInputsEqual;
  20967. }
  20968. var cache2 = null;
  20969. function memoized() {
  20970. var newArgs = [];
  20971. for (var _i = 0; _i < arguments.length; _i++) {
  20972. newArgs[_i] = arguments[_i];
  20973. }
  20974. if (cache2 && cache2.lastThis === this && isEqual2(newArgs, cache2.lastArgs)) {
  20975. return cache2.lastResult;
  20976. }
  20977. var lastResult = resultFn.apply(this, newArgs);
  20978. cache2 = {
  20979. lastResult,
  20980. lastArgs: newArgs,
  20981. lastThis: this
  20982. };
  20983. return lastResult;
  20984. }
  20985. memoized.clear = function clear() {
  20986. cache2 = null;
  20987. };
  20988. return memoized;
  20989. }
  20990. const useCache = () => {
  20991. const vm = getCurrentInstance();
  20992. const props = vm.proxy.$props;
  20993. return computed(() => {
  20994. const _getItemStyleCache = (_2, __, ___) => ({});
  20995. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  20996. });
  20997. };
  20998. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  20999. const ITEM_RENDER_EVT = "itemRendered";
  21000. const SCROLL_EVT = "scroll";
  21001. const FORWARD = "forward";
  21002. const BACKWARD = "backward";
  21003. const AUTO_ALIGNMENT = "auto";
  21004. const SMART_ALIGNMENT = "smart";
  21005. const START_ALIGNMENT = "start";
  21006. const CENTERED_ALIGNMENT = "center";
  21007. const END_ALIGNMENT = "end";
  21008. const HORIZONTAL = "horizontal";
  21009. const VERTICAL = "vertical";
  21010. const LTR = "ltr";
  21011. const RTL = "rtl";
  21012. const RTL_OFFSET_NAG = "negative";
  21013. const RTL_OFFSET_POS_ASC = "positive-ascending";
  21014. const RTL_OFFSET_POS_DESC = "positive-descending";
  21015. const ScrollbarDirKey = {
  21016. [HORIZONTAL]: "left",
  21017. [VERTICAL]: "top"
  21018. };
  21019. const SCROLLBAR_MIN_SIZE = 20;
  21020. const LayoutKeys = {
  21021. [HORIZONTAL]: "deltaX",
  21022. [VERTICAL]: "deltaY"
  21023. };
  21024. const useWheel = ({ atEndEdge, atStartEdge, layout: layout2 }, onWheelDelta) => {
  21025. let frameHandle;
  21026. let offset2 = 0;
  21027. const hasReachedEdge = (offset22) => {
  21028. const edgeReached = offset22 < 0 && atStartEdge.value || offset22 > 0 && atEndEdge.value;
  21029. return edgeReached;
  21030. };
  21031. const onWheel = (e) => {
  21032. cAF(frameHandle);
  21033. const newOffset = e[LayoutKeys[layout2.value]];
  21034. if (hasReachedEdge(offset2) && hasReachedEdge(offset2 + newOffset))
  21035. return;
  21036. offset2 += newOffset;
  21037. if (!isFirefox()) {
  21038. e.preventDefault();
  21039. }
  21040. frameHandle = rAF(() => {
  21041. onWheelDelta(offset2);
  21042. offset2 = 0;
  21043. });
  21044. };
  21045. return {
  21046. hasReachedEdge,
  21047. onWheel
  21048. };
  21049. };
  21050. const itemSize = buildProp({
  21051. type: definePropType([Number, Function]),
  21052. required: true
  21053. });
  21054. const estimatedItemSize = buildProp({
  21055. type: Number
  21056. });
  21057. const cache = buildProp({
  21058. type: Number,
  21059. default: 2
  21060. });
  21061. const direction = buildProp({
  21062. type: String,
  21063. values: ["ltr", "rtl"],
  21064. default: "ltr"
  21065. });
  21066. const initScrollOffset = buildProp({
  21067. type: Number,
  21068. default: 0
  21069. });
  21070. const total = buildProp({
  21071. type: Number,
  21072. required: true
  21073. });
  21074. const layout = buildProp({
  21075. type: String,
  21076. values: ["horizontal", "vertical"],
  21077. default: VERTICAL
  21078. });
  21079. const virtualizedProps = buildProps({
  21080. className: {
  21081. type: String,
  21082. default: ""
  21083. },
  21084. containerElement: {
  21085. type: definePropType([String, Object]),
  21086. default: "div"
  21087. },
  21088. data: {
  21089. type: definePropType(Array),
  21090. default: () => mutable([])
  21091. },
  21092. direction,
  21093. height: {
  21094. type: [String, Number],
  21095. required: true
  21096. },
  21097. innerElement: {
  21098. type: [String, Object],
  21099. default: "div"
  21100. },
  21101. style: {
  21102. type: definePropType([Object, String, Array])
  21103. },
  21104. useIsScrolling: {
  21105. type: Boolean,
  21106. default: false
  21107. },
  21108. width: {
  21109. type: [Number, String],
  21110. required: false
  21111. },
  21112. perfMode: {
  21113. type: Boolean,
  21114. default: true
  21115. },
  21116. scrollbarAlwaysOn: {
  21117. type: Boolean,
  21118. default: false
  21119. }
  21120. });
  21121. const virtualizedListProps = buildProps(__spreadValues({
  21122. cache,
  21123. estimatedItemSize,
  21124. layout,
  21125. initScrollOffset,
  21126. total,
  21127. itemSize
  21128. }, virtualizedProps));
  21129. const scrollbarSize = {
  21130. type: Number,
  21131. default: 6
  21132. };
  21133. const startGap = { type: Number, default: 2 };
  21134. const endGap = { type: Number, default: 2 };
  21135. buildProps(__spreadValues({
  21136. columnCache: cache,
  21137. columnWidth: itemSize,
  21138. estimatedColumnWidth: estimatedItemSize,
  21139. estimatedRowHeight: estimatedItemSize,
  21140. initScrollLeft: initScrollOffset,
  21141. initScrollTop: initScrollOffset,
  21142. rowCache: cache,
  21143. rowHeight: itemSize,
  21144. totalColumn: total,
  21145. totalRow: total,
  21146. hScrollbarSize: scrollbarSize,
  21147. vScrollbarSize: scrollbarSize,
  21148. scrollbarStartGap: startGap,
  21149. scrollbarEndGap: endGap
  21150. }, virtualizedProps));
  21151. const virtualizedScrollbarProps = buildProps({
  21152. alwaysOn: Boolean,
  21153. class: String,
  21154. layout,
  21155. total,
  21156. ratio: {
  21157. type: Number,
  21158. required: true
  21159. },
  21160. clientSize: {
  21161. type: Number,
  21162. required: true
  21163. },
  21164. scrollFrom: {
  21165. type: Number,
  21166. required: true
  21167. },
  21168. scrollbarSize,
  21169. startGap,
  21170. endGap,
  21171. visible: Boolean
  21172. });
  21173. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  21174. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  21175. let cachedRTLResult = null;
  21176. function getRTLOffsetType(recalculate = false) {
  21177. if (cachedRTLResult === null || recalculate) {
  21178. const outerDiv = document.createElement("div");
  21179. const outerStyle = outerDiv.style;
  21180. outerStyle.width = "50px";
  21181. outerStyle.height = "50px";
  21182. outerStyle.overflow = "scroll";
  21183. outerStyle.direction = "rtl";
  21184. const innerDiv = document.createElement("div");
  21185. const innerStyle = innerDiv.style;
  21186. innerStyle.width = "100px";
  21187. innerStyle.height = "100px";
  21188. outerDiv.appendChild(innerDiv);
  21189. document.body.appendChild(outerDiv);
  21190. if (outerDiv.scrollLeft > 0) {
  21191. cachedRTLResult = RTL_OFFSET_POS_DESC;
  21192. } else {
  21193. outerDiv.scrollLeft = 1;
  21194. if (outerDiv.scrollLeft === 0) {
  21195. cachedRTLResult = RTL_OFFSET_NAG;
  21196. } else {
  21197. cachedRTLResult = RTL_OFFSET_POS_ASC;
  21198. }
  21199. }
  21200. document.body.removeChild(outerDiv);
  21201. return cachedRTLResult;
  21202. }
  21203. return cachedRTLResult;
  21204. }
  21205. function renderThumbStyle({ move, size, bar }, layout2) {
  21206. const style = {};
  21207. const translate2 = `translate${bar.axis}(${move}px)`;
  21208. style[bar.size] = size;
  21209. style.transform = translate2;
  21210. style.msTransform = translate2;
  21211. style.webkitTransform = translate2;
  21212. if (layout2 === "horizontal") {
  21213. style.height = "100%";
  21214. } else {
  21215. style.width = "100%";
  21216. }
  21217. return style;
  21218. }
  21219. const ScrollBar = defineComponent({
  21220. name: "ElVirtualScrollBar",
  21221. props: virtualizedScrollbarProps,
  21222. emits: ["scroll", "start-move", "stop-move"],
  21223. setup(props, { emit }) {
  21224. const GAP = computed(() => props.startGap + props.endGap);
  21225. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  21226. const nsScrollbar = useNamespace("scrollbar");
  21227. const trackRef = ref();
  21228. const thumbRef = ref();
  21229. let frameHandle = null;
  21230. let onselectstartStore = null;
  21231. const state = reactive({
  21232. isDragging: false,
  21233. traveled: 0
  21234. });
  21235. const bar = computed(() => BAR_MAP[props.layout]);
  21236. const trackSize = computed(() => props.clientSize - unref(GAP));
  21237. const trackStyle = computed(() => ({
  21238. position: "absolute",
  21239. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  21240. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  21241. [ScrollbarDirKey[props.layout]]: "2px",
  21242. right: "2px",
  21243. bottom: "2px",
  21244. borderRadius: "4px"
  21245. }));
  21246. const thumbSize = computed(() => {
  21247. const ratio = props.ratio;
  21248. const clientSize = props.clientSize;
  21249. if (ratio >= 100) {
  21250. return Number.POSITIVE_INFINITY;
  21251. }
  21252. if (ratio >= 50) {
  21253. return ratio * clientSize / 100;
  21254. }
  21255. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  21256. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  21257. });
  21258. const thumbStyle = computed(() => {
  21259. if (!Number.isFinite(thumbSize.value)) {
  21260. return {
  21261. display: "none"
  21262. };
  21263. }
  21264. const thumb = `${thumbSize.value}px`;
  21265. const style = renderThumbStyle({
  21266. bar: bar.value,
  21267. size: thumb,
  21268. move: state.traveled
  21269. }, props.layout);
  21270. return style;
  21271. });
  21272. const totalSteps = computed(() => Math.floor(props.clientSize - thumbSize.value - unref(GAP)));
  21273. const attachEvents = () => {
  21274. window.addEventListener("mousemove", onMouseMove);
  21275. window.addEventListener("mouseup", onMouseUp);
  21276. const thumbEl = unref(thumbRef);
  21277. if (!thumbEl)
  21278. return;
  21279. onselectstartStore = document.onselectstart;
  21280. document.onselectstart = () => false;
  21281. thumbEl.addEventListener("touchmove", onMouseMove);
  21282. thumbEl.addEventListener("touchend", onMouseUp);
  21283. };
  21284. const detachEvents = () => {
  21285. window.removeEventListener("mousemove", onMouseMove);
  21286. window.removeEventListener("mouseup", onMouseUp);
  21287. document.onselectstart = onselectstartStore;
  21288. onselectstartStore = null;
  21289. const thumbEl = unref(thumbRef);
  21290. if (!thumbEl)
  21291. return;
  21292. thumbEl.removeEventListener("touchmove", onMouseMove);
  21293. thumbEl.removeEventListener("touchend", onMouseUp);
  21294. };
  21295. const onThumbMouseDown = (e) => {
  21296. e.stopImmediatePropagation();
  21297. if (e.ctrlKey || [1, 2].includes(e.button)) {
  21298. return;
  21299. }
  21300. state.isDragging = true;
  21301. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  21302. emit("start-move");
  21303. attachEvents();
  21304. };
  21305. const onMouseUp = () => {
  21306. state.isDragging = false;
  21307. state[bar.value.axis] = 0;
  21308. emit("stop-move");
  21309. detachEvents();
  21310. };
  21311. const onMouseMove = (e) => {
  21312. const { isDragging } = state;
  21313. if (!isDragging)
  21314. return;
  21315. if (!thumbRef.value || !trackRef.value)
  21316. return;
  21317. const prevPage = state[bar.value.axis];
  21318. if (!prevPage)
  21319. return;
  21320. cAF(frameHandle);
  21321. const offset2 = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  21322. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  21323. const distance = offset2 - thumbClickPosition;
  21324. frameHandle = rAF(() => {
  21325. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  21326. emit("scroll", distance, totalSteps.value);
  21327. });
  21328. };
  21329. const clickTrackHandler = (e) => {
  21330. const offset2 = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  21331. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  21332. const distance = offset2 - thumbHalf;
  21333. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  21334. emit("scroll", distance, totalSteps.value);
  21335. };
  21336. watch(() => props.scrollFrom, (v2) => {
  21337. if (state.isDragging)
  21338. return;
  21339. state.traveled = Math.ceil(v2 * totalSteps.value);
  21340. });
  21341. onBeforeUnmount(() => {
  21342. detachEvents();
  21343. });
  21344. return () => {
  21345. return h$1("div", {
  21346. role: "presentation",
  21347. ref: trackRef,
  21348. class: [
  21349. nsVirtualScrollbar.b(),
  21350. props.class,
  21351. (props.alwaysOn || state.isDragging) && "always-on"
  21352. ],
  21353. style: trackStyle.value,
  21354. onMousedown: withModifiers(clickTrackHandler, ["stop", "prevent"]),
  21355. onTouchstartPrevent: onThumbMouseDown
  21356. }, h$1("div", {
  21357. ref: thumbRef,
  21358. class: nsScrollbar.e("thumb"),
  21359. style: thumbStyle.value,
  21360. onMousedown: onThumbMouseDown
  21361. }, []));
  21362. };
  21363. }
  21364. });
  21365. const createList = ({
  21366. name,
  21367. getOffset: getOffset2,
  21368. getItemSize,
  21369. getItemOffset,
  21370. getEstimatedTotalSize: getEstimatedTotalSize2,
  21371. getStartIndexForOffset,
  21372. getStopIndexForStartIndex,
  21373. initCache,
  21374. clearCache,
  21375. validateProps
  21376. }) => {
  21377. return defineComponent({
  21378. name: name != null ? name : "ElVirtualList",
  21379. props: virtualizedListProps,
  21380. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  21381. setup(props, { emit, expose }) {
  21382. validateProps(props);
  21383. const instance = getCurrentInstance();
  21384. const ns = useNamespace("vl");
  21385. const dynamicSizeCache = ref(initCache(props, instance));
  21386. const getItemStyleCache = useCache();
  21387. const windowRef = ref();
  21388. const innerRef = ref();
  21389. const scrollbarRef = ref();
  21390. const states = ref({
  21391. isScrolling: false,
  21392. scrollDir: "forward",
  21393. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  21394. updateRequested: false,
  21395. isScrollbarDragging: false,
  21396. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  21397. });
  21398. const itemsToRender = computed(() => {
  21399. const { total: total2, cache: cache2 } = props;
  21400. const { isScrolling, scrollDir, scrollOffset } = unref(states);
  21401. if (total2 === 0) {
  21402. return [0, 0, 0, 0];
  21403. }
  21404. const startIndex = getStartIndexForOffset(props, scrollOffset, unref(dynamicSizeCache));
  21405. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, unref(dynamicSizeCache));
  21406. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache2) : 1;
  21407. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache2) : 1;
  21408. return [
  21409. Math.max(0, startIndex - cacheBackward),
  21410. Math.max(0, Math.min(total2 - 1, stopIndex + cacheForward)),
  21411. startIndex,
  21412. stopIndex
  21413. ];
  21414. });
  21415. const estimatedTotalSize = computed(() => getEstimatedTotalSize2(props, unref(dynamicSizeCache)));
  21416. const _isHorizontal = computed(() => isHorizontal(props.layout));
  21417. const windowStyle = computed(() => [
  21418. {
  21419. position: "relative",
  21420. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  21421. WebkitOverflowScrolling: "touch",
  21422. willChange: "transform"
  21423. },
  21424. {
  21425. direction: props.direction,
  21426. height: isNumber(props.height) ? `${props.height}px` : props.height,
  21427. width: isNumber(props.width) ? `${props.width}px` : props.width
  21428. },
  21429. props.style
  21430. ]);
  21431. const innerStyle = computed(() => {
  21432. const size = unref(estimatedTotalSize);
  21433. const horizontal = unref(_isHorizontal);
  21434. return {
  21435. height: horizontal ? "100%" : `${size}px`,
  21436. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  21437. width: horizontal ? `${size}px` : "100%"
  21438. };
  21439. });
  21440. const clientSize = computed(() => _isHorizontal.value ? props.width : props.height);
  21441. const { onWheel } = useWheel({
  21442. atStartEdge: computed(() => states.value.scrollOffset <= 0),
  21443. atEndEdge: computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  21444. layout: computed(() => props.layout)
  21445. }, (offset2) => {
  21446. var _a2, _b2;
  21447. (_b2 = (_a2 = scrollbarRef.value).onMouseUp) == null ? void 0 : _b2.call(_a2);
  21448. scrollTo(Math.min(states.value.scrollOffset + offset2, estimatedTotalSize.value - clientSize.value));
  21449. });
  21450. const emitEvents = () => {
  21451. const { total: total2 } = props;
  21452. if (total2 > 0) {
  21453. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = unref(itemsToRender);
  21454. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  21455. }
  21456. const { scrollDir, scrollOffset, updateRequested } = unref(states);
  21457. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  21458. };
  21459. const scrollVertically = (e) => {
  21460. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  21461. const _states = unref(states);
  21462. if (_states.scrollOffset === scrollTop) {
  21463. return;
  21464. }
  21465. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  21466. states.value = __spreadProps(__spreadValues({}, _states), {
  21467. isScrolling: true,
  21468. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  21469. scrollOffset,
  21470. updateRequested: false
  21471. });
  21472. nextTick(resetIsScrolling);
  21473. };
  21474. const scrollHorizontally = (e) => {
  21475. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  21476. const _states = unref(states);
  21477. if (_states.scrollOffset === scrollLeft) {
  21478. return;
  21479. }
  21480. const { direction: direction2 } = props;
  21481. let scrollOffset = scrollLeft;
  21482. if (direction2 === RTL) {
  21483. switch (getRTLOffsetType()) {
  21484. case RTL_OFFSET_NAG: {
  21485. scrollOffset = -scrollLeft;
  21486. break;
  21487. }
  21488. case RTL_OFFSET_POS_DESC: {
  21489. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  21490. break;
  21491. }
  21492. }
  21493. }
  21494. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  21495. states.value = __spreadProps(__spreadValues({}, _states), {
  21496. isScrolling: true,
  21497. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  21498. scrollOffset,
  21499. updateRequested: false
  21500. });
  21501. nextTick(resetIsScrolling);
  21502. };
  21503. const onScroll = (e) => {
  21504. unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  21505. emitEvents();
  21506. };
  21507. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  21508. const offset2 = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  21509. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset2));
  21510. };
  21511. const scrollTo = (offset2) => {
  21512. offset2 = Math.max(offset2, 0);
  21513. if (offset2 === unref(states).scrollOffset) {
  21514. return;
  21515. }
  21516. states.value = __spreadProps(__spreadValues({}, unref(states)), {
  21517. scrollOffset: offset2,
  21518. scrollDir: getScrollDir(unref(states).scrollOffset, offset2),
  21519. updateRequested: true
  21520. });
  21521. nextTick(resetIsScrolling);
  21522. };
  21523. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  21524. const { scrollOffset } = unref(states);
  21525. idx = Math.max(0, Math.min(idx, props.total - 1));
  21526. scrollTo(getOffset2(props, idx, alignment, scrollOffset, unref(dynamicSizeCache)));
  21527. };
  21528. const getItemStyle = (idx) => {
  21529. const { direction: direction2, itemSize: itemSize2, layout: layout2 } = props;
  21530. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize2, clearCache && layout2, clearCache && direction2);
  21531. let style;
  21532. if (hasOwn(itemStyleCache, String(idx))) {
  21533. style = itemStyleCache[idx];
  21534. } else {
  21535. const offset2 = getItemOffset(props, idx, unref(dynamicSizeCache));
  21536. const size = getItemSize(props, idx, unref(dynamicSizeCache));
  21537. const horizontal = unref(_isHorizontal);
  21538. const isRtl = direction2 === RTL;
  21539. const offsetHorizontal = horizontal ? offset2 : 0;
  21540. itemStyleCache[idx] = style = {
  21541. position: "absolute",
  21542. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  21543. right: isRtl ? `${offsetHorizontal}px` : void 0,
  21544. top: !horizontal ? `${offset2}px` : 0,
  21545. height: !horizontal ? `${size}px` : "100%",
  21546. width: horizontal ? `${size}px` : "100%"
  21547. };
  21548. }
  21549. return style;
  21550. };
  21551. const resetIsScrolling = () => {
  21552. states.value.isScrolling = false;
  21553. nextTick(() => {
  21554. getItemStyleCache.value(-1, null, null);
  21555. });
  21556. };
  21557. const resetScrollTop = () => {
  21558. const window2 = windowRef.value;
  21559. if (window2) {
  21560. window2.scrollTop = 0;
  21561. }
  21562. };
  21563. onMounted(() => {
  21564. if (!isClient)
  21565. return;
  21566. const { initScrollOffset: initScrollOffset2 } = props;
  21567. const windowElement = unref(windowRef);
  21568. if (isNumber(initScrollOffset2) && windowElement) {
  21569. if (unref(_isHorizontal)) {
  21570. windowElement.scrollLeft = initScrollOffset2;
  21571. } else {
  21572. windowElement.scrollTop = initScrollOffset2;
  21573. }
  21574. }
  21575. emitEvents();
  21576. });
  21577. onUpdated(() => {
  21578. const { direction: direction2, layout: layout2 } = props;
  21579. const { scrollOffset, updateRequested } = unref(states);
  21580. const windowElement = unref(windowRef);
  21581. if (updateRequested && windowElement) {
  21582. if (layout2 === HORIZONTAL) {
  21583. if (direction2 === RTL) {
  21584. switch (getRTLOffsetType()) {
  21585. case "negative": {
  21586. windowElement.scrollLeft = -scrollOffset;
  21587. break;
  21588. }
  21589. case "positive-ascending": {
  21590. windowElement.scrollLeft = scrollOffset;
  21591. break;
  21592. }
  21593. default: {
  21594. const { clientWidth, scrollWidth } = windowElement;
  21595. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  21596. break;
  21597. }
  21598. }
  21599. } else {
  21600. windowElement.scrollLeft = scrollOffset;
  21601. }
  21602. } else {
  21603. windowElement.scrollTop = scrollOffset;
  21604. }
  21605. }
  21606. });
  21607. const api = {
  21608. ns,
  21609. clientSize,
  21610. estimatedTotalSize,
  21611. windowStyle,
  21612. windowRef,
  21613. innerRef,
  21614. innerStyle,
  21615. itemsToRender,
  21616. scrollbarRef,
  21617. states,
  21618. getItemStyle,
  21619. onScroll,
  21620. onScrollbarScroll,
  21621. onWheel,
  21622. scrollTo,
  21623. scrollToItem,
  21624. resetScrollTop
  21625. };
  21626. expose({
  21627. windowRef,
  21628. innerRef,
  21629. getItemStyleCache,
  21630. scrollTo,
  21631. scrollToItem,
  21632. resetScrollTop,
  21633. states
  21634. });
  21635. return api;
  21636. },
  21637. render(ctx) {
  21638. var _a2;
  21639. const {
  21640. $slots,
  21641. className,
  21642. clientSize,
  21643. containerElement,
  21644. data: data2,
  21645. getItemStyle,
  21646. innerElement,
  21647. itemsToRender,
  21648. innerStyle,
  21649. layout: layout2,
  21650. total: total2,
  21651. onScroll,
  21652. onScrollbarScroll,
  21653. onWheel,
  21654. states,
  21655. useIsScrolling,
  21656. windowStyle,
  21657. ns
  21658. } = ctx;
  21659. const [start2, end2] = itemsToRender;
  21660. const Container = resolveDynamicComponent(containerElement);
  21661. const Inner = resolveDynamicComponent(innerElement);
  21662. const children = [];
  21663. if (total2 > 0) {
  21664. for (let i = start2; i <= end2; i++) {
  21665. children.push((_a2 = $slots.default) == null ? void 0 : _a2.call($slots, {
  21666. data: data2,
  21667. key: i,
  21668. index: i,
  21669. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  21670. style: getItemStyle(i)
  21671. }));
  21672. }
  21673. }
  21674. const InnerNode = [
  21675. h$1(Inner, {
  21676. style: innerStyle,
  21677. ref: "innerRef"
  21678. }, !isString(Inner) ? {
  21679. default: () => children
  21680. } : children)
  21681. ];
  21682. const scrollbar = h$1(ScrollBar, {
  21683. ref: "scrollbarRef",
  21684. clientSize,
  21685. layout: layout2,
  21686. onScroll: onScrollbarScroll,
  21687. ratio: clientSize * 100 / this.estimatedTotalSize,
  21688. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  21689. total: total2
  21690. });
  21691. const listContainer = h$1(Container, {
  21692. class: ["el-vl__window", className],
  21693. style: windowStyle,
  21694. onScroll,
  21695. onWheel,
  21696. ref: "windowRef",
  21697. key: 0
  21698. }, !isString(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  21699. return h$1("div", {
  21700. key: 0,
  21701. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  21702. }, [listContainer, scrollbar]);
  21703. }
  21704. });
  21705. };
  21706. const FixedSizeList = createList({
  21707. name: "ElFixedSizeList",
  21708. getItemOffset: ({ itemSize: itemSize2 }, index) => index * itemSize2,
  21709. getItemSize: ({ itemSize: itemSize2 }) => itemSize2,
  21710. getEstimatedTotalSize: ({ total: total2, itemSize: itemSize2 }) => itemSize2 * total2,
  21711. getOffset: ({ height, total: total2, itemSize: itemSize2, layout: layout2, width }, index, alignment, scrollOffset) => {
  21712. const size = isHorizontal(layout2) ? width : height;
  21713. const lastItemOffset = Math.max(0, total2 * itemSize2 - size);
  21714. const maxOffset = Math.min(lastItemOffset, index * itemSize2);
  21715. const minOffset = Math.max(0, (index + 1) * itemSize2 - size);
  21716. if (alignment === SMART_ALIGNMENT) {
  21717. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  21718. alignment = AUTO_ALIGNMENT;
  21719. } else {
  21720. alignment = CENTERED_ALIGNMENT;
  21721. }
  21722. }
  21723. switch (alignment) {
  21724. case START_ALIGNMENT: {
  21725. return maxOffset;
  21726. }
  21727. case END_ALIGNMENT: {
  21728. return minOffset;
  21729. }
  21730. case CENTERED_ALIGNMENT: {
  21731. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  21732. if (middleOffset < Math.ceil(size / 2)) {
  21733. return 0;
  21734. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  21735. return lastItemOffset;
  21736. } else {
  21737. return middleOffset;
  21738. }
  21739. }
  21740. case AUTO_ALIGNMENT:
  21741. default: {
  21742. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  21743. return scrollOffset;
  21744. } else if (scrollOffset < minOffset) {
  21745. return minOffset;
  21746. } else {
  21747. return maxOffset;
  21748. }
  21749. }
  21750. }
  21751. },
  21752. getStartIndexForOffset: ({ total: total2, itemSize: itemSize2 }, offset2) => Math.max(0, Math.min(total2 - 1, Math.floor(offset2 / itemSize2))),
  21753. getStopIndexForStartIndex: ({ height, total: total2, itemSize: itemSize2, layout: layout2, width }, startIndex, scrollOffset) => {
  21754. const offset2 = startIndex * itemSize2;
  21755. const size = isHorizontal(layout2) ? width : height;
  21756. const numVisibleItems = Math.ceil((size + scrollOffset - offset2) / itemSize2);
  21757. return Math.max(0, Math.min(total2 - 1, startIndex + numVisibleItems - 1));
  21758. },
  21759. initCache() {
  21760. return void 0;
  21761. },
  21762. clearCache: true,
  21763. validateProps() {
  21764. }
  21765. });
  21766. const getItemFromCache = (props, index, listCache) => {
  21767. const { itemSize: itemSize2 } = props;
  21768. const { items, lastVisitedIndex } = listCache;
  21769. if (index > lastVisitedIndex) {
  21770. let offset2 = 0;
  21771. if (lastVisitedIndex >= 0) {
  21772. const item = items[lastVisitedIndex];
  21773. offset2 = item.offset + item.size;
  21774. }
  21775. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  21776. const size = itemSize2(i);
  21777. items[i] = {
  21778. offset: offset2,
  21779. size
  21780. };
  21781. offset2 += size;
  21782. }
  21783. listCache.lastVisitedIndex = index;
  21784. }
  21785. return items[index];
  21786. };
  21787. const findItem = (props, listCache, offset2) => {
  21788. const { items, lastVisitedIndex } = listCache;
  21789. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  21790. if (lastVisitedOffset >= offset2) {
  21791. return bs(props, listCache, 0, lastVisitedIndex, offset2);
  21792. }
  21793. return es(props, listCache, Math.max(0, lastVisitedIndex), offset2);
  21794. };
  21795. const bs = (props, listCache, low, high, offset2) => {
  21796. while (low <= high) {
  21797. const mid = low + Math.floor((high - low) / 2);
  21798. const currentOffset = getItemFromCache(props, mid, listCache).offset;
  21799. if (currentOffset === offset2) {
  21800. return mid;
  21801. } else if (currentOffset < offset2) {
  21802. low = mid + 1;
  21803. } else if (currentOffset > offset2) {
  21804. high = mid - 1;
  21805. }
  21806. }
  21807. return Math.max(0, low - 1);
  21808. };
  21809. const es = (props, listCache, index, offset2) => {
  21810. const { total: total2 } = props;
  21811. let exponent = 1;
  21812. while (index < total2 && getItemFromCache(props, index, listCache).offset < offset2) {
  21813. index += exponent;
  21814. exponent *= 2;
  21815. }
  21816. return bs(props, listCache, Math.floor(index / 2), Math.min(index, total2 - 1), offset2);
  21817. };
  21818. const getEstimatedTotalSize = ({ total: total2 }, { items, estimatedItemSize: estimatedItemSize2, lastVisitedIndex }) => {
  21819. let totalSizeOfMeasuredItems = 0;
  21820. if (lastVisitedIndex >= total2) {
  21821. lastVisitedIndex = total2 - 1;
  21822. }
  21823. if (lastVisitedIndex >= 0) {
  21824. const item = items[lastVisitedIndex];
  21825. totalSizeOfMeasuredItems = item.offset + item.size;
  21826. }
  21827. const numUnmeasuredItems = total2 - lastVisitedIndex - 1;
  21828. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize2;
  21829. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  21830. };
  21831. const DynamicSizeList = createList({
  21832. name: "ElDynamicSizeList",
  21833. getItemOffset: (props, index, listCache) => getItemFromCache(props, index, listCache).offset,
  21834. getItemSize: (_2, index, { items }) => items[index].size,
  21835. getEstimatedTotalSize,
  21836. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  21837. const { height, layout: layout2, width } = props;
  21838. const size = isHorizontal(layout2) ? width : height;
  21839. const item = getItemFromCache(props, index, listCache);
  21840. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  21841. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  21842. const minOffset = Math.max(0, item.offset - size + item.size);
  21843. if (alignment === SMART_ALIGNMENT) {
  21844. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  21845. alignment = AUTO_ALIGNMENT;
  21846. } else {
  21847. alignment = CENTERED_ALIGNMENT;
  21848. }
  21849. }
  21850. switch (alignment) {
  21851. case START_ALIGNMENT: {
  21852. return maxOffset;
  21853. }
  21854. case END_ALIGNMENT: {
  21855. return minOffset;
  21856. }
  21857. case CENTERED_ALIGNMENT: {
  21858. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  21859. }
  21860. case AUTO_ALIGNMENT:
  21861. default: {
  21862. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  21863. return scrollOffset;
  21864. } else if (scrollOffset < minOffset) {
  21865. return minOffset;
  21866. } else {
  21867. return maxOffset;
  21868. }
  21869. }
  21870. }
  21871. },
  21872. getStartIndexForOffset: (props, offset2, listCache) => findItem(props, listCache, offset2),
  21873. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  21874. const { height, total: total2, layout: layout2, width } = props;
  21875. const size = isHorizontal(layout2) ? width : height;
  21876. const item = getItemFromCache(props, startIndex, listCache);
  21877. const maxOffset = scrollOffset + size;
  21878. let offset2 = item.offset + item.size;
  21879. let stopIndex = startIndex;
  21880. while (stopIndex < total2 - 1 && offset2 < maxOffset) {
  21881. stopIndex++;
  21882. offset2 += getItemFromCache(props, stopIndex, listCache).size;
  21883. }
  21884. return stopIndex;
  21885. },
  21886. initCache({ estimatedItemSize: estimatedItemSize2 = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  21887. const cache2 = {
  21888. items: {},
  21889. estimatedItemSize: estimatedItemSize2,
  21890. lastVisitedIndex: -1
  21891. };
  21892. cache2.clearCacheAfterIndex = (index, forceUpdate = true) => {
  21893. var _a2, _b2;
  21894. cache2.lastVisitedIndex = Math.min(cache2.lastVisitedIndex, index - 1);
  21895. (_a2 = instance.exposed) == null ? void 0 : _a2.getItemStyleCache(-1);
  21896. if (forceUpdate) {
  21897. (_b2 = instance.proxy) == null ? void 0 : _b2.$forceUpdate();
  21898. }
  21899. };
  21900. return cache2;
  21901. },
  21902. clearCache: false,
  21903. validateProps: ({ itemSize: itemSize2 }) => {
  21904. }
  21905. });
  21906. const _sfc_main$o = defineComponent({
  21907. props: {
  21908. item: {
  21909. type: Object,
  21910. required: true
  21911. },
  21912. style: Object,
  21913. height: Number
  21914. },
  21915. setup() {
  21916. const ns = useNamespace("select");
  21917. return {
  21918. ns
  21919. };
  21920. }
  21921. });
  21922. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  21923. return _ctx.item.isTitle ? (openBlock(), createElementBlock("div", {
  21924. key: 0,
  21925. class: normalizeClass(_ctx.ns.be("group", "title")),
  21926. style: normalizeStyle([_ctx.style, { lineHeight: `${_ctx.height}px` }])
  21927. }, toDisplayString(_ctx.item.label), 7)) : (openBlock(), createElementBlock("div", {
  21928. key: 1,
  21929. class: normalizeClass(_ctx.ns.be("group", "split")),
  21930. style: normalizeStyle(_ctx.style)
  21931. }, [
  21932. createElementVNode("span", {
  21933. class: normalizeClass(_ctx.ns.be("group", "split-dash")),
  21934. style: normalizeStyle({ top: `${_ctx.height / 2}px` })
  21935. }, null, 6)
  21936. ], 6));
  21937. }
  21938. var GroupItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["render", _sfc_render$a], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select-v2/src/group-item.vue"]]);
  21939. function useOption(props, { emit }) {
  21940. return {
  21941. hoverItem: () => {
  21942. if (!props.disabled) {
  21943. emit("hover", props.index);
  21944. }
  21945. },
  21946. selectOptionClick: () => {
  21947. if (!props.disabled) {
  21948. emit("select", props.item, props.index);
  21949. }
  21950. }
  21951. };
  21952. }
  21953. const SelectProps = {
  21954. allowCreate: Boolean,
  21955. autocomplete: {
  21956. type: String,
  21957. default: "none"
  21958. },
  21959. automaticDropdown: Boolean,
  21960. clearable: Boolean,
  21961. clearIcon: {
  21962. type: [String, Object],
  21963. default: circleClose
  21964. },
  21965. effect: {
  21966. type: String,
  21967. default: "light"
  21968. },
  21969. collapseTags: Boolean,
  21970. collapseTagsTooltip: {
  21971. type: Boolean,
  21972. default: false
  21973. },
  21974. defaultFirstOption: Boolean,
  21975. disabled: Boolean,
  21976. estimatedOptionHeight: {
  21977. type: Number,
  21978. default: void 0
  21979. },
  21980. filterable: Boolean,
  21981. filterMethod: Function,
  21982. height: {
  21983. type: Number,
  21984. default: 170
  21985. },
  21986. itemHeight: {
  21987. type: Number,
  21988. default: 34
  21989. },
  21990. id: String,
  21991. loading: Boolean,
  21992. loadingText: String,
  21993. label: String,
  21994. modelValue: [Array, String, Number, Boolean, Object],
  21995. multiple: Boolean,
  21996. multipleLimit: {
  21997. type: Number,
  21998. default: 0
  21999. },
  22000. name: String,
  22001. noDataText: String,
  22002. noMatchText: String,
  22003. remoteMethod: Function,
  22004. reserveKeyword: {
  22005. type: Boolean,
  22006. default: true
  22007. },
  22008. options: {
  22009. type: Array,
  22010. required: true
  22011. },
  22012. placeholder: {
  22013. type: String
  22014. },
  22015. popperAppendToBody: {
  22016. type: Boolean,
  22017. default: void 0
  22018. },
  22019. teleported: useTooltipContentProps.teleported,
  22020. persistent: {
  22021. type: Boolean,
  22022. default: true
  22023. },
  22024. popperClass: {
  22025. type: String,
  22026. default: ""
  22027. },
  22028. popperOptions: {
  22029. type: Object,
  22030. default: () => ({})
  22031. },
  22032. remote: Boolean,
  22033. size: {
  22034. type: String,
  22035. validator: isValidComponentSize
  22036. },
  22037. valueKey: {
  22038. type: String,
  22039. default: "value"
  22040. },
  22041. scrollbarAlwaysOn: {
  22042. type: Boolean,
  22043. default: false
  22044. }
  22045. };
  22046. const OptionProps = {
  22047. data: Array,
  22048. disabled: Boolean,
  22049. hovering: Boolean,
  22050. item: Object,
  22051. index: Number,
  22052. style: Object,
  22053. selected: Boolean,
  22054. created: Boolean
  22055. };
  22056. const _sfc_main$n = defineComponent({
  22057. props: OptionProps,
  22058. emits: ["select", "hover"],
  22059. setup(props, { emit }) {
  22060. const ns = useNamespace("select");
  22061. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  22062. return {
  22063. ns,
  22064. hoverItem,
  22065. selectOptionClick
  22066. };
  22067. }
  22068. });
  22069. const _hoisted_1$g = ["aria-selected"];
  22070. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  22071. return openBlock(), createElementBlock("li", {
  22072. "aria-selected": _ctx.selected,
  22073. style: normalizeStyle(_ctx.style),
  22074. class: normalizeClass([
  22075. _ctx.ns.be("dropdown", "option-item"),
  22076. _ctx.ns.is("selected", _ctx.selected),
  22077. _ctx.ns.is("disabled", _ctx.disabled),
  22078. _ctx.ns.is("created", _ctx.created),
  22079. { hover: _ctx.hovering }
  22080. ]),
  22081. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  22082. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  22083. }, [
  22084. renderSlot(_ctx.$slots, "default", {
  22085. item: _ctx.item,
  22086. index: _ctx.index,
  22087. disabled: _ctx.disabled
  22088. }, () => [
  22089. createElementVNode("span", null, toDisplayString(_ctx.item.label), 1)
  22090. ])
  22091. ], 46, _hoisted_1$g);
  22092. }
  22093. var OptionItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["render", _sfc_render$9], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select-v2/src/option-item.vue"]]);
  22094. const selectV2InjectionKey = "ElSelectV2Injection";
  22095. const _sfc_main$m = defineComponent({
  22096. name: "ElSelectDropdown",
  22097. props: {
  22098. data: Array,
  22099. hoveringIndex: Number,
  22100. width: Number
  22101. },
  22102. setup(props) {
  22103. const select = inject(selectV2InjectionKey);
  22104. const ns = useNamespace("select");
  22105. const cachedHeights = ref([]);
  22106. const listRef = ref(null);
  22107. const isSized = computed(() => isUndefined(select.props.estimatedOptionHeight));
  22108. const listProps = computed(() => {
  22109. if (isSized.value) {
  22110. return {
  22111. itemSize: select.props.itemHeight
  22112. };
  22113. }
  22114. return {
  22115. estimatedSize: select.props.estimatedOptionHeight,
  22116. itemSize: (idx) => cachedHeights.value[idx]
  22117. };
  22118. });
  22119. const contains2 = (arr = [], target) => {
  22120. const {
  22121. props: { valueKey }
  22122. } = select;
  22123. if (!isObject$1(target)) {
  22124. return arr.includes(target);
  22125. }
  22126. return arr && arr.some((item) => {
  22127. return get(item, valueKey) === get(target, valueKey);
  22128. });
  22129. };
  22130. const isEqual2 = (selected, target) => {
  22131. if (!isObject$1(target)) {
  22132. return selected === target;
  22133. } else {
  22134. const { valueKey } = select.props;
  22135. return get(selected, valueKey) === get(target, valueKey);
  22136. }
  22137. };
  22138. const isItemSelected = (modelValue, target) => {
  22139. const { valueKey } = select.props;
  22140. if (select.props.multiple) {
  22141. return contains2(modelValue, get(target, valueKey));
  22142. }
  22143. return isEqual2(modelValue, get(target, valueKey));
  22144. };
  22145. const isItemDisabled = (modelValue, selected) => {
  22146. const { disabled, multiple, multipleLimit } = select.props;
  22147. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  22148. };
  22149. const isItemHovering = (target) => props.hoveringIndex === target;
  22150. const scrollToItem = (index) => {
  22151. const list = listRef.value;
  22152. if (list) {
  22153. list.scrollToItem(index);
  22154. }
  22155. };
  22156. const resetScrollTop = () => {
  22157. const list = listRef.value;
  22158. if (list) {
  22159. list.resetScrollTop();
  22160. }
  22161. };
  22162. return {
  22163. ns,
  22164. select,
  22165. listProps,
  22166. listRef,
  22167. isSized,
  22168. isItemDisabled,
  22169. isItemHovering,
  22170. isItemSelected,
  22171. scrollToItem,
  22172. resetScrollTop
  22173. };
  22174. },
  22175. render(_ctx, _cache) {
  22176. var _a2;
  22177. const {
  22178. $slots,
  22179. data: data2,
  22180. listProps,
  22181. select,
  22182. isSized,
  22183. width,
  22184. ns,
  22185. isItemDisabled,
  22186. isItemHovering,
  22187. isItemSelected
  22188. } = _ctx;
  22189. const Comp = isSized ? FixedSizeList : DynamicSizeList;
  22190. const {
  22191. props: selectProps,
  22192. onSelect,
  22193. onHover,
  22194. onKeyboardNavigate,
  22195. onKeyboardSelect
  22196. } = select;
  22197. const { height, modelValue, multiple } = selectProps;
  22198. if (data2.length === 0) {
  22199. return h$1("div", {
  22200. class: ns.b("dropdown"),
  22201. style: {
  22202. width: `${width}px`
  22203. }
  22204. }, (_a2 = $slots.empty) == null ? void 0 : _a2.call($slots));
  22205. }
  22206. const ListItem = withCtx((scoped) => {
  22207. const { index, data: data22 } = scoped;
  22208. const item = data22[index];
  22209. if (data22[index].type === "Group") {
  22210. return h$1(GroupItem, {
  22211. item,
  22212. style: scoped.style,
  22213. height: isSized ? listProps.itemSize : listProps.estimatedSize
  22214. });
  22215. }
  22216. const selected = isItemSelected(modelValue, item);
  22217. const itemDisabled = isItemDisabled(modelValue, selected);
  22218. return h$1(OptionItem, __spreadProps(__spreadValues({}, scoped), {
  22219. selected,
  22220. disabled: item.disabled || itemDisabled,
  22221. created: !!item.created,
  22222. hovering: isItemHovering(index),
  22223. item,
  22224. onSelect,
  22225. onHover
  22226. }), {
  22227. default: withCtx((props) => {
  22228. return renderSlot($slots, "default", props, () => [
  22229. h$1("span", item.label)
  22230. ]);
  22231. })
  22232. });
  22233. });
  22234. const List = h$1(Comp, __spreadValues({
  22235. ref: "listRef",
  22236. className: ns.be("dropdown", "list"),
  22237. data: data2,
  22238. height,
  22239. width,
  22240. total: data2.length,
  22241. scrollbarAlwaysOn: selectProps.scrollbarAlwaysOn,
  22242. onKeydown: [
  22243. _cache[1] || (_cache[1] = withKeys(withModifiers(() => onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  22244. _cache[2] || (_cache[2] = withKeys(withModifiers(() => onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  22245. _cache[3] || (_cache[3] = withKeys(withModifiers(onKeyboardSelect, ["stop", "prevent"]), ["enter"])),
  22246. _cache[4] || (_cache[4] = withKeys(withModifiers(() => select.expanded = false, ["stop", "prevent"]), ["esc"])),
  22247. _cache[5] || (_cache[5] = withKeys(() => select.expanded = false, ["tab"]))
  22248. ]
  22249. }, listProps), {
  22250. default: ListItem
  22251. });
  22252. return h$1("div", {
  22253. class: [ns.b("dropdown"), ns.is("multiple", multiple)]
  22254. }, [List]);
  22255. }
  22256. });
  22257. var ElSelectMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/select-v2/src/select-dropdown.vue"]]);
  22258. function useAllowCreate(props, states) {
  22259. const createOptionCount = ref(0);
  22260. const cachedSelectedOption = ref(null);
  22261. const enableAllowCreateMode = computed(() => {
  22262. return props.allowCreate && props.filterable;
  22263. });
  22264. function hasExistingOption(query) {
  22265. const hasValue = (option) => option.value === query;
  22266. return props.options && props.options.some(hasValue) || states.createdOptions.some(hasValue);
  22267. }
  22268. function selectNewOption(option) {
  22269. if (!enableAllowCreateMode.value) {
  22270. return;
  22271. }
  22272. if (props.multiple && option.created) {
  22273. createOptionCount.value++;
  22274. } else {
  22275. cachedSelectedOption.value = option;
  22276. }
  22277. }
  22278. function createNewOption(query) {
  22279. if (enableAllowCreateMode.value) {
  22280. if (query && query.length > 0 && !hasExistingOption(query)) {
  22281. const newOption = {
  22282. value: query,
  22283. label: query,
  22284. created: true,
  22285. disabled: false
  22286. };
  22287. if (states.createdOptions.length >= createOptionCount.value) {
  22288. states.createdOptions[createOptionCount.value] = newOption;
  22289. } else {
  22290. states.createdOptions.push(newOption);
  22291. }
  22292. } else {
  22293. if (props.multiple) {
  22294. states.createdOptions.length = createOptionCount.value;
  22295. } else {
  22296. const selectedOption = cachedSelectedOption.value;
  22297. states.createdOptions.length = 0;
  22298. if (selectedOption && selectedOption.created) {
  22299. states.createdOptions.push(selectedOption);
  22300. }
  22301. }
  22302. }
  22303. }
  22304. }
  22305. function removeNewOption(option) {
  22306. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === option.label) {
  22307. return;
  22308. }
  22309. const idx = states.createdOptions.findIndex((it) => it.value === option.value);
  22310. if (~idx) {
  22311. states.createdOptions.splice(idx, 1);
  22312. createOptionCount.value--;
  22313. }
  22314. }
  22315. function clearAllNewOption() {
  22316. if (enableAllowCreateMode.value) {
  22317. states.createdOptions.length = 0;
  22318. createOptionCount.value = 0;
  22319. }
  22320. }
  22321. return {
  22322. createNewOption,
  22323. removeNewOption,
  22324. selectNewOption,
  22325. clearAllNewOption
  22326. };
  22327. }
  22328. const flattenOptions = (options) => {
  22329. const flattened = [];
  22330. options.forEach((option) => {
  22331. if (isArray(option.options)) {
  22332. flattened.push({
  22333. label: option.label,
  22334. isTitle: true,
  22335. type: "Group"
  22336. });
  22337. option.options.forEach((o2) => {
  22338. flattened.push(o2);
  22339. });
  22340. flattened.push({
  22341. type: "Group"
  22342. });
  22343. } else {
  22344. flattened.push(option);
  22345. }
  22346. });
  22347. return flattened;
  22348. };
  22349. function useInput(handleInput) {
  22350. const isComposing = ref(false);
  22351. const handleCompositionStart = () => {
  22352. isComposing.value = true;
  22353. };
  22354. const handleCompositionUpdate = (event) => {
  22355. const text = event.target.value;
  22356. const lastCharacter = text[text.length - 1] || "";
  22357. isComposing.value = !isKorean(lastCharacter);
  22358. };
  22359. const handleCompositionEnd = (event) => {
  22360. if (isComposing.value) {
  22361. isComposing.value = false;
  22362. if (isFunction(handleInput)) {
  22363. handleInput(event);
  22364. }
  22365. }
  22366. };
  22367. return {
  22368. handleCompositionStart,
  22369. handleCompositionUpdate,
  22370. handleCompositionEnd
  22371. };
  22372. }
  22373. const DEFAULT_INPUT_PLACEHOLDER = "";
  22374. const MINIMUM_INPUT_WIDTH = 11;
  22375. const TAG_BASE_WIDTH = {
  22376. larget: 51,
  22377. default: 42,
  22378. small: 33
  22379. };
  22380. const COMPONENT_NAME$1 = "ElSelectV2";
  22381. const useSelect = (props, emit) => {
  22382. const { t } = useLocale();
  22383. const nsSelectV2 = useNamespace("select-v2");
  22384. const nsInput = useNamespace("input");
  22385. const { form: elForm2, formItem: elFormItem2 } = useFormItem();
  22386. const { compatTeleported } = useDeprecateAppendToBody(COMPONENT_NAME$1, "popperAppendToBody");
  22387. const states = reactive({
  22388. inputValue: DEFAULT_INPUT_PLACEHOLDER,
  22389. displayInputValue: DEFAULT_INPUT_PLACEHOLDER,
  22390. calculatedWidth: 0,
  22391. cachedPlaceholder: "",
  22392. cachedOptions: [],
  22393. createdOptions: [],
  22394. createdLabel: "",
  22395. createdSelected: false,
  22396. currentPlaceholder: "",
  22397. hoveringIndex: -1,
  22398. comboBoxHovering: false,
  22399. isOnComposition: false,
  22400. isSilentBlur: false,
  22401. isComposing: false,
  22402. inputLength: 20,
  22403. selectWidth: 200,
  22404. initialInputHeight: 0,
  22405. previousQuery: null,
  22406. previousValue: "",
  22407. query: "",
  22408. selectedLabel: "",
  22409. softFocus: false,
  22410. tagInMultiLine: false
  22411. });
  22412. const selectedIndex = ref(-1);
  22413. const popperSize = ref(-1);
  22414. const controlRef = ref(null);
  22415. const inputRef = ref(null);
  22416. const menuRef = ref(null);
  22417. const popper2 = ref(null);
  22418. const selectRef = ref(null);
  22419. const selectionRef = ref(null);
  22420. const calculatorRef = ref(null);
  22421. const expanded = ref(false);
  22422. const selectDisabled = computed(() => props.disabled || (elForm2 == null ? void 0 : elForm2.disabled));
  22423. const popupHeight = computed(() => {
  22424. const totalHeight = filteredOptions.value.length * 34;
  22425. return totalHeight > props.height ? props.height : totalHeight;
  22426. });
  22427. const hasModelValue = computed(() => {
  22428. return props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  22429. });
  22430. const showClearBtn = computed(() => {
  22431. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : hasModelValue.value;
  22432. const criteria = props.clearable && !selectDisabled.value && states.comboBoxHovering && hasValue;
  22433. return criteria;
  22434. });
  22435. const iconComponent = computed(() => props.remote && props.filterable ? "" : arrowUp);
  22436. const iconReverse = computed(() => iconComponent.value && nsSelectV2.is("reverse", expanded.value));
  22437. const validateState = computed(() => (elFormItem2 == null ? void 0 : elFormItem2.validateState) || "");
  22438. const validateIcon = computed(() => ValidateComponentsMap[validateState.value]);
  22439. const debounce$1$1 = computed(() => props.remote ? 300 : 0);
  22440. const emptyText = computed(() => {
  22441. const options = filteredOptions.value;
  22442. if (props.loading) {
  22443. return props.loadingText || t("el.select.loading");
  22444. } else {
  22445. if (props.remote && states.inputValue === "" && options.length === 0)
  22446. return false;
  22447. if (props.filterable && states.inputValue && options.length > 0) {
  22448. return props.noMatchText || t("el.select.noMatch");
  22449. }
  22450. if (options.length === 0) {
  22451. return props.noDataText || t("el.select.noData");
  22452. }
  22453. }
  22454. return null;
  22455. });
  22456. const filteredOptions = computed(() => {
  22457. const isValidOption = (o2) => {
  22458. const query = states.inputValue;
  22459. const containsQueryString = query ? o2.label.includes(query) : true;
  22460. return containsQueryString;
  22461. };
  22462. if (props.loading) {
  22463. return [];
  22464. }
  22465. return flattenOptions(props.options.concat(states.createdOptions).map((v2) => {
  22466. if (isArray(v2.options)) {
  22467. const filtered = v2.options.filter(isValidOption);
  22468. if (filtered.length > 0) {
  22469. return __spreadProps(__spreadValues({}, v2), {
  22470. options: filtered
  22471. });
  22472. }
  22473. } else {
  22474. if (props.remote || isValidOption(v2)) {
  22475. return v2;
  22476. }
  22477. }
  22478. return null;
  22479. }).filter((v2) => v2 !== null));
  22480. });
  22481. const optionsAllDisabled = computed(() => filteredOptions.value.every((option) => option.disabled));
  22482. const selectSize = useSize();
  22483. const collapseTagSize = computed(() => selectSize.value === "small" ? "small" : "default");
  22484. const tagMaxWidth = computed(() => {
  22485. const select = selectionRef.value;
  22486. const size = collapseTagSize.value || "default";
  22487. const paddingLeft = select ? Number.parseInt(getComputedStyle(select).paddingLeft) : 0;
  22488. const paddingRight = select ? Number.parseInt(getComputedStyle(select).paddingRight) : 0;
  22489. return states.selectWidth - paddingRight - paddingLeft - TAG_BASE_WIDTH[size];
  22490. });
  22491. const calculatePopperSize = () => {
  22492. var _a2, _b2, _c;
  22493. popperSize.value = ((_c = (_b2 = (_a2 = selectRef.value) == null ? void 0 : _a2.getBoundingClientRect) == null ? void 0 : _b2.call(_a2)) == null ? void 0 : _c.width) || 200;
  22494. };
  22495. const inputWrapperStyle = computed(() => {
  22496. return {
  22497. width: `${states.calculatedWidth === 0 ? MINIMUM_INPUT_WIDTH : Math.ceil(states.calculatedWidth) + MINIMUM_INPUT_WIDTH}px`
  22498. };
  22499. });
  22500. const shouldShowPlaceholder = computed(() => {
  22501. if (isArray(props.modelValue)) {
  22502. return props.modelValue.length === 0 && !states.displayInputValue;
  22503. }
  22504. return props.filterable ? states.displayInputValue.length === 0 : true;
  22505. });
  22506. const currentPlaceholder = computed(() => {
  22507. const _placeholder = props.placeholder || t("el.select.placeholder");
  22508. return props.multiple ? _placeholder : states.selectedLabel || _placeholder;
  22509. });
  22510. const popperRef = computed(() => {
  22511. var _a2, _b2;
  22512. return (_b2 = (_a2 = popper2.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  22513. });
  22514. const indexRef = computed(() => {
  22515. if (props.multiple) {
  22516. const len = props.modelValue.length;
  22517. if (props.modelValue.length > 0) {
  22518. return filteredOptions.value.findIndex((o2) => o2.value === props.modelValue[len - 1]);
  22519. }
  22520. } else {
  22521. if (props.modelValue) {
  22522. return filteredOptions.value.findIndex((o2) => o2.value === props.modelValue);
  22523. }
  22524. }
  22525. return -1;
  22526. });
  22527. const dropdownMenuVisible = computed(() => {
  22528. return expanded.value && emptyText.value !== false;
  22529. });
  22530. const {
  22531. createNewOption,
  22532. removeNewOption,
  22533. selectNewOption,
  22534. clearAllNewOption
  22535. } = useAllowCreate(props, states);
  22536. const {
  22537. handleCompositionStart,
  22538. handleCompositionUpdate,
  22539. handleCompositionEnd
  22540. } = useInput((e) => onInput(e));
  22541. const focusAndUpdatePopup = () => {
  22542. var _a2, _b2, _c;
  22543. (_b2 = (_a2 = inputRef.value).focus) == null ? void 0 : _b2.call(_a2);
  22544. (_c = popper2.value) == null ? void 0 : _c.updatePopper();
  22545. };
  22546. const toggleMenu = () => {
  22547. if (props.automaticDropdown)
  22548. return;
  22549. if (!selectDisabled.value) {
  22550. if (states.isComposing)
  22551. states.softFocus = true;
  22552. return nextTick(() => {
  22553. var _a2, _b2;
  22554. expanded.value = !expanded.value;
  22555. (_b2 = (_a2 = inputRef.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  22556. });
  22557. }
  22558. };
  22559. const onInputChange = () => {
  22560. if (props.filterable && states.inputValue !== states.selectedLabel) {
  22561. states.query = states.selectedLabel;
  22562. }
  22563. handleQueryChange(states.inputValue);
  22564. return nextTick(() => {
  22565. createNewOption(states.inputValue);
  22566. });
  22567. };
  22568. const debouncedOnInputChange = debounce$1(onInputChange, debounce$1$1.value);
  22569. const handleQueryChange = (val) => {
  22570. if (states.previousQuery === val) {
  22571. return;
  22572. }
  22573. states.previousQuery = val;
  22574. if (props.filterable && isFunction(props.filterMethod)) {
  22575. props.filterMethod(val);
  22576. } else if (props.filterable && props.remote && isFunction(props.remoteMethod)) {
  22577. props.remoteMethod(val);
  22578. }
  22579. };
  22580. const emitChange = (val) => {
  22581. if (!isEqual$1(props.modelValue, val)) {
  22582. emit(CHANGE_EVENT, val);
  22583. }
  22584. };
  22585. const update = (val) => {
  22586. emit(UPDATE_MODEL_EVENT, val);
  22587. emitChange(val);
  22588. states.previousValue = val.toString();
  22589. };
  22590. const getValueIndex = (arr = [], value) => {
  22591. if (!isObject$1(value)) {
  22592. return arr.indexOf(value);
  22593. }
  22594. const valueKey = props.valueKey;
  22595. let index = -1;
  22596. arr.some((item, i) => {
  22597. if (get(item, valueKey) === get(value, valueKey)) {
  22598. index = i;
  22599. return true;
  22600. }
  22601. return false;
  22602. });
  22603. return index;
  22604. };
  22605. const getValueKey = (item) => {
  22606. return isObject$1(item) ? get(item, props.valueKey) : item;
  22607. };
  22608. const getLabel = (item) => {
  22609. return isObject$1(item) ? item.label : item;
  22610. };
  22611. const resetInputHeight = () => {
  22612. if (props.collapseTags && !props.filterable) {
  22613. return;
  22614. }
  22615. return nextTick(() => {
  22616. var _a2, _b2;
  22617. if (!inputRef.value)
  22618. return;
  22619. const selection = selectionRef.value;
  22620. selectRef.value.height = selection.offsetHeight;
  22621. if (expanded.value && emptyText.value !== false) {
  22622. (_b2 = (_a2 = popper2.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  22623. }
  22624. });
  22625. };
  22626. const handleResize = () => {
  22627. var _a2, _b2;
  22628. resetInputWidth();
  22629. calculatePopperSize();
  22630. (_b2 = (_a2 = popper2.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b2.call(_a2);
  22631. if (props.multiple) {
  22632. return resetInputHeight();
  22633. }
  22634. };
  22635. const resetInputWidth = () => {
  22636. const select = selectionRef.value;
  22637. if (select) {
  22638. states.selectWidth = select.getBoundingClientRect().width;
  22639. }
  22640. };
  22641. const onSelect = (option, idx, byClick = true) => {
  22642. var _a2, _b2;
  22643. if (props.multiple) {
  22644. let selectedOptions = props.modelValue.slice();
  22645. const index = getValueIndex(selectedOptions, getValueKey(option));
  22646. if (index > -1) {
  22647. selectedOptions = [
  22648. ...selectedOptions.slice(0, index),
  22649. ...selectedOptions.slice(index + 1)
  22650. ];
  22651. states.cachedOptions.splice(index, 1);
  22652. removeNewOption(option);
  22653. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  22654. selectedOptions = [...selectedOptions, getValueKey(option)];
  22655. states.cachedOptions.push(option);
  22656. selectNewOption(option);
  22657. updateHoveringIndex(idx);
  22658. }
  22659. update(selectedOptions);
  22660. if (option.created) {
  22661. states.query = "";
  22662. handleQueryChange("");
  22663. states.inputLength = 20;
  22664. }
  22665. if (props.filterable && !props.reserveKeyword) {
  22666. (_b2 = (_a2 = inputRef.value).focus) == null ? void 0 : _b2.call(_a2);
  22667. onUpdateInputValue("");
  22668. }
  22669. if (props.filterable) {
  22670. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  22671. }
  22672. resetInputHeight();
  22673. setSoftFocus();
  22674. } else {
  22675. selectedIndex.value = idx;
  22676. states.selectedLabel = option.label;
  22677. update(getValueKey(option));
  22678. expanded.value = false;
  22679. states.isComposing = false;
  22680. states.isSilentBlur = byClick;
  22681. selectNewOption(option);
  22682. if (!option.created) {
  22683. clearAllNewOption();
  22684. }
  22685. updateHoveringIndex(idx);
  22686. }
  22687. };
  22688. const deleteTag = (event, tag) => {
  22689. const { valueKey } = props;
  22690. const index = props.modelValue.indexOf(get(tag, valueKey));
  22691. if (index > -1 && !selectDisabled.value) {
  22692. const value = [
  22693. ...props.modelValue.slice(0, index),
  22694. ...props.modelValue.slice(index + 1)
  22695. ];
  22696. states.cachedOptions.splice(index, 1);
  22697. update(value);
  22698. emit("remove-tag", get(tag, valueKey));
  22699. states.softFocus = true;
  22700. removeNewOption(tag);
  22701. return nextTick(focusAndUpdatePopup);
  22702. }
  22703. event.stopPropagation();
  22704. };
  22705. const handleFocus = (event) => {
  22706. const focused = states.isComposing;
  22707. states.isComposing = true;
  22708. if (!states.softFocus) {
  22709. if (!focused)
  22710. emit("focus", event);
  22711. } else {
  22712. states.softFocus = false;
  22713. }
  22714. };
  22715. const handleBlur = () => {
  22716. states.softFocus = false;
  22717. return nextTick(() => {
  22718. var _a2, _b2;
  22719. (_b2 = (_a2 = inputRef.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b2.call(_a2);
  22720. if (calculatorRef.value) {
  22721. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  22722. }
  22723. if (states.isSilentBlur) {
  22724. states.isSilentBlur = false;
  22725. } else {
  22726. if (states.isComposing) {
  22727. emit("blur");
  22728. }
  22729. }
  22730. states.isComposing = false;
  22731. });
  22732. };
  22733. const handleEsc = () => {
  22734. if (states.displayInputValue.length > 0) {
  22735. onUpdateInputValue("");
  22736. } else {
  22737. expanded.value = false;
  22738. }
  22739. };
  22740. const handleDel = (e) => {
  22741. if (states.displayInputValue.length === 0) {
  22742. e.preventDefault();
  22743. const selected = props.modelValue.slice();
  22744. selected.pop();
  22745. removeNewOption(states.cachedOptions.pop());
  22746. update(selected);
  22747. }
  22748. };
  22749. const handleClear = () => {
  22750. let emptyValue;
  22751. if (isArray(props.modelValue)) {
  22752. emptyValue = [];
  22753. } else {
  22754. emptyValue = "";
  22755. }
  22756. states.softFocus = true;
  22757. if (props.multiple) {
  22758. states.cachedOptions = [];
  22759. } else {
  22760. states.selectedLabel = "";
  22761. }
  22762. expanded.value = false;
  22763. update(emptyValue);
  22764. emit("clear");
  22765. clearAllNewOption();
  22766. return nextTick(focusAndUpdatePopup);
  22767. };
  22768. const onUpdateInputValue = (val) => {
  22769. states.displayInputValue = val;
  22770. states.inputValue = val;
  22771. };
  22772. const onKeyboardNavigate = (direction2, hoveringIndex = void 0) => {
  22773. const options = filteredOptions.value;
  22774. if (!["forward", "backward"].includes(direction2) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value) {
  22775. return;
  22776. }
  22777. if (!expanded.value) {
  22778. return toggleMenu();
  22779. }
  22780. if (hoveringIndex === void 0) {
  22781. hoveringIndex = states.hoveringIndex;
  22782. }
  22783. let newIndex = -1;
  22784. if (direction2 === "forward") {
  22785. newIndex = hoveringIndex + 1;
  22786. if (newIndex >= options.length) {
  22787. newIndex = 0;
  22788. }
  22789. } else if (direction2 === "backward") {
  22790. newIndex = hoveringIndex - 1;
  22791. if (newIndex < 0) {
  22792. newIndex = options.length - 1;
  22793. }
  22794. }
  22795. const option = options[newIndex];
  22796. if (option.disabled || option.type === "Group") {
  22797. return onKeyboardNavigate(direction2, newIndex);
  22798. } else {
  22799. updateHoveringIndex(newIndex);
  22800. scrollToItem(newIndex);
  22801. }
  22802. };
  22803. const onKeyboardSelect = () => {
  22804. if (!expanded.value) {
  22805. return toggleMenu();
  22806. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  22807. onSelect(filteredOptions.value[states.hoveringIndex], states.hoveringIndex, false);
  22808. }
  22809. };
  22810. const updateHoveringIndex = (idx) => {
  22811. states.hoveringIndex = idx;
  22812. };
  22813. const resetHoveringIndex = () => {
  22814. states.hoveringIndex = -1;
  22815. };
  22816. const setSoftFocus = () => {
  22817. var _a2;
  22818. const _input = inputRef.value;
  22819. if (_input) {
  22820. (_a2 = _input.focus) == null ? void 0 : _a2.call(_input);
  22821. }
  22822. };
  22823. const onInput = (event) => {
  22824. const value = event.target.value;
  22825. onUpdateInputValue(value);
  22826. if (states.displayInputValue.length > 0 && !expanded.value) {
  22827. expanded.value = true;
  22828. }
  22829. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  22830. if (props.multiple) {
  22831. resetInputHeight();
  22832. }
  22833. if (props.remote) {
  22834. debouncedOnInputChange();
  22835. } else {
  22836. return onInputChange();
  22837. }
  22838. };
  22839. const handleClickOutside = () => {
  22840. expanded.value = false;
  22841. return handleBlur();
  22842. };
  22843. const handleMenuEnter = () => {
  22844. states.inputValue = states.displayInputValue;
  22845. return nextTick(() => {
  22846. if (~indexRef.value) {
  22847. updateHoveringIndex(indexRef.value);
  22848. scrollToItem(states.hoveringIndex);
  22849. }
  22850. });
  22851. };
  22852. const scrollToItem = (index) => {
  22853. menuRef.value.scrollToItem(index);
  22854. };
  22855. const initStates = () => {
  22856. resetHoveringIndex();
  22857. if (props.multiple) {
  22858. if (props.modelValue.length > 0) {
  22859. let initHovering = false;
  22860. states.cachedOptions.length = 0;
  22861. states.previousValue = props.modelValue.toString();
  22862. props.modelValue.forEach((selected) => {
  22863. const itemIndex = filteredOptions.value.findIndex((option) => getValueKey(option) === selected);
  22864. if (~itemIndex) {
  22865. states.cachedOptions.push(filteredOptions.value[itemIndex]);
  22866. if (!initHovering) {
  22867. updateHoveringIndex(itemIndex);
  22868. }
  22869. initHovering = true;
  22870. }
  22871. });
  22872. } else {
  22873. states.cachedOptions = [];
  22874. states.previousValue = "";
  22875. }
  22876. } else {
  22877. if (hasModelValue.value) {
  22878. states.previousValue = props.modelValue;
  22879. const options = filteredOptions.value;
  22880. const selectedItemIndex = options.findIndex((option) => getValueKey(option) === getValueKey(props.modelValue));
  22881. if (~selectedItemIndex) {
  22882. states.selectedLabel = options[selectedItemIndex].label;
  22883. updateHoveringIndex(selectedItemIndex);
  22884. } else {
  22885. states.selectedLabel = `${props.modelValue}`;
  22886. }
  22887. } else {
  22888. states.selectedLabel = "";
  22889. states.previousValue = "";
  22890. }
  22891. }
  22892. calculatePopperSize();
  22893. };
  22894. watch(expanded, (val) => {
  22895. var _a2, _b2;
  22896. emit("visible-change", val);
  22897. if (val) {
  22898. (_b2 = (_a2 = popper2.value).update) == null ? void 0 : _b2.call(_a2);
  22899. } else {
  22900. states.displayInputValue = "";
  22901. createNewOption("");
  22902. }
  22903. });
  22904. watch(() => props.modelValue, (val, oldVal) => {
  22905. var _a2;
  22906. if (!val || val.toString() !== states.previousValue) {
  22907. initStates();
  22908. }
  22909. if (!isEqual$1(val, oldVal)) {
  22910. (_a2 = elFormItem2 == null ? void 0 : elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  22911. }
  22912. }, {
  22913. deep: true
  22914. });
  22915. watch(() => props.options, () => {
  22916. const input = inputRef.value;
  22917. if (!input || input && document.activeElement !== input) {
  22918. initStates();
  22919. }
  22920. }, {
  22921. deep: true
  22922. });
  22923. watch(filteredOptions, () => {
  22924. return nextTick(menuRef.value.resetScrollTop);
  22925. });
  22926. onMounted(() => {
  22927. initStates();
  22928. addResizeListener(selectRef.value, handleResize);
  22929. });
  22930. onBeforeMount(() => {
  22931. removeResizeListener(selectRef.value, handleResize);
  22932. });
  22933. return {
  22934. collapseTagSize,
  22935. currentPlaceholder,
  22936. expanded,
  22937. emptyText,
  22938. popupHeight,
  22939. debounce: debounce$1$1,
  22940. filteredOptions,
  22941. iconComponent,
  22942. iconReverse,
  22943. inputWrapperStyle,
  22944. popperSize,
  22945. dropdownMenuVisible,
  22946. hasModelValue,
  22947. shouldShowPlaceholder,
  22948. selectDisabled,
  22949. selectSize,
  22950. showClearBtn,
  22951. states,
  22952. tagMaxWidth,
  22953. nsSelectV2,
  22954. nsInput,
  22955. calculatorRef,
  22956. controlRef,
  22957. inputRef,
  22958. menuRef,
  22959. popper: popper2,
  22960. selectRef,
  22961. selectionRef,
  22962. popperRef,
  22963. validateState,
  22964. validateIcon,
  22965. compatTeleported,
  22966. debouncedOnInputChange,
  22967. deleteTag,
  22968. getLabel,
  22969. getValueKey,
  22970. handleBlur,
  22971. handleClear,
  22972. handleClickOutside,
  22973. handleDel,
  22974. handleEsc,
  22975. handleFocus,
  22976. handleMenuEnter,
  22977. handleResize,
  22978. toggleMenu,
  22979. scrollTo: scrollToItem,
  22980. onInput,
  22981. onKeyboardNavigate,
  22982. onKeyboardSelect,
  22983. onSelect,
  22984. onHover: updateHoveringIndex,
  22985. onUpdateInputValue,
  22986. handleCompositionStart,
  22987. handleCompositionEnd,
  22988. handleCompositionUpdate
  22989. };
  22990. };
  22991. const _sfc_main$l = defineComponent({
  22992. name: "ElSelectV2",
  22993. components: {
  22994. ElSelectMenu,
  22995. ElTag,
  22996. ElTooltip,
  22997. ElIcon
  22998. },
  22999. directives: { ClickOutside, ModelText: vModelText },
  23000. props: SelectProps,
  23001. emits: [
  23002. UPDATE_MODEL_EVENT,
  23003. CHANGE_EVENT,
  23004. "remove-tag",
  23005. "clear",
  23006. "visible-change",
  23007. "focus",
  23008. "blur"
  23009. ],
  23010. setup(props, { emit }) {
  23011. const API = useSelect(props, emit);
  23012. provide(selectV2InjectionKey, {
  23013. props: reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
  23014. height: API.popupHeight
  23015. })),
  23016. onSelect: API.onSelect,
  23017. onHover: API.onHover,
  23018. onKeyboardNavigate: API.onKeyboardNavigate,
  23019. onKeyboardSelect: API.onKeyboardSelect
  23020. });
  23021. return API;
  23022. }
  23023. });
  23024. const _hoisted_1$f = { key: 0 };
  23025. const _hoisted_2$d = ["id", "autocomplete", "aria-expanded", "aria-labelledby", "disabled", "readonly", "name", "unselectable"];
  23026. const _hoisted_3$9 = ["textContent"];
  23027. const _hoisted_4$8 = ["id", "aria-labelledby", "aria-expanded", "autocomplete", "disabled", "name", "readonly", "unselectable"];
  23028. const _hoisted_5$8 = ["textContent"];
  23029. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  23030. const _component_el_tag = resolveComponent("el-tag");
  23031. const _component_el_tooltip = resolveComponent("el-tooltip");
  23032. const _component_el_icon = resolveComponent("el-icon");
  23033. const _component_el_select_menu = resolveComponent("el-select-menu");
  23034. const _directive_model_text = resolveDirective("model-text");
  23035. const _directive_click_outside = resolveDirective("click-outside");
  23036. return withDirectives((openBlock(), createElementBlock("div", {
  23037. ref: "selectRef",
  23038. class: normalizeClass([_ctx.nsSelectV2.b(), _ctx.nsSelectV2.m(_ctx.selectSize)]),
  23039. onClick: _cache[24] || (_cache[24] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"])),
  23040. onMouseenter: _cache[25] || (_cache[25] = ($event) => _ctx.states.comboBoxHovering = true),
  23041. onMouseleave: _cache[26] || (_cache[26] = ($event) => _ctx.states.comboBoxHovering = false)
  23042. }, [
  23043. createVNode(_component_el_tooltip, {
  23044. ref: "popper",
  23045. visible: _ctx.dropdownMenuVisible,
  23046. "onUpdate:visible": _cache[22] || (_cache[22] = ($event) => _ctx.dropdownMenuVisible = $event),
  23047. teleported: _ctx.compatTeleported,
  23048. "popper-class": [_ctx.nsSelectV2.e("popper"), _ctx.popperClass],
  23049. "gpu-acceleration": false,
  23050. "stop-popper-mouse-event": false,
  23051. "popper-options": _ctx.popperOptions,
  23052. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  23053. effect: _ctx.effect,
  23054. placement: "bottom-start",
  23055. pure: "",
  23056. transition: `${_ctx.nsSelectV2.namespace.value}-zoom-in-top`,
  23057. trigger: "click",
  23058. persistent: _ctx.persistent,
  23059. onBeforeShow: _ctx.handleMenuEnter,
  23060. onHide: _cache[23] || (_cache[23] = ($event) => _ctx.states.inputValue = _ctx.states.displayInputValue)
  23061. }, {
  23062. default: withCtx(() => {
  23063. var _a2;
  23064. return [
  23065. createElementVNode("div", {
  23066. ref: "selectionRef",
  23067. class: normalizeClass([
  23068. _ctx.nsSelectV2.e("wrapper"),
  23069. _ctx.nsSelectV2.is("focused", _ctx.states.isComposing),
  23070. _ctx.nsSelectV2.is("hovering", _ctx.states.comboBoxHovering),
  23071. _ctx.nsSelectV2.is("filterable", _ctx.filterable),
  23072. _ctx.nsSelectV2.is("disabled", _ctx.selectDisabled)
  23073. ])
  23074. }, [
  23075. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
  23076. renderSlot(_ctx.$slots, "prefix")
  23077. ])) : createCommentVNode("v-if", true),
  23078. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  23079. key: 1,
  23080. class: normalizeClass(_ctx.nsSelectV2.e("selection"))
  23081. }, [
  23082. _ctx.collapseTags && _ctx.modelValue.length > 0 ? (openBlock(), createElementBlock("div", {
  23083. key: 0,
  23084. class: normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  23085. }, [
  23086. createVNode(_component_el_tag, {
  23087. closable: !_ctx.selectDisabled && !((_a2 = _ctx.states.cachedOptions[0]) == null ? void 0 : _a2.disable),
  23088. size: _ctx.collapseTagSize,
  23089. type: "info",
  23090. "disable-transitions": "",
  23091. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.states.cachedOptions[0]))
  23092. }, {
  23093. default: withCtx(() => {
  23094. var _a22;
  23095. return [
  23096. createElementVNode("span", {
  23097. class: normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  23098. style: normalizeStyle({
  23099. maxWidth: `${_ctx.tagMaxWidth}px`
  23100. })
  23101. }, toDisplayString((_a22 = _ctx.states.cachedOptions[0]) == null ? void 0 : _a22.label), 7)
  23102. ];
  23103. }),
  23104. _: 1
  23105. }, 8, ["closable", "size"]),
  23106. _ctx.modelValue.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
  23107. key: 0,
  23108. closable: false,
  23109. size: _ctx.collapseTagSize,
  23110. type: "info",
  23111. "disable-transitions": ""
  23112. }, {
  23113. default: withCtx(() => [
  23114. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  23115. key: 0,
  23116. disabled: _ctx.dropdownMenuVisible,
  23117. "fallback-placements": ["bottom", "top", "right", "left"],
  23118. effect: _ctx.effect,
  23119. placement: "bottom",
  23120. teleported: false
  23121. }, {
  23122. default: withCtx(() => [
  23123. createElementVNode("span", {
  23124. class: normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  23125. style: normalizeStyle({
  23126. maxWidth: `${_ctx.tagMaxWidth}px`
  23127. })
  23128. }, "+ " + toDisplayString(_ctx.modelValue.length - 1), 7)
  23129. ]),
  23130. content: withCtx(() => [
  23131. createElementVNode("div", {
  23132. class: normalizeClass(_ctx.nsSelectV2.e("selection"))
  23133. }, [
  23134. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.states.cachedOptions, (selected, idx) => {
  23135. return openBlock(), createElementBlock("div", {
  23136. key: idx,
  23137. class: normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  23138. }, [
  23139. (openBlock(), createBlock(_component_el_tag, {
  23140. key: _ctx.getValueKey(selected),
  23141. closable: !_ctx.selectDisabled && !selected.disabled,
  23142. size: _ctx.collapseTagSize,
  23143. class: "in-tooltip",
  23144. type: "info",
  23145. "disable-transitions": "",
  23146. onClose: ($event) => _ctx.deleteTag($event, selected)
  23147. }, {
  23148. default: withCtx(() => [
  23149. createElementVNode("span", {
  23150. class: normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  23151. style: normalizeStyle({
  23152. maxWidth: `${_ctx.tagMaxWidth}px`
  23153. })
  23154. }, toDisplayString(_ctx.getLabel(selected)), 7)
  23155. ]),
  23156. _: 2
  23157. }, 1032, ["closable", "size", "onClose"]))
  23158. ], 2);
  23159. }), 128))
  23160. ], 2)
  23161. ]),
  23162. _: 1
  23163. }, 8, ["disabled", "effect"])) : (openBlock(), createElementBlock("span", {
  23164. key: 1,
  23165. class: normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  23166. style: normalizeStyle({
  23167. maxWidth: `${_ctx.tagMaxWidth}px`
  23168. })
  23169. }, "+ " + toDisplayString(_ctx.modelValue.length - 1), 7))
  23170. ]),
  23171. _: 1
  23172. }, 8, ["size"])) : createCommentVNode("v-if", true)
  23173. ], 2)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.states.cachedOptions, (selected, idx) => {
  23174. return openBlock(), createElementBlock("div", {
  23175. key: idx,
  23176. class: normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  23177. }, [
  23178. (openBlock(), createBlock(_component_el_tag, {
  23179. key: _ctx.getValueKey(selected),
  23180. closable: !_ctx.selectDisabled && !selected.disabled,
  23181. size: _ctx.collapseTagSize,
  23182. type: "info",
  23183. "disable-transitions": "",
  23184. onClose: ($event) => _ctx.deleteTag($event, selected)
  23185. }, {
  23186. default: withCtx(() => [
  23187. createElementVNode("span", {
  23188. class: normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  23189. style: normalizeStyle({
  23190. maxWidth: `${_ctx.tagMaxWidth}px`
  23191. })
  23192. }, toDisplayString(_ctx.getLabel(selected)), 7)
  23193. ]),
  23194. _: 2
  23195. }, 1032, ["closable", "size", "onClose"]))
  23196. ], 2);
  23197. }), 128)),
  23198. createElementVNode("div", {
  23199. class: normalizeClass([
  23200. _ctx.nsSelectV2.e("selected-item"),
  23201. _ctx.nsSelectV2.e("input-wrapper")
  23202. ]),
  23203. style: normalizeStyle(_ctx.inputWrapperStyle)
  23204. }, [
  23205. withDirectives(createElementVNode("input", {
  23206. id: _ctx.id,
  23207. ref: "inputRef",
  23208. autocomplete: _ctx.autocomplete,
  23209. "aria-autocomplete": "list",
  23210. "aria-haspopup": "listbox",
  23211. autocapitalize: "off",
  23212. "aria-expanded": _ctx.expanded,
  23213. "aria-labelledby": _ctx.label,
  23214. class: normalizeClass([
  23215. _ctx.nsSelectV2.is(_ctx.selectSize),
  23216. _ctx.nsSelectV2.e("combobox-input")
  23217. ]),
  23218. disabled: _ctx.disabled,
  23219. role: "combobox",
  23220. readonly: !_ctx.filterable,
  23221. spellcheck: "false",
  23222. type: "text",
  23223. name: _ctx.name,
  23224. unselectable: _ctx.expanded ? "on" : void 0,
  23225. "onUpdate:modelValue": _cache[1] || (_cache[1] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args)),
  23226. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  23227. onInput: _cache[3] || (_cache[3] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  23228. onCompositionstart: _cache[4] || (_cache[4] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  23229. onCompositionupdate: _cache[5] || (_cache[5] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  23230. onCompositionend: _cache[6] || (_cache[6] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  23231. onKeydown: [
  23232. _cache[7] || (_cache[7] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  23233. _cache[8] || (_cache[8] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  23234. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  23235. _cache[10] || (_cache[10] = withKeys(withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])),
  23236. _cache[11] || (_cache[11] = withKeys(withModifiers((...args) => _ctx.handleDel && _ctx.handleDel(...args), ["stop"]), ["delete"]))
  23237. ]
  23238. }, null, 42, _hoisted_2$d), [
  23239. [_directive_model_text, _ctx.states.displayInputValue]
  23240. ]),
  23241. _ctx.filterable ? (openBlock(), createElementBlock("span", {
  23242. key: 0,
  23243. ref: "calculatorRef",
  23244. "aria-hidden": "true",
  23245. class: normalizeClass(_ctx.nsSelectV2.e("input-calculator")),
  23246. textContent: toDisplayString(_ctx.states.displayInputValue)
  23247. }, null, 10, _hoisted_3$9)) : createCommentVNode("v-if", true)
  23248. ], 6)
  23249. ], 2)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  23250. createElementVNode("div", {
  23251. class: normalizeClass([
  23252. _ctx.nsSelectV2.e("selected-item"),
  23253. _ctx.nsSelectV2.e("input-wrapper")
  23254. ])
  23255. }, [
  23256. withDirectives(createElementVNode("input", {
  23257. id: _ctx.id,
  23258. ref: "inputRef",
  23259. "aria-autocomplete": "list",
  23260. "aria-haspopup": "listbox",
  23261. "aria-labelledby": _ctx.label,
  23262. "aria-expanded": _ctx.expanded,
  23263. autocapitalize: "off",
  23264. autocomplete: _ctx.autocomplete,
  23265. class: normalizeClass(_ctx.nsSelectV2.e("combobox-input")),
  23266. disabled: _ctx.disabled,
  23267. name: _ctx.name,
  23268. role: "combobox",
  23269. readonly: !_ctx.filterable,
  23270. spellcheck: "false",
  23271. type: "text",
  23272. unselectable: _ctx.expanded ? "on" : void 0,
  23273. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  23274. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  23275. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  23276. onFocus: _cache[15] || (_cache[15] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  23277. onInput: _cache[16] || (_cache[16] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  23278. onKeydown: [
  23279. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  23280. _cache[18] || (_cache[18] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  23281. _cache[19] || (_cache[19] = withKeys(withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  23282. _cache[20] || (_cache[20] = withKeys(withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"]))
  23283. ],
  23284. "onUpdate:modelValue": _cache[21] || (_cache[21] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args))
  23285. }, null, 42, _hoisted_4$8), [
  23286. [_directive_model_text, _ctx.states.displayInputValue]
  23287. ])
  23288. ], 2),
  23289. _ctx.filterable ? (openBlock(), createElementBlock("span", {
  23290. key: 0,
  23291. ref: "calculatorRef",
  23292. "aria-hidden": "true",
  23293. class: normalizeClass([
  23294. _ctx.nsSelectV2.e("selected-item"),
  23295. _ctx.nsSelectV2.e("input-calculator")
  23296. ]),
  23297. textContent: toDisplayString(_ctx.states.displayInputValue)
  23298. }, null, 10, _hoisted_5$8)) : createCommentVNode("v-if", true)
  23299. ], 64)),
  23300. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("span", {
  23301. key: 3,
  23302. class: normalizeClass([
  23303. _ctx.nsSelectV2.e("placeholder"),
  23304. _ctx.nsSelectV2.is("transparent", _ctx.states.isComposing || (_ctx.placeholder && _ctx.multiple ? _ctx.modelValue.length === 0 : !_ctx.hasModelValue))
  23305. ])
  23306. }, toDisplayString(_ctx.currentPlaceholder), 3)) : createCommentVNode("v-if", true),
  23307. createElementVNode("span", {
  23308. class: normalizeClass(_ctx.nsSelectV2.e("suffix"))
  23309. }, [
  23310. _ctx.iconComponent ? withDirectives((openBlock(), createBlock(_component_el_icon, {
  23311. key: 0,
  23312. class: normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  23313. }, {
  23314. default: withCtx(() => [
  23315. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  23316. ]),
  23317. _: 1
  23318. }, 8, ["class"])), [
  23319. [vShow, !_ctx.showClearBtn]
  23320. ]) : createCommentVNode("v-if", true),
  23321. _ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  23322. key: 1,
  23323. class: normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon")]),
  23324. onClick: withModifiers(_ctx.handleClear, ["prevent", "stop"])
  23325. }, {
  23326. default: withCtx(() => [
  23327. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  23328. ]),
  23329. _: 1
  23330. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  23331. _ctx.validateState && _ctx.validateIcon ? (openBlock(), createBlock(_component_el_icon, {
  23332. key: 2,
  23333. class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  23334. }, {
  23335. default: withCtx(() => [
  23336. (openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))
  23337. ]),
  23338. _: 1
  23339. }, 8, ["class"])) : createCommentVNode("v-if", true)
  23340. ], 2)
  23341. ], 2)
  23342. ];
  23343. }),
  23344. content: withCtx(() => [
  23345. createVNode(_component_el_select_menu, {
  23346. ref: "menuRef",
  23347. data: _ctx.filteredOptions,
  23348. width: _ctx.popperSize,
  23349. "hovering-index": _ctx.states.hoveringIndex,
  23350. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  23351. }, {
  23352. default: withCtx((scope) => [
  23353. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(scope)))
  23354. ]),
  23355. empty: withCtx(() => [
  23356. renderSlot(_ctx.$slots, "empty", {}, () => [
  23357. createElementVNode("p", {
  23358. class: normalizeClass(_ctx.nsSelectV2.e("empty"))
  23359. }, toDisplayString(_ctx.emptyText ? _ctx.emptyText : ""), 3)
  23360. ])
  23361. ]),
  23362. _: 3
  23363. }, 8, ["data", "width", "hovering-index", "scrollbar-always-on"])
  23364. ]),
  23365. _: 3
  23366. }, 8, ["visible", "teleported", "popper-class", "popper-options", "effect", "transition", "persistent", "onBeforeShow"])
  23367. ], 34)), [
  23368. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  23369. ]);
  23370. }
  23371. var Select = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$8], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select-v2/src/select.vue"]]);
  23372. Select.install = (app) => {
  23373. app.component(Select.name, Select);
  23374. };
  23375. const _Select = Select;
  23376. const ElSelectV2 = _Select;
  23377. const useTooltip = (props, formatTooltip, showTooltip) => {
  23378. const tooltip = ref(null);
  23379. const tooltipVisible = ref(false);
  23380. const enableFormat = computed(() => {
  23381. return formatTooltip.value instanceof Function;
  23382. });
  23383. const formatValue = computed(() => {
  23384. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  23385. });
  23386. const displayTooltip = debounce$1(() => {
  23387. showTooltip.value && (tooltipVisible.value = true);
  23388. }, 50);
  23389. const hideTooltip = debounce$1(() => {
  23390. showTooltip.value && (tooltipVisible.value = false);
  23391. }, 50);
  23392. return {
  23393. tooltip,
  23394. tooltipVisible,
  23395. formatValue,
  23396. displayTooltip,
  23397. hideTooltip
  23398. };
  23399. };
  23400. const useSliderButton = (props, initData, emit) => {
  23401. const {
  23402. disabled,
  23403. min: min2,
  23404. max: max2,
  23405. step,
  23406. showTooltip,
  23407. precision,
  23408. sliderSize,
  23409. formatTooltip,
  23410. emitChange,
  23411. resetSize,
  23412. updateDragging
  23413. } = inject("SliderProvider");
  23414. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  23415. const currentPosition = computed(() => {
  23416. return `${(props.modelValue - min2.value) / (max2.value - min2.value) * 100}%`;
  23417. });
  23418. const wrapperStyle = computed(() => {
  23419. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  23420. });
  23421. const handleMouseEnter = () => {
  23422. initData.hovering = true;
  23423. displayTooltip();
  23424. };
  23425. const handleMouseLeave = () => {
  23426. initData.hovering = false;
  23427. if (!initData.dragging) {
  23428. hideTooltip();
  23429. }
  23430. };
  23431. const onButtonDown = (event) => {
  23432. if (disabled.value)
  23433. return;
  23434. event.preventDefault();
  23435. onDragStart(event);
  23436. on(window, "mousemove", onDragging);
  23437. on(window, "touchmove", onDragging);
  23438. on(window, "mouseup", onDragEnd);
  23439. on(window, "touchend", onDragEnd);
  23440. on(window, "contextmenu", onDragEnd);
  23441. };
  23442. const onLeftKeyDown = () => {
  23443. if (disabled.value)
  23444. return;
  23445. initData.newPosition = Number.parseFloat(currentPosition.value) - step.value / (max2.value - min2.value) * 100;
  23446. setPosition(initData.newPosition);
  23447. emitChange();
  23448. };
  23449. const onRightKeyDown = () => {
  23450. if (disabled.value)
  23451. return;
  23452. initData.newPosition = Number.parseFloat(currentPosition.value) + step.value / (max2.value - min2.value) * 100;
  23453. setPosition(initData.newPosition);
  23454. emitChange();
  23455. };
  23456. const getClientXY = (event) => {
  23457. let clientX;
  23458. let clientY;
  23459. if (event.type.startsWith("touch")) {
  23460. clientY = event.touches[0].clientY;
  23461. clientX = event.touches[0].clientX;
  23462. } else {
  23463. clientY = event.clientY;
  23464. clientX = event.clientX;
  23465. }
  23466. return {
  23467. clientX,
  23468. clientY
  23469. };
  23470. };
  23471. const onDragStart = (event) => {
  23472. initData.dragging = true;
  23473. initData.isClick = true;
  23474. const { clientX, clientY } = getClientXY(event);
  23475. if (props.vertical) {
  23476. initData.startY = clientY;
  23477. } else {
  23478. initData.startX = clientX;
  23479. }
  23480. initData.startPosition = Number.parseFloat(currentPosition.value);
  23481. initData.newPosition = initData.startPosition;
  23482. };
  23483. const onDragging = (event) => {
  23484. if (initData.dragging) {
  23485. initData.isClick = false;
  23486. displayTooltip();
  23487. resetSize();
  23488. let diff;
  23489. const { clientX, clientY } = getClientXY(event);
  23490. if (props.vertical) {
  23491. initData.currentY = clientY;
  23492. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  23493. } else {
  23494. initData.currentX = clientX;
  23495. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  23496. }
  23497. initData.newPosition = initData.startPosition + diff;
  23498. setPosition(initData.newPosition);
  23499. }
  23500. };
  23501. const onDragEnd = () => {
  23502. if (initData.dragging) {
  23503. setTimeout(() => {
  23504. initData.dragging = false;
  23505. if (!initData.hovering) {
  23506. hideTooltip();
  23507. }
  23508. if (!initData.isClick) {
  23509. setPosition(initData.newPosition);
  23510. emitChange();
  23511. }
  23512. }, 0);
  23513. off(window, "mousemove", onDragging);
  23514. off(window, "touchmove", onDragging);
  23515. off(window, "mouseup", onDragEnd);
  23516. off(window, "touchend", onDragEnd);
  23517. off(window, "contextmenu", onDragEnd);
  23518. }
  23519. };
  23520. const setPosition = async (newPosition) => {
  23521. if (newPosition === null || Number.isNaN(+newPosition))
  23522. return;
  23523. if (newPosition < 0) {
  23524. newPosition = 0;
  23525. } else if (newPosition > 100) {
  23526. newPosition = 100;
  23527. }
  23528. const lengthPerStep = 100 / ((max2.value - min2.value) / step.value);
  23529. const steps = Math.round(newPosition / lengthPerStep);
  23530. let value = steps * lengthPerStep * (max2.value - min2.value) * 0.01 + min2.value;
  23531. value = Number.parseFloat(value.toFixed(precision.value));
  23532. emit(UPDATE_MODEL_EVENT, value);
  23533. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  23534. initData.oldValue = props.modelValue;
  23535. }
  23536. await nextTick();
  23537. initData.dragging && displayTooltip();
  23538. tooltip.value.updatePopper();
  23539. };
  23540. watch(() => initData.dragging, (val) => {
  23541. updateDragging(val);
  23542. });
  23543. return {
  23544. tooltip,
  23545. tooltipVisible,
  23546. showTooltip,
  23547. wrapperStyle,
  23548. formatValue,
  23549. handleMouseEnter,
  23550. handleMouseLeave,
  23551. onButtonDown,
  23552. onLeftKeyDown,
  23553. onRightKeyDown,
  23554. setPosition
  23555. };
  23556. };
  23557. const _sfc_main$k = defineComponent({
  23558. name: "ElSliderButton",
  23559. components: {
  23560. ElTooltip
  23561. },
  23562. props: {
  23563. modelValue: {
  23564. type: Number,
  23565. default: 0
  23566. },
  23567. vertical: {
  23568. type: Boolean,
  23569. default: false
  23570. },
  23571. tooltipClass: {
  23572. type: String,
  23573. default: ""
  23574. }
  23575. },
  23576. emits: [UPDATE_MODEL_EVENT],
  23577. setup(props, { emit }) {
  23578. const ns = useNamespace("slider");
  23579. const initData = reactive({
  23580. hovering: false,
  23581. dragging: false,
  23582. isClick: false,
  23583. startX: 0,
  23584. currentX: 0,
  23585. startY: 0,
  23586. currentY: 0,
  23587. startPosition: 0,
  23588. newPosition: 0,
  23589. oldValue: props.modelValue
  23590. });
  23591. const {
  23592. tooltip,
  23593. showTooltip,
  23594. tooltipVisible,
  23595. wrapperStyle,
  23596. formatValue,
  23597. handleMouseEnter,
  23598. handleMouseLeave,
  23599. onButtonDown,
  23600. onLeftKeyDown,
  23601. onRightKeyDown,
  23602. setPosition
  23603. } = useSliderButton(props, initData, emit);
  23604. const { hovering, dragging } = toRefs(initData);
  23605. return {
  23606. ns,
  23607. tooltip,
  23608. tooltipVisible,
  23609. showTooltip,
  23610. wrapperStyle,
  23611. formatValue,
  23612. handleMouseEnter,
  23613. handleMouseLeave,
  23614. onButtonDown,
  23615. onLeftKeyDown,
  23616. onRightKeyDown,
  23617. setPosition,
  23618. hovering,
  23619. dragging
  23620. };
  23621. }
  23622. });
  23623. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  23624. const _component_el_tooltip = resolveComponent("el-tooltip");
  23625. return openBlock(), createElementBlock("div", {
  23626. ref: "button",
  23627. class: normalizeClass([_ctx.ns.e("button-wrapper"), { hover: _ctx.hovering, dragging: _ctx.dragging }]),
  23628. style: normalizeStyle(_ctx.wrapperStyle),
  23629. tabindex: "0",
  23630. onMouseenter: _cache[1] || (_cache[1] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  23631. onMouseleave: _cache[2] || (_cache[2] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  23632. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  23633. onTouchstart: _cache[4] || (_cache[4] = (...args) => _ctx.onButtonDown && _ctx.onButtonDown(...args)),
  23634. onFocus: _cache[5] || (_cache[5] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  23635. onBlur: _cache[6] || (_cache[6] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  23636. onKeydown: [
  23637. _cache[7] || (_cache[7] = withKeys((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["left"])),
  23638. _cache[8] || (_cache[8] = withKeys((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["right"])),
  23639. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.onLeftKeyDown && _ctx.onLeftKeyDown(...args), ["prevent"]), ["down"])),
  23640. _cache[10] || (_cache[10] = withKeys(withModifiers((...args) => _ctx.onRightKeyDown && _ctx.onRightKeyDown(...args), ["prevent"]), ["up"]))
  23641. ]
  23642. }, [
  23643. createVNode(_component_el_tooltip, {
  23644. ref: "tooltip",
  23645. visible: _ctx.tooltipVisible,
  23646. "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => _ctx.tooltipVisible = $event),
  23647. placement: "top",
  23648. "stop-popper-mouse-event": false,
  23649. "popper-class": _ctx.tooltipClass,
  23650. disabled: !_ctx.showTooltip,
  23651. persistent: ""
  23652. }, {
  23653. content: withCtx(() => [
  23654. createElementVNode("span", null, toDisplayString(_ctx.formatValue), 1)
  23655. ]),
  23656. default: withCtx(() => [
  23657. createElementVNode("div", {
  23658. class: normalizeClass([_ctx.ns.e("button"), { hover: _ctx.hovering, dragging: _ctx.dragging }])
  23659. }, null, 2)
  23660. ]),
  23661. _: 1
  23662. }, 8, ["visible", "popper-class", "disabled"])
  23663. ], 38);
  23664. }
  23665. var SliderButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["render", _sfc_render$7], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/button.vue"]]);
  23666. const _sfc_main$j = defineComponent({
  23667. name: "ElMarker",
  23668. props: {
  23669. mark: {
  23670. type: [String, Object],
  23671. default: () => void 0
  23672. }
  23673. },
  23674. setup(props) {
  23675. const ns = useNamespace("slider");
  23676. const label = computed(() => {
  23677. return typeof props.mark === "string" ? props.mark : props.mark.label;
  23678. });
  23679. return {
  23680. ns,
  23681. label
  23682. };
  23683. },
  23684. render() {
  23685. var _a2;
  23686. return h$1("div", {
  23687. class: this.ns.e("marks-text"),
  23688. style: (_a2 = this.mark) == null ? void 0 : _a2.style
  23689. }, this.label);
  23690. }
  23691. });
  23692. var SliderMarker = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/marker.vue"]]);
  23693. const useMarks = (props) => {
  23694. return computed(() => {
  23695. if (!props.marks) {
  23696. return [];
  23697. }
  23698. const marksKeys = Object.keys(props.marks);
  23699. return marksKeys.map(parseFloat).sort((a2, b2) => a2 - b2).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  23700. point,
  23701. position: (point - props.min) * 100 / (props.max - props.min),
  23702. mark: props.marks[point]
  23703. }));
  23704. });
  23705. };
  23706. const useSlide = (props, initData, emit) => {
  23707. const elForm2 = inject(formContextKey, {});
  23708. const elFormItem2 = inject(formItemContextKey, {});
  23709. const slider = shallowRef(null);
  23710. const firstButton = ref(null);
  23711. const secondButton = ref(null);
  23712. const buttonRefs = {
  23713. firstButton,
  23714. secondButton
  23715. };
  23716. const sliderDisabled = computed(() => {
  23717. return props.disabled || elForm2.disabled || false;
  23718. });
  23719. const minValue = computed(() => {
  23720. return Math.min(initData.firstValue, initData.secondValue);
  23721. });
  23722. const maxValue = computed(() => {
  23723. return Math.max(initData.firstValue, initData.secondValue);
  23724. });
  23725. const barSize = computed(() => {
  23726. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  23727. });
  23728. const barStart = computed(() => {
  23729. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  23730. });
  23731. const runwayStyle = computed(() => {
  23732. return props.vertical ? { height: props.height } : {};
  23733. });
  23734. const barStyle = computed(() => {
  23735. return props.vertical ? {
  23736. height: barSize.value,
  23737. bottom: barStart.value
  23738. } : {
  23739. width: barSize.value,
  23740. left: barStart.value
  23741. };
  23742. });
  23743. const resetSize = () => {
  23744. if (slider.value) {
  23745. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  23746. }
  23747. };
  23748. const setPosition = (percent) => {
  23749. const targetValue = props.min + percent * (props.max - props.min) / 100;
  23750. if (!props.range) {
  23751. firstButton.value.setPosition(percent);
  23752. return;
  23753. }
  23754. let buttonRefName;
  23755. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  23756. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  23757. } else {
  23758. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  23759. }
  23760. buttonRefs[buttonRefName].value.setPosition(percent);
  23761. };
  23762. const setFirstValue = (firstValue) => {
  23763. initData.firstValue = firstValue;
  23764. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  23765. };
  23766. const setSecondValue = (secondValue) => {
  23767. initData.secondValue = secondValue;
  23768. if (props.range) {
  23769. _emit([minValue.value, maxValue.value]);
  23770. }
  23771. };
  23772. const _emit = (val) => {
  23773. emit(UPDATE_MODEL_EVENT, val);
  23774. emit(INPUT_EVENT, val);
  23775. };
  23776. const emitChange = async () => {
  23777. await nextTick();
  23778. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  23779. };
  23780. const onSliderClick = (event) => {
  23781. if (sliderDisabled.value || initData.dragging)
  23782. return;
  23783. resetSize();
  23784. if (props.vertical) {
  23785. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  23786. setPosition((sliderOffsetBottom - event.clientY) / initData.sliderSize * 100);
  23787. } else {
  23788. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  23789. setPosition((event.clientX - sliderOffsetLeft) / initData.sliderSize * 100);
  23790. }
  23791. emitChange();
  23792. };
  23793. return {
  23794. elFormItem: elFormItem2,
  23795. slider,
  23796. firstButton,
  23797. secondButton,
  23798. sliderDisabled,
  23799. minValue,
  23800. maxValue,
  23801. runwayStyle,
  23802. barStyle,
  23803. resetSize,
  23804. setPosition,
  23805. emitChange,
  23806. onSliderClick,
  23807. setFirstValue,
  23808. setSecondValue
  23809. };
  23810. };
  23811. const useStops = (props, initData, minValue, maxValue) => {
  23812. const stops = computed(() => {
  23813. if (!props.showStops || props.min > props.max)
  23814. return [];
  23815. if (props.step === 0) {
  23816. return [];
  23817. }
  23818. const stopCount = (props.max - props.min) / props.step;
  23819. const stepWidth = 100 * props.step / (props.max - props.min);
  23820. const result = Array.from({ length: stopCount - 1 }).map((_2, index) => (index + 1) * stepWidth);
  23821. if (props.range) {
  23822. return result.filter((step) => {
  23823. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  23824. });
  23825. } else {
  23826. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  23827. }
  23828. });
  23829. const getStopStyle = (position) => {
  23830. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  23831. };
  23832. return {
  23833. stops,
  23834. getStopStyle
  23835. };
  23836. };
  23837. const _sfc_main$i = defineComponent({
  23838. name: "ElSlider",
  23839. components: {
  23840. ElInputNumber,
  23841. SliderButton,
  23842. SliderMarker
  23843. },
  23844. props: {
  23845. modelValue: {
  23846. type: [Number, Array],
  23847. default: 0
  23848. },
  23849. min: {
  23850. type: Number,
  23851. default: 0
  23852. },
  23853. max: {
  23854. type: Number,
  23855. default: 100
  23856. },
  23857. step: {
  23858. type: Number,
  23859. default: 1
  23860. },
  23861. showInput: {
  23862. type: Boolean,
  23863. default: false
  23864. },
  23865. showInputControls: {
  23866. type: Boolean,
  23867. default: true
  23868. },
  23869. size: {
  23870. type: String,
  23871. validator: isValidComponentSize
  23872. },
  23873. inputSize: {
  23874. type: String,
  23875. validator: isValidComponentSize
  23876. },
  23877. showStops: {
  23878. type: Boolean,
  23879. default: false
  23880. },
  23881. showTooltip: {
  23882. type: Boolean,
  23883. default: true
  23884. },
  23885. formatTooltip: {
  23886. type: Function,
  23887. default: void 0
  23888. },
  23889. disabled: {
  23890. type: Boolean,
  23891. default: false
  23892. },
  23893. range: {
  23894. type: Boolean,
  23895. default: false
  23896. },
  23897. vertical: {
  23898. type: Boolean,
  23899. default: false
  23900. },
  23901. height: {
  23902. type: String,
  23903. default: ""
  23904. },
  23905. debounce: {
  23906. type: Number,
  23907. default: 300
  23908. },
  23909. label: {
  23910. type: String,
  23911. default: void 0
  23912. },
  23913. tooltipClass: {
  23914. type: String,
  23915. default: void 0
  23916. },
  23917. marks: Object
  23918. },
  23919. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT],
  23920. setup(props, { emit }) {
  23921. const ns = useNamespace("slider");
  23922. const initData = reactive({
  23923. firstValue: 0,
  23924. secondValue: 0,
  23925. oldValue: 0,
  23926. dragging: false,
  23927. sliderSize: 1
  23928. });
  23929. const {
  23930. elFormItem: elFormItem2,
  23931. slider,
  23932. firstButton,
  23933. secondButton,
  23934. sliderDisabled,
  23935. minValue,
  23936. maxValue,
  23937. runwayStyle,
  23938. barStyle,
  23939. resetSize,
  23940. emitChange,
  23941. onSliderClick,
  23942. setFirstValue,
  23943. setSecondValue
  23944. } = useSlide(props, initData, emit);
  23945. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  23946. const sliderWrapperSize = useSize();
  23947. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  23948. const sliderKls = computed(() => [
  23949. ns.b(),
  23950. ns.m(sliderWrapperSize.value),
  23951. ns.is("vertical", props.vertical),
  23952. { [ns.m("with-input")]: props.showInput }
  23953. ]);
  23954. const markList = useMarks(props);
  23955. useWatch(props, initData, minValue, maxValue, emit, elFormItem2);
  23956. const precision = computed(() => {
  23957. const precisions = [props.min, props.max, props.step].map((item) => {
  23958. const decimal = `${item}`.split(".")[1];
  23959. return decimal ? decimal.length : 0;
  23960. });
  23961. return Math.max.apply(null, precisions);
  23962. });
  23963. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  23964. const { firstValue, secondValue, oldValue, dragging, sliderSize } = toRefs(initData);
  23965. const updateDragging = (val) => {
  23966. initData.dragging = val;
  23967. };
  23968. provide("SliderProvider", __spreadProps(__spreadValues({}, toRefs(props)), {
  23969. sliderSize,
  23970. disabled: sliderDisabled,
  23971. precision,
  23972. emitChange,
  23973. resetSize,
  23974. updateDragging
  23975. }));
  23976. return {
  23977. ns,
  23978. firstValue,
  23979. secondValue,
  23980. oldValue,
  23981. dragging,
  23982. sliderSize,
  23983. slider,
  23984. firstButton,
  23985. secondButton,
  23986. sliderDisabled,
  23987. runwayStyle,
  23988. barStyle,
  23989. emitChange,
  23990. onSliderClick,
  23991. getStopStyle,
  23992. setFirstValue,
  23993. setSecondValue,
  23994. stops,
  23995. markList,
  23996. sliderWrapper,
  23997. sliderWrapperSize,
  23998. sliderInputSize,
  23999. sliderKls
  24000. };
  24001. }
  24002. });
  24003. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem2) => {
  24004. const _emit = (val) => {
  24005. emit(UPDATE_MODEL_EVENT, val);
  24006. emit(INPUT_EVENT, val);
  24007. };
  24008. const valueChanged = () => {
  24009. if (props.range) {
  24010. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  24011. } else {
  24012. return props.modelValue !== initData.oldValue;
  24013. }
  24014. };
  24015. const setValues = () => {
  24016. var _a2, _b2;
  24017. if (props.min > props.max) {
  24018. throwError("Slider", "min should not be greater than max.");
  24019. return;
  24020. }
  24021. const val = props.modelValue;
  24022. if (props.range && Array.isArray(val)) {
  24023. if (val[1] < props.min) {
  24024. _emit([props.min, props.min]);
  24025. } else if (val[0] > props.max) {
  24026. _emit([props.max, props.max]);
  24027. } else if (val[0] < props.min) {
  24028. _emit([props.min, val[1]]);
  24029. } else if (val[1] > props.max) {
  24030. _emit([val[0], props.max]);
  24031. } else {
  24032. initData.firstValue = val[0];
  24033. initData.secondValue = val[1];
  24034. if (valueChanged()) {
  24035. (_a2 = elFormItem2.validate) == null ? void 0 : _a2.call(elFormItem2, "change").catch((err) => debugWarn());
  24036. initData.oldValue = val.slice();
  24037. }
  24038. }
  24039. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  24040. if (val < props.min) {
  24041. _emit(props.min);
  24042. } else if (val > props.max) {
  24043. _emit(props.max);
  24044. } else {
  24045. initData.firstValue = val;
  24046. if (valueChanged()) {
  24047. (_b2 = elFormItem2.validate) == null ? void 0 : _b2.call(elFormItem2, "change").catch((err) => debugWarn());
  24048. initData.oldValue = val;
  24049. }
  24050. }
  24051. }
  24052. };
  24053. setValues();
  24054. watch(() => initData.dragging, (val) => {
  24055. if (!val) {
  24056. setValues();
  24057. }
  24058. });
  24059. watch(() => props.modelValue, (val, oldVal) => {
  24060. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  24061. return;
  24062. }
  24063. setValues();
  24064. }, {
  24065. deep: true
  24066. });
  24067. watch(() => [props.min, props.max], () => {
  24068. setValues();
  24069. });
  24070. };
  24071. const useLifecycle = (props, initData, resetSize) => {
  24072. const sliderWrapper = ref(null);
  24073. onMounted(async () => {
  24074. let valuetext;
  24075. if (props.range) {
  24076. if (Array.isArray(props.modelValue)) {
  24077. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  24078. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  24079. } else {
  24080. initData.firstValue = props.min;
  24081. initData.secondValue = props.max;
  24082. }
  24083. initData.oldValue = [initData.firstValue, initData.secondValue];
  24084. valuetext = `${initData.firstValue}-${initData.secondValue}`;
  24085. } else {
  24086. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  24087. initData.firstValue = props.min;
  24088. } else {
  24089. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  24090. }
  24091. initData.oldValue = initData.firstValue;
  24092. valuetext = initData.firstValue;
  24093. }
  24094. sliderWrapper.value.setAttribute("aria-valuetext", valuetext);
  24095. sliderWrapper.value.setAttribute("aria-label", props.label ? props.label : `slider between ${props.min} and ${props.max}`);
  24096. on(window, "resize", resetSize);
  24097. await nextTick();
  24098. resetSize();
  24099. });
  24100. onBeforeUnmount(() => {
  24101. off(window, "resize", resetSize);
  24102. });
  24103. return {
  24104. sliderWrapper
  24105. };
  24106. };
  24107. const _hoisted_1$e = ["aria-valuemin", "aria-valuemax", "aria-orientation", "aria-disabled"];
  24108. const _hoisted_2$c = { key: 1 };
  24109. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  24110. const _component_slider_button = resolveComponent("slider-button");
  24111. const _component_slider_marker = resolveComponent("slider-marker");
  24112. const _component_el_input_number = resolveComponent("el-input-number");
  24113. return openBlock(), createElementBlock("div", {
  24114. ref: "sliderWrapper",
  24115. class: normalizeClass(_ctx.sliderKls),
  24116. role: "slider",
  24117. "aria-valuemin": _ctx.min,
  24118. "aria-valuemax": _ctx.max,
  24119. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  24120. "aria-disabled": _ctx.sliderDisabled
  24121. }, [
  24122. createElementVNode("div", {
  24123. ref: "slider",
  24124. class: normalizeClass([
  24125. _ctx.ns.e("runway"),
  24126. { "show-input": _ctx.showInput && !_ctx.range },
  24127. _ctx.ns.is("disabled", _ctx.sliderDisabled)
  24128. ]),
  24129. style: normalizeStyle(_ctx.runwayStyle),
  24130. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onSliderClick && _ctx.onSliderClick(...args))
  24131. }, [
  24132. createElementVNode("div", {
  24133. class: normalizeClass(_ctx.ns.e("bar")),
  24134. style: normalizeStyle(_ctx.barStyle)
  24135. }, null, 6),
  24136. createVNode(_component_slider_button, {
  24137. ref: "firstButton",
  24138. "model-value": _ctx.firstValue,
  24139. vertical: _ctx.vertical,
  24140. "tooltip-class": _ctx.tooltipClass,
  24141. "onUpdate:modelValue": _ctx.setFirstValue
  24142. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"]),
  24143. _ctx.range ? (openBlock(), createBlock(_component_slider_button, {
  24144. key: 0,
  24145. ref: "secondButton",
  24146. "model-value": _ctx.secondValue,
  24147. vertical: _ctx.vertical,
  24148. "tooltip-class": _ctx.tooltipClass,
  24149. "onUpdate:modelValue": _ctx.setSecondValue
  24150. }, null, 8, ["model-value", "vertical", "tooltip-class", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
  24151. _ctx.showStops ? (openBlock(), createElementBlock("div", _hoisted_2$c, [
  24152. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.stops, (item, key) => {
  24153. return openBlock(), createElementBlock("div", {
  24154. key,
  24155. class: normalizeClass(_ctx.ns.e("stop")),
  24156. style: normalizeStyle(_ctx.getStopStyle(item))
  24157. }, null, 6);
  24158. }), 128))
  24159. ])) : createCommentVNode("v-if", true),
  24160. _ctx.markList.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  24161. createElementVNode("div", null, [
  24162. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  24163. return openBlock(), createElementBlock("div", {
  24164. key,
  24165. style: normalizeStyle(_ctx.getStopStyle(item.position)),
  24166. class: normalizeClass([_ctx.ns.e("stop"), _ctx.ns.e("marks-stop")])
  24167. }, null, 6);
  24168. }), 128))
  24169. ]),
  24170. createElementVNode("div", {
  24171. class: normalizeClass(_ctx.ns.e("marks"))
  24172. }, [
  24173. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.markList, (item, key) => {
  24174. return openBlock(), createBlock(_component_slider_marker, {
  24175. key,
  24176. mark: item.mark,
  24177. style: normalizeStyle(_ctx.getStopStyle(item.position))
  24178. }, null, 8, ["mark", "style"]);
  24179. }), 128))
  24180. ], 2)
  24181. ], 64)) : createCommentVNode("v-if", true)
  24182. ], 6),
  24183. _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(_component_el_input_number, {
  24184. key: 0,
  24185. ref: "input",
  24186. "model-value": _ctx.firstValue,
  24187. class: normalizeClass(_ctx.ns.e("input")),
  24188. step: _ctx.step,
  24189. disabled: _ctx.sliderDisabled,
  24190. controls: _ctx.showInputControls,
  24191. min: _ctx.min,
  24192. max: _ctx.max,
  24193. debounce: _ctx.debounce,
  24194. size: _ctx.sliderInputSize,
  24195. "onUpdate:modelValue": _ctx.setFirstValue,
  24196. onChange: _ctx.emitChange
  24197. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
  24198. ], 10, _hoisted_1$e);
  24199. }
  24200. var Slider = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["render", _sfc_render$6], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/index.vue"]]);
  24201. Slider.install = (app) => {
  24202. app.component(Slider.name, Slider);
  24203. };
  24204. const _Slider = Slider;
  24205. const ElSlider = _Slider;
  24206. const spaceItem = buildProps({
  24207. prefixCls: {
  24208. type: String,
  24209. default: ""
  24210. }
  24211. });
  24212. const _sfc_main$h = defineComponent({
  24213. props: spaceItem,
  24214. setup(props) {
  24215. const ns = useNamespace("space");
  24216. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  24217. return {
  24218. classes
  24219. };
  24220. }
  24221. });
  24222. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  24223. return openBlock(), createElementBlock("div", {
  24224. class: normalizeClass(_ctx.classes)
  24225. }, [
  24226. renderSlot(_ctx.$slots, "default")
  24227. ], 2);
  24228. }
  24229. var Item = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["render", _sfc_render$5], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/space/src/item.vue"]]);
  24230. const SIZE_MAP = {
  24231. small: 8,
  24232. default: 12,
  24233. large: 16
  24234. };
  24235. function useSpace(props) {
  24236. const ns = useNamespace("space");
  24237. const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
  24238. const horizontalSize = ref(0);
  24239. const verticalSize = ref(0);
  24240. const containerStyle = computed(() => {
  24241. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
  24242. const alignment = {
  24243. alignItems: props.alignment
  24244. };
  24245. return [wrapKls, alignment, props.style];
  24246. });
  24247. const itemStyle = computed(() => {
  24248. const itemBaseStyle = {
  24249. paddingBottom: `${verticalSize.value}px`,
  24250. marginRight: `${horizontalSize.value}px`
  24251. };
  24252. const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  24253. return [itemBaseStyle, fillStyle];
  24254. });
  24255. watchEffect(() => {
  24256. const { size = "small", wrap, direction: dir, fill } = props;
  24257. if (Array.isArray(size)) {
  24258. const [h2 = 0, v2 = 0] = size;
  24259. horizontalSize.value = h2;
  24260. verticalSize.value = v2;
  24261. } else {
  24262. let val;
  24263. if (isNumber(size)) {
  24264. val = size;
  24265. } else {
  24266. val = SIZE_MAP[size] || SIZE_MAP.small;
  24267. }
  24268. if ((wrap || fill) && dir === "horizontal") {
  24269. horizontalSize.value = verticalSize.value = val;
  24270. } else {
  24271. if (dir === "horizontal") {
  24272. horizontalSize.value = val;
  24273. verticalSize.value = 0;
  24274. } else {
  24275. verticalSize.value = val;
  24276. horizontalSize.value = 0;
  24277. }
  24278. }
  24279. }
  24280. });
  24281. return {
  24282. classes,
  24283. containerStyle,
  24284. itemStyle
  24285. };
  24286. }
  24287. const spaceProps = buildProps({
  24288. direction: {
  24289. type: String,
  24290. values: ["horizontal", "vertical"],
  24291. default: "horizontal"
  24292. },
  24293. class: {
  24294. type: definePropType([
  24295. String,
  24296. Object,
  24297. Array
  24298. ]),
  24299. default: ""
  24300. },
  24301. style: {
  24302. type: definePropType([String, Array, Object]),
  24303. default: ""
  24304. },
  24305. alignment: {
  24306. type: definePropType(String),
  24307. default: "center"
  24308. },
  24309. prefixCls: {
  24310. type: String
  24311. },
  24312. spacer: {
  24313. type: definePropType([Object, String, Number, Array]),
  24314. default: null,
  24315. validator: (val) => isVNode(val) || isNumber(val) || isString(val)
  24316. },
  24317. wrap: {
  24318. type: Boolean,
  24319. default: false
  24320. },
  24321. fill: {
  24322. type: Boolean,
  24323. default: false
  24324. },
  24325. fillRatio: {
  24326. type: Number,
  24327. default: 100
  24328. },
  24329. size: {
  24330. type: [String, Array, Number],
  24331. values: componentSizes,
  24332. validator: (val) => {
  24333. return isNumber(val) || isArray(val) && val.length === 2 && val.every((i) => isNumber(i));
  24334. }
  24335. }
  24336. });
  24337. var Space = defineComponent({
  24338. name: "ElSpace",
  24339. props: spaceProps,
  24340. setup(props, { slots }) {
  24341. const { classes, containerStyle, itemStyle } = useSpace(props);
  24342. return () => {
  24343. var _a2;
  24344. const { spacer, prefixCls, direction: direction2 } = props;
  24345. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  24346. if (((_a2 = children.children) != null ? _a2 : []).length === 0)
  24347. return null;
  24348. if (isArray(children.children)) {
  24349. let extractedChildren = [];
  24350. children.children.forEach((child, loopKey) => {
  24351. if (isFragment(child)) {
  24352. if (isArray(child.children)) {
  24353. child.children.forEach((nested, key) => {
  24354. extractedChildren.push(createVNode(Item, {
  24355. style: itemStyle.value,
  24356. prefixCls,
  24357. key: `nested-${key}`
  24358. }, {
  24359. default: () => [nested]
  24360. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  24361. });
  24362. }
  24363. } else if (isValidElementNode(child)) {
  24364. extractedChildren.push(createVNode(Item, {
  24365. style: itemStyle.value,
  24366. prefixCls,
  24367. key: `LoopKey${loopKey}`
  24368. }, {
  24369. default: () => [child]
  24370. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  24371. }
  24372. });
  24373. if (spacer) {
  24374. const len = extractedChildren.length - 1;
  24375. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  24376. const children2 = [...acc, child];
  24377. if (idx !== len) {
  24378. children2.push(createVNode("span", {
  24379. style: [
  24380. itemStyle.value,
  24381. direction2 === "vertical" ? "width: 100%" : null
  24382. ],
  24383. key: idx
  24384. }, [
  24385. isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
  24386. ], PatchFlags.STYLE));
  24387. }
  24388. return children2;
  24389. }, []);
  24390. }
  24391. return createVNode("div", {
  24392. class: classes.value,
  24393. style: containerStyle.value
  24394. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  24395. }
  24396. return children.children;
  24397. };
  24398. }
  24399. });
  24400. const ElSpace = withInstall(Space);
  24401. const switchProps = buildProps({
  24402. modelValue: {
  24403. type: [Boolean, String, Number],
  24404. default: false
  24405. },
  24406. value: {
  24407. type: [Boolean, String, Number],
  24408. default: false
  24409. },
  24410. disabled: {
  24411. type: Boolean,
  24412. default: false
  24413. },
  24414. width: {
  24415. type: Number,
  24416. default: 40
  24417. },
  24418. inlinePrompt: {
  24419. type: Boolean,
  24420. default: false
  24421. },
  24422. activeIcon: {
  24423. type: iconPropType,
  24424. default: ""
  24425. },
  24426. inactiveIcon: {
  24427. type: iconPropType,
  24428. default: ""
  24429. },
  24430. activeText: {
  24431. type: String,
  24432. default: ""
  24433. },
  24434. inactiveText: {
  24435. type: String,
  24436. default: ""
  24437. },
  24438. activeColor: {
  24439. type: String,
  24440. default: ""
  24441. },
  24442. inactiveColor: {
  24443. type: String,
  24444. default: ""
  24445. },
  24446. borderColor: {
  24447. type: String,
  24448. default: ""
  24449. },
  24450. activeValue: {
  24451. type: [Boolean, String, Number],
  24452. default: true
  24453. },
  24454. inactiveValue: {
  24455. type: [Boolean, String, Number],
  24456. default: false
  24457. },
  24458. name: {
  24459. type: String,
  24460. default: ""
  24461. },
  24462. validateEvent: {
  24463. type: Boolean,
  24464. default: true
  24465. },
  24466. id: String,
  24467. loading: {
  24468. type: Boolean,
  24469. default: false
  24470. },
  24471. beforeChange: {
  24472. type: definePropType(Function)
  24473. },
  24474. size: {
  24475. type: String,
  24476. validator: isValidComponentSize
  24477. }
  24478. });
  24479. const switchEmits = {
  24480. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  24481. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  24482. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  24483. };
  24484. const COMPONENT_NAME = "ElSwitch";
  24485. const _sfc_main$g = defineComponent({
  24486. name: COMPONENT_NAME,
  24487. components: { ElIcon, Loading: loading },
  24488. props: switchProps,
  24489. emits: switchEmits,
  24490. setup(props, { emit }) {
  24491. const { formItem } = useFormItem();
  24492. const switchDisabled = useDisabled$1(computed(() => props.loading));
  24493. const ns = useNamespace("switch");
  24494. const switchSize = useSize();
  24495. const isModelValue = ref(props.modelValue !== false);
  24496. const input = ref();
  24497. const core = ref();
  24498. const switchKls = computed(() => [
  24499. ns.b(),
  24500. ns.m(switchSize.value),
  24501. ns.is("disabled", switchDisabled.value),
  24502. ns.is("checked", checked.value)
  24503. ]);
  24504. watch(() => props.modelValue, () => {
  24505. isModelValue.value = true;
  24506. });
  24507. watch(() => props.value, () => {
  24508. isModelValue.value = false;
  24509. });
  24510. const actualValue = computed(() => {
  24511. return isModelValue.value ? props.modelValue : props.value;
  24512. });
  24513. const checked = computed(() => actualValue.value === props.activeValue);
  24514. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  24515. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  24516. emit(CHANGE_EVENT, props.inactiveValue);
  24517. emit(INPUT_EVENT, props.inactiveValue);
  24518. }
  24519. watch(checked, () => {
  24520. var _a2;
  24521. input.value.checked = checked.value;
  24522. if (props.activeColor || props.inactiveColor) {
  24523. setBackgroundColor();
  24524. }
  24525. if (props.validateEvent) {
  24526. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  24527. }
  24528. });
  24529. const handleChange2 = () => {
  24530. const val = checked.value ? props.inactiveValue : props.activeValue;
  24531. emit(UPDATE_MODEL_EVENT, val);
  24532. emit(CHANGE_EVENT, val);
  24533. emit(INPUT_EVENT, val);
  24534. nextTick(() => {
  24535. input.value.checked = checked.value;
  24536. });
  24537. };
  24538. const switchValue = () => {
  24539. if (switchDisabled.value)
  24540. return;
  24541. const { beforeChange } = props;
  24542. if (!beforeChange) {
  24543. handleChange2();
  24544. return;
  24545. }
  24546. const shouldChange = beforeChange();
  24547. const isExpectType = [
  24548. isPromise(shouldChange),
  24549. isBoolean(shouldChange)
  24550. ].some((i) => i);
  24551. if (!isExpectType) {
  24552. throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
  24553. }
  24554. if (isPromise(shouldChange)) {
  24555. shouldChange.then((result) => {
  24556. if (result) {
  24557. handleChange2();
  24558. }
  24559. }).catch((e) => {
  24560. });
  24561. } else if (shouldChange) {
  24562. handleChange2();
  24563. }
  24564. };
  24565. const setBackgroundColor = () => {
  24566. const newColor = checked.value ? props.activeColor : props.inactiveColor;
  24567. const coreEl = core.value;
  24568. if (props.borderColor)
  24569. coreEl.style.borderColor = props.borderColor;
  24570. else if (!props.borderColor)
  24571. coreEl.style.borderColor = newColor;
  24572. coreEl.style.backgroundColor = newColor;
  24573. coreEl.children[0].style.color = newColor;
  24574. };
  24575. const focus = () => {
  24576. var _a2, _b2;
  24577. (_b2 = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b2.call(_a2);
  24578. };
  24579. onMounted(() => {
  24580. if (props.activeColor || props.inactiveColor || props.borderColor) {
  24581. setBackgroundColor();
  24582. }
  24583. input.value.checked = checked.value;
  24584. });
  24585. return {
  24586. ns,
  24587. input,
  24588. core,
  24589. switchDisabled,
  24590. checked,
  24591. switchKls,
  24592. handleChange: handleChange2,
  24593. switchValue,
  24594. focus
  24595. };
  24596. }
  24597. });
  24598. const _hoisted_1$d = ["aria-checked", "aria-disabled"];
  24599. const _hoisted_2$b = ["id", "name", "true-value", "false-value", "disabled"];
  24600. const _hoisted_3$8 = ["aria-hidden"];
  24601. const _hoisted_4$7 = ["aria-hidden"];
  24602. const _hoisted_5$7 = ["aria-hidden"];
  24603. const _hoisted_6$6 = ["aria-hidden"];
  24604. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  24605. const _component_el_icon = resolveComponent("el-icon");
  24606. const _component_loading = resolveComponent("loading");
  24607. return openBlock(), createElementBlock("div", {
  24608. class: normalizeClass(_ctx.switchKls),
  24609. role: "switch",
  24610. "aria-checked": _ctx.checked,
  24611. "aria-disabled": _ctx.switchDisabled,
  24612. onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["prevent"]))
  24613. }, [
  24614. createElementVNode("input", {
  24615. id: _ctx.id,
  24616. ref: "input",
  24617. class: normalizeClass(_ctx.ns.e("input")),
  24618. type: "checkbox",
  24619. name: _ctx.name,
  24620. "true-value": _ctx.activeValue,
  24621. "false-value": _ctx.inactiveValue,
  24622. disabled: _ctx.switchDisabled,
  24623. onChange: _cache[0] || (_cache[0] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
  24624. onKeydown: _cache[1] || (_cache[1] = withKeys((...args) => _ctx.switchValue && _ctx.switchValue(...args), ["enter"]))
  24625. }, null, 42, _hoisted_2$b),
  24626. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  24627. key: 0,
  24628. class: normalizeClass([
  24629. _ctx.ns.e("label"),
  24630. _ctx.ns.em("label", "left"),
  24631. _ctx.ns.is("active", !_ctx.checked)
  24632. ])
  24633. }, [
  24634. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  24635. default: withCtx(() => [
  24636. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  24637. ]),
  24638. _: 1
  24639. })) : createCommentVNode("v-if", true),
  24640. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  24641. key: 1,
  24642. "aria-hidden": _ctx.checked
  24643. }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$8)) : createCommentVNode("v-if", true)
  24644. ], 2)) : createCommentVNode("v-if", true),
  24645. createElementVNode("span", {
  24646. ref: "core",
  24647. class: normalizeClass(_ctx.ns.e("core")),
  24648. style: normalizeStyle({ width: (_ctx.width || 40) + "px" })
  24649. }, [
  24650. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  24651. key: 0,
  24652. class: normalizeClass(_ctx.ns.e("inner"))
  24653. }, [
  24654. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  24655. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, {
  24656. key: 0,
  24657. class: normalizeClass([_ctx.ns.is("icon"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  24658. }, {
  24659. default: withCtx(() => [
  24660. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  24661. ]),
  24662. _: 1
  24663. }, 8, ["class"])) : createCommentVNode("v-if", true),
  24664. _ctx.inactiveIcon ? (openBlock(), createBlock(_component_el_icon, {
  24665. key: 1,
  24666. class: normalizeClass([_ctx.ns.is("icon"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")])
  24667. }, {
  24668. default: withCtx(() => [
  24669. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  24670. ]),
  24671. _: 1
  24672. }, 8, ["class"])) : createCommentVNode("v-if", true)
  24673. ], 64)) : _ctx.activeText || _ctx.inactiveIcon ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  24674. _ctx.activeText ? (openBlock(), createElementBlock("span", {
  24675. key: 0,
  24676. class: normalizeClass([_ctx.ns.is("text"), _ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  24677. "aria-hidden": !_ctx.checked
  24678. }, toDisplayString(_ctx.activeText.substring(0, 3)), 11, _hoisted_4$7)) : createCommentVNode("v-if", true),
  24679. _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  24680. key: 1,
  24681. class: normalizeClass([_ctx.ns.is("text"), !_ctx.checked ? _ctx.ns.is("show") : _ctx.ns.is("hide")]),
  24682. "aria-hidden": _ctx.checked
  24683. }, toDisplayString(_ctx.inactiveText.substring(0, 3)), 11, _hoisted_5$7)) : createCommentVNode("v-if", true)
  24684. ], 64)) : createCommentVNode("v-if", true)
  24685. ], 2)) : createCommentVNode("v-if", true),
  24686. createElementVNode("div", {
  24687. class: normalizeClass(_ctx.ns.e("action"))
  24688. }, [
  24689. _ctx.loading ? (openBlock(), createBlock(_component_el_icon, {
  24690. key: 0,
  24691. class: normalizeClass(_ctx.ns.is("loading"))
  24692. }, {
  24693. default: withCtx(() => [
  24694. createVNode(_component_loading)
  24695. ]),
  24696. _: 1
  24697. }, 8, ["class"])) : createCommentVNode("v-if", true)
  24698. ], 2)
  24699. ], 6),
  24700. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  24701. key: 1,
  24702. class: normalizeClass([
  24703. _ctx.ns.e("label"),
  24704. _ctx.ns.em("label", "right"),
  24705. _ctx.ns.is("active", _ctx.checked)
  24706. ])
  24707. }, [
  24708. _ctx.activeIcon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  24709. default: withCtx(() => [
  24710. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  24711. ]),
  24712. _: 1
  24713. })) : createCommentVNode("v-if", true),
  24714. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  24715. key: 1,
  24716. "aria-hidden": !_ctx.checked
  24717. }, toDisplayString(_ctx.activeText), 9, _hoisted_6$6)) : createCommentVNode("v-if", true)
  24718. ], 2)) : createCommentVNode("v-if", true)
  24719. ], 10, _hoisted_1$d);
  24720. }
  24721. var Switch = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["render", _sfc_render$4], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
  24722. const ElSwitch = withInstall(Switch);
  24723. /*!
  24724. * escape-html
  24725. * Copyright(c) 2012-2013 TJ Holowaychuk
  24726. * Copyright(c) 2015 Andreas Lubbe
  24727. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  24728. * MIT Licensed
  24729. */
  24730. var matchHtmlRegExp = /["'&<>]/;
  24731. var escapeHtml_1 = escapeHtml;
  24732. function escapeHtml(string3) {
  24733. var str = "" + string3;
  24734. var match = matchHtmlRegExp.exec(str);
  24735. if (!match) {
  24736. return str;
  24737. }
  24738. var escape;
  24739. var html = "";
  24740. var index = 0;
  24741. var lastIndex = 0;
  24742. for (index = match.index; index < str.length; index++) {
  24743. switch (str.charCodeAt(index)) {
  24744. case 34:
  24745. escape = "&quot;";
  24746. break;
  24747. case 38:
  24748. escape = "&amp;";
  24749. break;
  24750. case 39:
  24751. escape = "&#39;";
  24752. break;
  24753. case 60:
  24754. escape = "&lt;";
  24755. break;
  24756. case 62:
  24757. escape = "&gt;";
  24758. break;
  24759. default:
  24760. continue;
  24761. }
  24762. if (lastIndex !== index) {
  24763. html += str.substring(lastIndex, index);
  24764. }
  24765. lastIndex = index + 1;
  24766. html += escape;
  24767. }
  24768. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  24769. }
  24770. const getCell = function(event) {
  24771. let cell = event.target;
  24772. while (cell && cell.tagName.toUpperCase() !== "HTML") {
  24773. if (cell.tagName.toUpperCase() === "TD") {
  24774. return cell;
  24775. }
  24776. cell = cell.parentNode;
  24777. }
  24778. return null;
  24779. };
  24780. const isObject = function(obj) {
  24781. return obj !== null && typeof obj === "object";
  24782. };
  24783. const orderBy = function(array4, sortKey, reverse, sortMethod, sortBy) {
  24784. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  24785. return array4;
  24786. }
  24787. if (typeof reverse === "string") {
  24788. reverse = reverse === "descending" ? -1 : 1;
  24789. } else {
  24790. reverse = reverse && reverse < 0 ? -1 : 1;
  24791. }
  24792. const getKey = sortMethod ? null : function(value, index) {
  24793. if (sortBy) {
  24794. if (!Array.isArray(sortBy)) {
  24795. sortBy = [sortBy];
  24796. }
  24797. return sortBy.map((by) => {
  24798. if (typeof by === "string") {
  24799. return get(value, by);
  24800. } else {
  24801. return by(value, index, array4);
  24802. }
  24803. });
  24804. }
  24805. if (sortKey !== "$key") {
  24806. if (isObject(value) && "$value" in value)
  24807. value = value.$value;
  24808. }
  24809. return [isObject(value) ? get(value, sortKey) : value];
  24810. };
  24811. const compare = function(a2, b2) {
  24812. if (sortMethod) {
  24813. return sortMethod(a2.value, b2.value);
  24814. }
  24815. for (let i = 0, len = a2.key.length; i < len; i++) {
  24816. if (a2.key[i] < b2.key[i]) {
  24817. return -1;
  24818. }
  24819. if (a2.key[i] > b2.key[i]) {
  24820. return 1;
  24821. }
  24822. }
  24823. return 0;
  24824. };
  24825. return array4.map((value, index) => {
  24826. return {
  24827. value,
  24828. index,
  24829. key: getKey ? getKey(value, index) : null
  24830. };
  24831. }).sort((a2, b2) => {
  24832. let order2 = compare(a2, b2);
  24833. if (!order2) {
  24834. order2 = a2.index - b2.index;
  24835. }
  24836. return order2 * +reverse;
  24837. }).map((item) => item.value);
  24838. };
  24839. const getColumnById = function(table, columnId) {
  24840. let column = null;
  24841. table.columns.forEach((item) => {
  24842. if (item.id === columnId) {
  24843. column = item;
  24844. }
  24845. });
  24846. return column;
  24847. };
  24848. const getColumnByKey = function(table, columnKey) {
  24849. let column = null;
  24850. for (let i = 0; i < table.columns.length; i++) {
  24851. const item = table.columns[i];
  24852. if (item.columnKey === columnKey) {
  24853. column = item;
  24854. break;
  24855. }
  24856. }
  24857. return column;
  24858. };
  24859. const getColumnByCell = function(table, cell, namespace) {
  24860. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  24861. if (matches) {
  24862. return getColumnById(table, matches[0]);
  24863. }
  24864. return null;
  24865. };
  24866. const getRowIdentity = (row, rowKey) => {
  24867. if (!row)
  24868. throw new Error("Row is required when get row identity");
  24869. if (typeof rowKey === "string") {
  24870. if (!rowKey.includes(".")) {
  24871. return `${row[rowKey]}`;
  24872. }
  24873. const key = rowKey.split(".");
  24874. let current = row;
  24875. for (const element of key) {
  24876. current = current[element];
  24877. }
  24878. return `${current}`;
  24879. } else if (typeof rowKey === "function") {
  24880. return rowKey.call(null, row);
  24881. }
  24882. };
  24883. const getKeysMap = function(array4, rowKey) {
  24884. const arrayMap2 = {};
  24885. (array4 || []).forEach((row, index) => {
  24886. arrayMap2[getRowIdentity(row, rowKey)] = { row, index };
  24887. });
  24888. return arrayMap2;
  24889. };
  24890. function mergeOptions(defaults, config) {
  24891. const options = {};
  24892. let key;
  24893. for (key in defaults) {
  24894. options[key] = defaults[key];
  24895. }
  24896. for (key in config) {
  24897. if (hasOwn(config, key)) {
  24898. const value = config[key];
  24899. if (typeof value !== "undefined") {
  24900. options[key] = value;
  24901. }
  24902. }
  24903. }
  24904. return options;
  24905. }
  24906. function parseWidth(width) {
  24907. if (width === "")
  24908. return width;
  24909. if (width !== void 0) {
  24910. width = Number.parseInt(width, 10);
  24911. if (Number.isNaN(width)) {
  24912. width = "";
  24913. }
  24914. }
  24915. return width;
  24916. }
  24917. function parseMinWidth(minWidth) {
  24918. if (minWidth === "")
  24919. return minWidth;
  24920. if (minWidth !== void 0) {
  24921. minWidth = parseWidth(minWidth);
  24922. if (Number.isNaN(minWidth)) {
  24923. minWidth = 80;
  24924. }
  24925. }
  24926. return minWidth;
  24927. }
  24928. function parseHeight(height) {
  24929. if (typeof height === "number") {
  24930. return height;
  24931. }
  24932. if (typeof height === "string") {
  24933. if (/^\d+(?:px)?$/.test(height)) {
  24934. return Number.parseInt(height, 10);
  24935. } else {
  24936. return height;
  24937. }
  24938. }
  24939. return null;
  24940. }
  24941. function compose(...funcs) {
  24942. if (funcs.length === 0) {
  24943. return (arg) => arg;
  24944. }
  24945. if (funcs.length === 1) {
  24946. return funcs[0];
  24947. }
  24948. return funcs.reduce((a2, b2) => (...args) => a2(b2(...args)));
  24949. }
  24950. function toggleRowStatus(statusArr, row, newVal) {
  24951. let changed = false;
  24952. const index = statusArr.indexOf(row);
  24953. const included = index !== -1;
  24954. const addRow = () => {
  24955. statusArr.push(row);
  24956. changed = true;
  24957. };
  24958. const removeRow = () => {
  24959. statusArr.splice(index, 1);
  24960. changed = true;
  24961. };
  24962. if (typeof newVal === "boolean") {
  24963. if (newVal && !included) {
  24964. addRow();
  24965. } else if (!newVal && included) {
  24966. removeRow();
  24967. }
  24968. } else {
  24969. if (included) {
  24970. removeRow();
  24971. } else {
  24972. addRow();
  24973. }
  24974. }
  24975. return changed;
  24976. }
  24977. function walkTreeNode(root2, cb, childrenKey = "children", lazyKey = "hasChildren") {
  24978. const isNil2 = (array4) => !(Array.isArray(array4) && array4.length);
  24979. function _walker(parent, children, level) {
  24980. cb(parent, children, level);
  24981. children.forEach((item) => {
  24982. if (item[lazyKey]) {
  24983. cb(item, null, level + 1);
  24984. return;
  24985. }
  24986. const children2 = item[childrenKey];
  24987. if (!isNil2(children2)) {
  24988. _walker(item, children2, level + 1);
  24989. }
  24990. });
  24991. }
  24992. root2.forEach((item) => {
  24993. if (item[lazyKey]) {
  24994. cb(item, null, 0);
  24995. return;
  24996. }
  24997. const children = item[childrenKey];
  24998. if (!isNil2(children)) {
  24999. _walker(item, children, 0);
  25000. }
  25001. });
  25002. }
  25003. let removePopper;
  25004. function createTablePopper(trigger, popperContent, popperOptions2, tooltipEffect) {
  25005. const { nextZIndex } = useZIndex();
  25006. function renderContent() {
  25007. const isLight = tooltipEffect === "light";
  25008. const content22 = document.createElement("div");
  25009. content22.className = `el-popper ${isLight ? "is-light" : "is-dark"}`;
  25010. popperContent = escapeHtml_1(popperContent);
  25011. content22.innerHTML = popperContent;
  25012. content22.style.zIndex = String(nextZIndex());
  25013. document.body.appendChild(content22);
  25014. return content22;
  25015. }
  25016. function renderArrow() {
  25017. const arrow22 = document.createElement("div");
  25018. arrow22.className = "el-popper__arrow";
  25019. return arrow22;
  25020. }
  25021. function showPopper() {
  25022. popperInstance && popperInstance.update();
  25023. }
  25024. removePopper = function removePopper2() {
  25025. try {
  25026. popperInstance && popperInstance.destroy();
  25027. content2 && document.body.removeChild(content2);
  25028. off(trigger, "mouseenter", showPopper);
  25029. off(trigger, "mouseleave", removePopper2);
  25030. } catch (e) {
  25031. }
  25032. };
  25033. let popperInstance = null;
  25034. const content2 = renderContent();
  25035. const arrow2 = renderArrow();
  25036. content2.appendChild(arrow2);
  25037. popperInstance = createPopper(trigger, content2, __spreadValues({
  25038. modifiers: [
  25039. {
  25040. name: "offset",
  25041. options: {
  25042. offset: [0, 8]
  25043. }
  25044. },
  25045. {
  25046. name: "arrow",
  25047. options: {
  25048. element: arrow2,
  25049. padding: 10
  25050. }
  25051. }
  25052. ]
  25053. }, popperOptions2));
  25054. on(trigger, "mouseenter", showPopper);
  25055. on(trigger, "mouseleave", removePopper);
  25056. return popperInstance;
  25057. }
  25058. const isFixedColumn = (index, fixed, store, realColumns) => {
  25059. let start2 = 0;
  25060. let after = index;
  25061. if (realColumns) {
  25062. if (realColumns[index].colSpan > 1) {
  25063. return {};
  25064. }
  25065. for (let i = 0; i < index; i++) {
  25066. start2 += realColumns[i].colSpan;
  25067. }
  25068. after = start2 + realColumns[index].colSpan - 1;
  25069. } else {
  25070. start2 = index;
  25071. }
  25072. let fixedLayout;
  25073. const columns = store.states.columns;
  25074. switch (fixed) {
  25075. case "left":
  25076. if (after < store.states.fixedLeafColumnsLength.value) {
  25077. fixedLayout = "left";
  25078. }
  25079. break;
  25080. case "right":
  25081. if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  25082. fixedLayout = "right";
  25083. }
  25084. break;
  25085. default:
  25086. if (after < store.states.fixedLeafColumnsLength.value) {
  25087. fixedLayout = "left";
  25088. } else if (start2 >= columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  25089. fixedLayout = "right";
  25090. }
  25091. }
  25092. return fixedLayout ? {
  25093. direction: fixedLayout,
  25094. start: start2,
  25095. after
  25096. } : {};
  25097. };
  25098. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns) => {
  25099. const classes = [];
  25100. const { direction: direction2, start: start2 } = isFixedColumn(index, fixed, store, realColumns);
  25101. if (direction2) {
  25102. const isLeft = direction2 === "left";
  25103. classes.push(`${namespace}-fixed-column--${direction2}`);
  25104. if (isLeft && start2 === store.states.fixedLeafColumnsLength.value - 1) {
  25105. classes.push("is-last-column");
  25106. } else if (!isLeft && start2 === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  25107. classes.push("is-first-column");
  25108. }
  25109. }
  25110. return classes;
  25111. };
  25112. function getOffset(offset2, column) {
  25113. return offset2 + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  25114. }
  25115. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  25116. const { direction: direction2, start: start2 = 0 } = isFixedColumn(index, fixed, store, realColumns);
  25117. if (!direction2) {
  25118. return;
  25119. }
  25120. const styles = {};
  25121. const isLeft = direction2 === "left";
  25122. const columns = store.states.columns.value;
  25123. if (isLeft) {
  25124. styles.left = columns.slice(0, index).reduce(getOffset, 0);
  25125. } else {
  25126. styles.right = columns.slice(start2 + 1).reverse().reduce(getOffset, 0);
  25127. }
  25128. return styles;
  25129. };
  25130. const ensurePosition = (style, key) => {
  25131. if (!style)
  25132. return;
  25133. if (!Number.isNaN(style[key])) {
  25134. style[key] = `${style[key]}px`;
  25135. }
  25136. };
  25137. function useExpand(watcherData) {
  25138. const instance = getCurrentInstance();
  25139. const defaultExpandAll = ref(false);
  25140. const expandRows = ref([]);
  25141. const updateExpandRows = () => {
  25142. const data2 = watcherData.data.value || [];
  25143. const rowKey = watcherData.rowKey.value;
  25144. if (defaultExpandAll.value) {
  25145. expandRows.value = data2.slice();
  25146. } else if (rowKey) {
  25147. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  25148. expandRows.value = data2.reduce((prev, row) => {
  25149. const rowId = getRowIdentity(row, rowKey);
  25150. const rowInfo = expandRowsMap[rowId];
  25151. if (rowInfo) {
  25152. prev.push(row);
  25153. }
  25154. return prev;
  25155. }, []);
  25156. } else {
  25157. expandRows.value = [];
  25158. }
  25159. };
  25160. const toggleRowExpansion = (row, expanded) => {
  25161. const changed = toggleRowStatus(expandRows.value, row, expanded);
  25162. if (changed) {
  25163. instance.emit("expand-change", row, expandRows.value.slice());
  25164. }
  25165. };
  25166. const setExpandRowKeys = (rowKeys) => {
  25167. instance.store.assertRowKey();
  25168. const data2 = watcherData.data.value || [];
  25169. const rowKey = watcherData.rowKey.value;
  25170. const keysMap = getKeysMap(data2, rowKey);
  25171. expandRows.value = rowKeys.reduce((prev, cur) => {
  25172. const info = keysMap[cur];
  25173. if (info) {
  25174. prev.push(info.row);
  25175. }
  25176. return prev;
  25177. }, []);
  25178. };
  25179. const isRowExpanded = (row) => {
  25180. const rowKey = watcherData.rowKey.value;
  25181. if (rowKey) {
  25182. const expandMap = getKeysMap(expandRows.value, rowKey);
  25183. return !!expandMap[getRowIdentity(row, rowKey)];
  25184. }
  25185. return expandRows.value.includes(row);
  25186. };
  25187. return {
  25188. updateExpandRows,
  25189. toggleRowExpansion,
  25190. setExpandRowKeys,
  25191. isRowExpanded,
  25192. states: {
  25193. expandRows,
  25194. defaultExpandAll
  25195. }
  25196. };
  25197. }
  25198. function useCurrent(watcherData) {
  25199. const instance = getCurrentInstance();
  25200. const _currentRowKey = ref(null);
  25201. const currentRow = ref(null);
  25202. const setCurrentRowKey = (key) => {
  25203. instance.store.assertRowKey();
  25204. _currentRowKey.value = key;
  25205. setCurrentRowByKey(key);
  25206. };
  25207. const restoreCurrentRowKey = () => {
  25208. _currentRowKey.value = null;
  25209. };
  25210. const setCurrentRowByKey = (key) => {
  25211. const { data: data2, rowKey } = watcherData;
  25212. let _currentRow = null;
  25213. if (rowKey.value) {
  25214. _currentRow = (unref(data2) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  25215. }
  25216. currentRow.value = _currentRow;
  25217. instance.emit("current-change", currentRow.value, null);
  25218. };
  25219. const updateCurrentRow = (_currentRow) => {
  25220. const oldCurrentRow = currentRow.value;
  25221. if (_currentRow && _currentRow !== oldCurrentRow) {
  25222. currentRow.value = _currentRow;
  25223. instance.emit("current-change", currentRow.value, oldCurrentRow);
  25224. return;
  25225. }
  25226. if (!_currentRow && oldCurrentRow) {
  25227. currentRow.value = null;
  25228. instance.emit("current-change", null, oldCurrentRow);
  25229. }
  25230. };
  25231. const updateCurrentRowData = () => {
  25232. const rowKey = watcherData.rowKey.value;
  25233. const data2 = watcherData.data.value || [];
  25234. const oldCurrentRow = currentRow.value;
  25235. if (!data2.includes(oldCurrentRow) && oldCurrentRow) {
  25236. if (rowKey) {
  25237. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  25238. setCurrentRowByKey(currentRowKey);
  25239. } else {
  25240. currentRow.value = null;
  25241. }
  25242. if (currentRow.value === null) {
  25243. instance.emit("current-change", null, oldCurrentRow);
  25244. }
  25245. } else if (_currentRowKey.value) {
  25246. setCurrentRowByKey(_currentRowKey.value);
  25247. restoreCurrentRowKey();
  25248. }
  25249. };
  25250. return {
  25251. setCurrentRowKey,
  25252. restoreCurrentRowKey,
  25253. setCurrentRowByKey,
  25254. updateCurrentRow,
  25255. updateCurrentRowData,
  25256. states: {
  25257. _currentRowKey,
  25258. currentRow
  25259. }
  25260. };
  25261. }
  25262. function useTree(watcherData) {
  25263. const expandRowKeys = ref([]);
  25264. const treeData = ref({});
  25265. const indent = ref(16);
  25266. const lazy = ref(false);
  25267. const lazyTreeNodeMap = ref({});
  25268. const lazyColumnIdentifier = ref("hasChildren");
  25269. const childrenColumnName = ref("children");
  25270. const instance = getCurrentInstance();
  25271. const normalizedData = computed(() => {
  25272. if (!watcherData.rowKey.value)
  25273. return {};
  25274. const data2 = watcherData.data.value || [];
  25275. return normalize(data2);
  25276. });
  25277. const normalizedLazyNode = computed(() => {
  25278. const rowKey = watcherData.rowKey.value;
  25279. const keys2 = Object.keys(lazyTreeNodeMap.value);
  25280. const res = {};
  25281. if (!keys2.length)
  25282. return res;
  25283. keys2.forEach((key) => {
  25284. if (lazyTreeNodeMap.value[key].length) {
  25285. const item = { children: [] };
  25286. lazyTreeNodeMap.value[key].forEach((row) => {
  25287. const currentRowKey = getRowIdentity(row, rowKey);
  25288. item.children.push(currentRowKey);
  25289. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  25290. res[currentRowKey] = { children: [] };
  25291. }
  25292. });
  25293. res[key] = item;
  25294. }
  25295. });
  25296. return res;
  25297. });
  25298. const normalize = (data2) => {
  25299. const rowKey = watcherData.rowKey.value;
  25300. const res = {};
  25301. walkTreeNode(data2, (parent, children, level) => {
  25302. const parentId = getRowIdentity(parent, rowKey);
  25303. if (Array.isArray(children)) {
  25304. res[parentId] = {
  25305. children: children.map((row) => getRowIdentity(row, rowKey)),
  25306. level
  25307. };
  25308. } else if (lazy.value) {
  25309. res[parentId] = {
  25310. children: [],
  25311. lazy: true,
  25312. level
  25313. };
  25314. }
  25315. }, childrenColumnName.value, lazyColumnIdentifier.value);
  25316. return res;
  25317. };
  25318. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a2) => (_a2 = instance.store) == null ? void 0 : _a2.states.defaultExpandAll.value)()) => {
  25319. var _a2;
  25320. const nested = normalizedData.value;
  25321. const normalizedLazyNode_ = normalizedLazyNode.value;
  25322. const keys2 = Object.keys(nested);
  25323. const newTreeData = {};
  25324. if (keys2.length) {
  25325. const oldTreeData = unref(treeData);
  25326. const rootLazyRowKeys = [];
  25327. const getExpanded = (oldValue, key) => {
  25328. if (ifChangeExpandRowKeys) {
  25329. if (expandRowKeys.value) {
  25330. return ifExpandAll || expandRowKeys.value.includes(key);
  25331. } else {
  25332. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  25333. }
  25334. } else {
  25335. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  25336. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  25337. }
  25338. };
  25339. keys2.forEach((key) => {
  25340. const oldValue = oldTreeData[key];
  25341. const newValue = __spreadValues({}, nested[key]);
  25342. newValue.expanded = getExpanded(oldValue, key);
  25343. if (newValue.lazy) {
  25344. const { loaded = false, loading: loading2 = false } = oldValue || {};
  25345. newValue.loaded = !!loaded;
  25346. newValue.loading = !!loading2;
  25347. rootLazyRowKeys.push(key);
  25348. }
  25349. newTreeData[key] = newValue;
  25350. });
  25351. const lazyKeys = Object.keys(normalizedLazyNode_);
  25352. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  25353. lazyKeys.forEach((key) => {
  25354. const oldValue = oldTreeData[key];
  25355. const lazyNodeChildren = normalizedLazyNode_[key].children;
  25356. if (rootLazyRowKeys.includes(key)) {
  25357. if (newTreeData[key].children.length !== 0) {
  25358. throw new Error("[ElTable]children must be an empty array.");
  25359. }
  25360. newTreeData[key].children = lazyNodeChildren;
  25361. } else {
  25362. const { loaded = false, loading: loading2 = false } = oldValue || {};
  25363. newTreeData[key] = {
  25364. lazy: true,
  25365. loaded: !!loaded,
  25366. loading: !!loading2,
  25367. expanded: getExpanded(oldValue, key),
  25368. children: lazyNodeChildren,
  25369. level: ""
  25370. };
  25371. }
  25372. });
  25373. }
  25374. }
  25375. treeData.value = newTreeData;
  25376. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  25377. };
  25378. watch(() => expandRowKeys.value, () => {
  25379. updateTreeData(true);
  25380. });
  25381. watch(() => normalizedData.value, () => {
  25382. updateTreeData();
  25383. });
  25384. watch(() => normalizedLazyNode.value, () => {
  25385. updateTreeData();
  25386. });
  25387. const updateTreeExpandKeys = (value) => {
  25388. expandRowKeys.value = value;
  25389. updateTreeData();
  25390. };
  25391. const toggleTreeExpansion = (row, expanded) => {
  25392. instance.store.assertRowKey();
  25393. const rowKey = watcherData.rowKey.value;
  25394. const id = getRowIdentity(row, rowKey);
  25395. const data2 = id && treeData.value[id];
  25396. if (id && data2 && "expanded" in data2) {
  25397. const oldExpanded = data2.expanded;
  25398. expanded = typeof expanded === "undefined" ? !data2.expanded : expanded;
  25399. treeData.value[id].expanded = expanded;
  25400. if (oldExpanded !== expanded) {
  25401. instance.emit("expand-change", row, expanded);
  25402. }
  25403. instance.store.updateTableScrollY();
  25404. }
  25405. };
  25406. const loadOrToggle = (row) => {
  25407. instance.store.assertRowKey();
  25408. const rowKey = watcherData.rowKey.value;
  25409. const id = getRowIdentity(row, rowKey);
  25410. const data2 = treeData.value[id];
  25411. if (lazy.value && data2 && "loaded" in data2 && !data2.loaded) {
  25412. loadData(row, id, data2);
  25413. } else {
  25414. toggleTreeExpansion(row, void 0);
  25415. }
  25416. };
  25417. const loadData = (row, key, treeNode) => {
  25418. const { load } = instance.props;
  25419. if (load && !treeData.value[key].loaded) {
  25420. treeData.value[key].loading = true;
  25421. load(row, treeNode, (data2) => {
  25422. if (!Array.isArray(data2)) {
  25423. throw new TypeError("[ElTable] data must be an array");
  25424. }
  25425. treeData.value[key].loading = false;
  25426. treeData.value[key].loaded = true;
  25427. treeData.value[key].expanded = true;
  25428. if (data2.length) {
  25429. lazyTreeNodeMap.value[key] = data2;
  25430. }
  25431. instance.emit("expand-change", row, true);
  25432. });
  25433. }
  25434. };
  25435. return {
  25436. loadData,
  25437. loadOrToggle,
  25438. toggleTreeExpansion,
  25439. updateTreeExpandKeys,
  25440. updateTreeData,
  25441. normalize,
  25442. states: {
  25443. expandRowKeys,
  25444. treeData,
  25445. indent,
  25446. lazy,
  25447. lazyTreeNodeMap,
  25448. lazyColumnIdentifier,
  25449. childrenColumnName
  25450. }
  25451. };
  25452. }
  25453. const sortData = (data2, states) => {
  25454. const sortingColumn = states.sortingColumn;
  25455. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  25456. return data2;
  25457. }
  25458. return orderBy(data2, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  25459. };
  25460. const doFlattenColumns = (columns) => {
  25461. const result = [];
  25462. columns.forEach((column) => {
  25463. if (column.children) {
  25464. result.push.apply(result, doFlattenColumns(column.children));
  25465. } else {
  25466. result.push(column);
  25467. }
  25468. });
  25469. return result;
  25470. };
  25471. function useWatcher$1() {
  25472. var _a2;
  25473. const instance = getCurrentInstance();
  25474. const { size: tableSize } = toRefs((_a2 = instance.proxy) == null ? void 0 : _a2.$props);
  25475. const rowKey = ref(null);
  25476. const data2 = ref([]);
  25477. const _data = ref([]);
  25478. const isComplex = ref(false);
  25479. const _columns = ref([]);
  25480. const originColumns = ref([]);
  25481. const columns = ref([]);
  25482. const fixedColumns = ref([]);
  25483. const rightFixedColumns = ref([]);
  25484. const leafColumns = ref([]);
  25485. const fixedLeafColumns = ref([]);
  25486. const rightFixedLeafColumns = ref([]);
  25487. const leafColumnsLength = ref(0);
  25488. const fixedLeafColumnsLength = ref(0);
  25489. const rightFixedLeafColumnsLength = ref(0);
  25490. const isAllSelected = ref(false);
  25491. const selection = ref([]);
  25492. const reserveSelection = ref(false);
  25493. const selectOnIndeterminate = ref(false);
  25494. const selectable = ref(null);
  25495. const filters = ref({});
  25496. const filteredData = ref(null);
  25497. const sortingColumn = ref(null);
  25498. const sortProp = ref(null);
  25499. const sortOrder = ref(null);
  25500. const hoverRow = ref(null);
  25501. watch(data2, () => instance.state && scheduleLayout(false), {
  25502. deep: true
  25503. });
  25504. const assertRowKey = () => {
  25505. if (!rowKey.value)
  25506. throw new Error("[ElTable] prop row-key is required");
  25507. };
  25508. const updateColumns = () => {
  25509. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  25510. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  25511. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  25512. _columns.value[0].fixed = true;
  25513. fixedColumns.value.unshift(_columns.value[0]);
  25514. }
  25515. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  25516. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  25517. const leafColumns2 = doFlattenColumns(notFixedColumns);
  25518. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  25519. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  25520. leafColumnsLength.value = leafColumns2.length;
  25521. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  25522. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  25523. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  25524. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  25525. };
  25526. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  25527. if (needUpdateColumns) {
  25528. updateColumns();
  25529. }
  25530. if (immediate) {
  25531. instance.state.doLayout();
  25532. } else {
  25533. instance.state.debouncedUpdateLayout();
  25534. }
  25535. };
  25536. const isSelected = (row) => {
  25537. return selection.value.includes(row);
  25538. };
  25539. const clearSelection = () => {
  25540. isAllSelected.value = false;
  25541. const oldSelection = selection.value;
  25542. if (oldSelection.length) {
  25543. selection.value = [];
  25544. instance.emit("selection-change", []);
  25545. }
  25546. };
  25547. const cleanSelection = () => {
  25548. let deleted;
  25549. if (rowKey.value) {
  25550. deleted = [];
  25551. const selectedMap = getKeysMap(selection.value, rowKey.value);
  25552. const dataMap = getKeysMap(data2.value, rowKey.value);
  25553. for (const key in selectedMap) {
  25554. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  25555. deleted.push(selectedMap[key].row);
  25556. }
  25557. }
  25558. } else {
  25559. deleted = selection.value.filter((item) => !data2.value.includes(item));
  25560. }
  25561. if (deleted.length) {
  25562. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  25563. selection.value = newSelection;
  25564. instance.emit("selection-change", newSelection.slice());
  25565. }
  25566. };
  25567. const getSelectionRows = () => {
  25568. return (selection.value || []).slice();
  25569. };
  25570. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  25571. const changed = toggleRowStatus(selection.value, row, selected);
  25572. if (changed) {
  25573. const newSelection = (selection.value || []).slice();
  25574. if (emitChange) {
  25575. instance.emit("select", newSelection, row);
  25576. }
  25577. instance.emit("selection-change", newSelection);
  25578. }
  25579. };
  25580. const _toggleAllSelection = () => {
  25581. var _a22, _b2;
  25582. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  25583. isAllSelected.value = value;
  25584. let selectionChanged = false;
  25585. let childrenCount = 0;
  25586. const rowKey2 = (_b2 = (_a22 = instance == null ? void 0 : instance.store) == null ? void 0 : _a22.states) == null ? void 0 : _b2.rowKey.value;
  25587. data2.value.forEach((row, index) => {
  25588. const rowIndex = index + childrenCount;
  25589. if (selectable.value) {
  25590. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  25591. selectionChanged = true;
  25592. }
  25593. } else {
  25594. if (toggleRowStatus(selection.value, row, value)) {
  25595. selectionChanged = true;
  25596. }
  25597. }
  25598. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  25599. });
  25600. if (selectionChanged) {
  25601. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  25602. }
  25603. instance.emit("select-all", selection.value);
  25604. };
  25605. const updateSelectionByRowKey = () => {
  25606. const selectedMap = getKeysMap(selection.value, rowKey.value);
  25607. data2.value.forEach((row) => {
  25608. const rowId = getRowIdentity(row, rowKey.value);
  25609. const rowInfo = selectedMap[rowId];
  25610. if (rowInfo) {
  25611. selection.value[rowInfo.index] = row;
  25612. }
  25613. });
  25614. };
  25615. const updateAllSelected = () => {
  25616. var _a22, _b2, _c;
  25617. if (((_a22 = data2.value) == null ? void 0 : _a22.length) === 0) {
  25618. isAllSelected.value = false;
  25619. return;
  25620. }
  25621. let selectedMap;
  25622. if (rowKey.value) {
  25623. selectedMap = getKeysMap(selection.value, rowKey.value);
  25624. }
  25625. const isSelected2 = function(row) {
  25626. if (selectedMap) {
  25627. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  25628. } else {
  25629. return selection.value.includes(row);
  25630. }
  25631. };
  25632. let isAllSelected_ = true;
  25633. let selectedCount = 0;
  25634. let childrenCount = 0;
  25635. for (let i = 0, j = (data2.value || []).length; i < j; i++) {
  25636. const keyProp = (_c = (_b2 = instance == null ? void 0 : instance.store) == null ? void 0 : _b2.states) == null ? void 0 : _c.rowKey.value;
  25637. const rowIndex = i + childrenCount;
  25638. const item = data2.value[i];
  25639. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  25640. if (!isSelected2(item)) {
  25641. if (!selectable.value || isRowSelectable) {
  25642. isAllSelected_ = false;
  25643. break;
  25644. }
  25645. } else {
  25646. selectedCount++;
  25647. }
  25648. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  25649. }
  25650. if (selectedCount === 0)
  25651. isAllSelected_ = false;
  25652. isAllSelected.value = isAllSelected_;
  25653. };
  25654. const getChildrenCount = (rowKey2) => {
  25655. var _a22;
  25656. if (!instance || !instance.store)
  25657. return 0;
  25658. const { treeData } = instance.store.states;
  25659. let count = 0;
  25660. const children = (_a22 = treeData.value[rowKey2]) == null ? void 0 : _a22.children;
  25661. if (children) {
  25662. count += children.length;
  25663. children.forEach((childKey) => {
  25664. count += getChildrenCount(childKey);
  25665. });
  25666. }
  25667. return count;
  25668. };
  25669. const updateFilters = (columns2, values) => {
  25670. if (!Array.isArray(columns2)) {
  25671. columns2 = [columns2];
  25672. }
  25673. const filters_ = {};
  25674. columns2.forEach((col) => {
  25675. filters.value[col.id] = values;
  25676. filters_[col.columnKey || col.id] = values;
  25677. });
  25678. return filters_;
  25679. };
  25680. const updateSort = (column, prop, order2) => {
  25681. if (sortingColumn.value && sortingColumn.value !== column) {
  25682. sortingColumn.value.order = null;
  25683. }
  25684. sortingColumn.value = column;
  25685. sortProp.value = prop;
  25686. sortOrder.value = order2;
  25687. };
  25688. const execFilter = () => {
  25689. let sourceData = unref(_data);
  25690. Object.keys(filters.value).forEach((columnId) => {
  25691. const values = filters.value[columnId];
  25692. if (!values || values.length === 0)
  25693. return;
  25694. const column = getColumnById({
  25695. columns: columns.value
  25696. }, columnId);
  25697. if (column && column.filterMethod) {
  25698. sourceData = sourceData.filter((row) => {
  25699. return values.some((value) => column.filterMethod.call(null, value, row, column));
  25700. });
  25701. }
  25702. });
  25703. filteredData.value = sourceData;
  25704. };
  25705. const execSort = () => {
  25706. data2.value = sortData(filteredData.value, {
  25707. sortingColumn: sortingColumn.value,
  25708. sortProp: sortProp.value,
  25709. sortOrder: sortOrder.value
  25710. });
  25711. };
  25712. const execQuery = (ignore = void 0) => {
  25713. if (!(ignore && ignore.filter)) {
  25714. execFilter();
  25715. }
  25716. execSort();
  25717. };
  25718. const clearFilter = (columnKeys) => {
  25719. const { tableHeaderRef } = instance.refs;
  25720. if (!tableHeaderRef)
  25721. return;
  25722. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  25723. const keys2 = Object.keys(panels);
  25724. if (!keys2.length)
  25725. return;
  25726. if (typeof columnKeys === "string") {
  25727. columnKeys = [columnKeys];
  25728. }
  25729. if (Array.isArray(columnKeys)) {
  25730. const columns_ = columnKeys.map((key) => getColumnByKey({
  25731. columns: columns.value
  25732. }, key));
  25733. keys2.forEach((key) => {
  25734. const column = columns_.find((col) => col.id === key);
  25735. if (column) {
  25736. column.filteredValue = [];
  25737. }
  25738. });
  25739. instance.store.commit("filterChange", {
  25740. column: columns_,
  25741. values: [],
  25742. silent: true,
  25743. multi: true
  25744. });
  25745. } else {
  25746. keys2.forEach((key) => {
  25747. const column = columns.value.find((col) => col.id === key);
  25748. if (column) {
  25749. column.filteredValue = [];
  25750. }
  25751. });
  25752. filters.value = {};
  25753. instance.store.commit("filterChange", {
  25754. column: {},
  25755. values: [],
  25756. silent: true
  25757. });
  25758. }
  25759. };
  25760. const clearSort = () => {
  25761. if (!sortingColumn.value)
  25762. return;
  25763. updateSort(null, null, null);
  25764. instance.store.commit("changeSortCondition", {
  25765. silent: true
  25766. });
  25767. };
  25768. const {
  25769. setExpandRowKeys,
  25770. toggleRowExpansion,
  25771. updateExpandRows,
  25772. states: expandStates,
  25773. isRowExpanded
  25774. } = useExpand({
  25775. data: data2,
  25776. rowKey
  25777. });
  25778. const {
  25779. updateTreeExpandKeys,
  25780. toggleTreeExpansion,
  25781. updateTreeData,
  25782. loadOrToggle,
  25783. states: treeStates
  25784. } = useTree({
  25785. data: data2,
  25786. rowKey
  25787. });
  25788. const {
  25789. updateCurrentRowData,
  25790. updateCurrentRow,
  25791. setCurrentRowKey,
  25792. states: currentData
  25793. } = useCurrent({
  25794. data: data2,
  25795. rowKey
  25796. });
  25797. const setExpandRowKeysAdapter = (val) => {
  25798. setExpandRowKeys(val);
  25799. updateTreeExpandKeys(val);
  25800. };
  25801. const toggleRowExpansionAdapter = (row, expanded) => {
  25802. const hasExpandColumn = columns.value.some(({ type: type4 }) => type4 === "expand");
  25803. if (hasExpandColumn) {
  25804. toggleRowExpansion(row, expanded);
  25805. } else {
  25806. toggleTreeExpansion(row, expanded);
  25807. }
  25808. };
  25809. return {
  25810. assertRowKey,
  25811. updateColumns,
  25812. scheduleLayout,
  25813. isSelected,
  25814. clearSelection,
  25815. cleanSelection,
  25816. getSelectionRows,
  25817. toggleRowSelection,
  25818. _toggleAllSelection,
  25819. toggleAllSelection: null,
  25820. updateSelectionByRowKey,
  25821. updateAllSelected,
  25822. updateFilters,
  25823. updateCurrentRow,
  25824. updateSort,
  25825. execFilter,
  25826. execSort,
  25827. execQuery,
  25828. clearFilter,
  25829. clearSort,
  25830. toggleRowExpansion,
  25831. setExpandRowKeysAdapter,
  25832. setCurrentRowKey,
  25833. toggleRowExpansionAdapter,
  25834. isRowExpanded,
  25835. updateExpandRows,
  25836. updateCurrentRowData,
  25837. loadOrToggle,
  25838. updateTreeData,
  25839. states: __spreadValues(__spreadValues(__spreadValues({
  25840. tableSize,
  25841. rowKey,
  25842. data: data2,
  25843. _data,
  25844. isComplex,
  25845. _columns,
  25846. originColumns,
  25847. columns,
  25848. fixedColumns,
  25849. rightFixedColumns,
  25850. leafColumns,
  25851. fixedLeafColumns,
  25852. rightFixedLeafColumns,
  25853. leafColumnsLength,
  25854. fixedLeafColumnsLength,
  25855. rightFixedLeafColumnsLength,
  25856. isAllSelected,
  25857. selection,
  25858. reserveSelection,
  25859. selectOnIndeterminate,
  25860. selectable,
  25861. filters,
  25862. filteredData,
  25863. sortingColumn,
  25864. sortProp,
  25865. sortOrder,
  25866. hoverRow
  25867. }, expandStates), treeStates), currentData)
  25868. };
  25869. }
  25870. function replaceColumn(array4, column) {
  25871. return array4.map((item) => {
  25872. var _a2;
  25873. if (item.id === column.id) {
  25874. return column;
  25875. } else if ((_a2 = item.children) == null ? void 0 : _a2.length) {
  25876. item.children = replaceColumn(item.children, column);
  25877. }
  25878. return item;
  25879. });
  25880. }
  25881. function sortColumn(array4) {
  25882. array4.forEach((item) => {
  25883. var _a2, _b2;
  25884. item.no = (_a2 = item.getColumnIndex) == null ? void 0 : _a2.call(item);
  25885. if ((_b2 = item.children) == null ? void 0 : _b2.length) {
  25886. sortColumn(item.children);
  25887. }
  25888. });
  25889. array4.sort((cur, pre) => cur.no - pre.no);
  25890. }
  25891. function useStore() {
  25892. const instance = getCurrentInstance();
  25893. const watcher = useWatcher$1();
  25894. const ns = useNamespace("table");
  25895. const mutations = {
  25896. setData(states, data2) {
  25897. const dataInstanceChanged = unref(states._data) !== data2;
  25898. states.data.value = data2;
  25899. states._data.value = data2;
  25900. instance.store.execQuery();
  25901. instance.store.updateCurrentRowData();
  25902. instance.store.updateExpandRows();
  25903. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  25904. if (unref(states.reserveSelection)) {
  25905. instance.store.assertRowKey();
  25906. instance.store.updateSelectionByRowKey();
  25907. } else {
  25908. if (dataInstanceChanged) {
  25909. instance.store.clearSelection();
  25910. } else {
  25911. instance.store.cleanSelection();
  25912. }
  25913. }
  25914. instance.store.updateAllSelected();
  25915. if (instance.$ready) {
  25916. instance.store.scheduleLayout();
  25917. }
  25918. },
  25919. insertColumn(states, column, parent) {
  25920. const array4 = unref(states._columns);
  25921. let newColumns = [];
  25922. if (!parent) {
  25923. array4.push(column);
  25924. newColumns = array4;
  25925. } else {
  25926. if (parent && !parent.children) {
  25927. parent.children = [];
  25928. }
  25929. parent.children.push(column);
  25930. newColumns = replaceColumn(array4, parent);
  25931. }
  25932. sortColumn(newColumns);
  25933. states._columns.value = newColumns;
  25934. if (column.type === "selection") {
  25935. states.selectable.value = column.selectable;
  25936. states.reserveSelection.value = column.reserveSelection;
  25937. }
  25938. if (instance.$ready) {
  25939. instance.store.updateColumns();
  25940. instance.store.scheduleLayout();
  25941. }
  25942. },
  25943. removeColumn(states, column, parent) {
  25944. const array4 = unref(states._columns) || [];
  25945. if (parent) {
  25946. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  25947. if (parent.children.length === 0) {
  25948. delete parent.children;
  25949. }
  25950. states._columns.value = replaceColumn(array4, parent);
  25951. } else {
  25952. const index = array4.indexOf(column);
  25953. if (index > -1) {
  25954. array4.splice(index, 1);
  25955. states._columns.value = array4;
  25956. }
  25957. }
  25958. if (instance.$ready) {
  25959. instance.store.updateColumns();
  25960. instance.store.scheduleLayout();
  25961. }
  25962. },
  25963. sort(states, options) {
  25964. const { prop, order: order2, init } = options;
  25965. if (prop) {
  25966. const column = unref(states.columns).find((column2) => column2.property === prop);
  25967. if (column) {
  25968. column.order = order2;
  25969. instance.store.updateSort(column, prop, order2);
  25970. instance.store.commit("changeSortCondition", { init });
  25971. }
  25972. }
  25973. },
  25974. changeSortCondition(states, options) {
  25975. const { sortingColumn: column, sortProp: prop, sortOrder: order2 } = states;
  25976. if (unref(order2) === null) {
  25977. states.sortingColumn.value = null;
  25978. states.sortProp.value = null;
  25979. }
  25980. const ingore = { filter: true };
  25981. instance.store.execQuery(ingore);
  25982. if (!options || !(options.silent || options.init)) {
  25983. instance.emit("sort-change", {
  25984. column: unref(column),
  25985. prop: unref(prop),
  25986. order: unref(order2)
  25987. });
  25988. }
  25989. instance.store.updateTableScrollY();
  25990. },
  25991. filterChange(_states, options) {
  25992. const { column, values, silent } = options;
  25993. const newFilters = instance.store.updateFilters(column, values);
  25994. instance.store.execQuery();
  25995. if (!silent) {
  25996. instance.emit("filter-change", newFilters);
  25997. }
  25998. instance.store.updateTableScrollY();
  25999. },
  26000. toggleAllSelection() {
  26001. instance.store.toggleAllSelection();
  26002. },
  26003. rowSelectedChanged(_states, row) {
  26004. instance.store.toggleRowSelection(row);
  26005. instance.store.updateAllSelected();
  26006. },
  26007. setHoverRow(states, row) {
  26008. states.hoverRow.value = row;
  26009. },
  26010. setCurrentRow(_states, row) {
  26011. instance.store.updateCurrentRow(row);
  26012. }
  26013. };
  26014. const commit = function(name, ...args) {
  26015. const mutations2 = instance.store.mutations;
  26016. if (mutations2[name]) {
  26017. mutations2[name].apply(instance, [instance.store.states].concat(args));
  26018. } else {
  26019. throw new Error(`Action not found: ${name}`);
  26020. }
  26021. };
  26022. const updateTableScrollY = function() {
  26023. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  26024. };
  26025. return __spreadProps(__spreadValues({
  26026. ns
  26027. }, watcher), {
  26028. mutations,
  26029. commit,
  26030. updateTableScrollY
  26031. });
  26032. }
  26033. const InitialStateMap = {
  26034. rowKey: "rowKey",
  26035. defaultExpandAll: "defaultExpandAll",
  26036. selectOnIndeterminate: "selectOnIndeterminate",
  26037. indent: "indent",
  26038. lazy: "lazy",
  26039. data: "data",
  26040. ["treeProps.hasChildren"]: {
  26041. key: "lazyColumnIdentifier",
  26042. default: "hasChildren"
  26043. },
  26044. ["treeProps.children"]: {
  26045. key: "childrenColumnName",
  26046. default: "children"
  26047. }
  26048. };
  26049. function createStore(table, props) {
  26050. if (!table) {
  26051. throw new Error("Table is required.");
  26052. }
  26053. const store = useStore();
  26054. store.toggleAllSelection = debounce$1(store._toggleAllSelection, 10);
  26055. Object.keys(InitialStateMap).forEach((key) => {
  26056. handleValue(getArrKeysValue(props, key), key, store);
  26057. });
  26058. proxyTableProps(store, props);
  26059. return store;
  26060. }
  26061. function proxyTableProps(store, props) {
  26062. Object.keys(InitialStateMap).forEach((key) => {
  26063. watch(() => getArrKeysValue(props, key), (value) => {
  26064. handleValue(value, key, store);
  26065. });
  26066. });
  26067. }
  26068. function handleValue(value, propsKey, store) {
  26069. let newVal = value;
  26070. let storeKey = InitialStateMap[propsKey];
  26071. if (typeof InitialStateMap[propsKey] === "object") {
  26072. storeKey = storeKey.key;
  26073. newVal = newVal || InitialStateMap[propsKey].default;
  26074. }
  26075. store.states[storeKey].value = newVal;
  26076. }
  26077. function getArrKeysValue(props, keys2) {
  26078. if (keys2.includes(".")) {
  26079. const keyList = keys2.split(".");
  26080. let value = props;
  26081. keyList.forEach((key) => {
  26082. value = value[key];
  26083. });
  26084. return value;
  26085. } else {
  26086. return props[keys2];
  26087. }
  26088. }
  26089. class TableLayout {
  26090. constructor(options) {
  26091. this.observers = [];
  26092. this.table = null;
  26093. this.store = null;
  26094. this.columns = [];
  26095. this.fit = true;
  26096. this.showHeader = true;
  26097. this.height = ref(null);
  26098. this.scrollX = ref(false);
  26099. this.scrollY = ref(false);
  26100. this.bodyWidth = ref(null);
  26101. this.fixedWidth = ref(null);
  26102. this.rightFixedWidth = ref(null);
  26103. this.tableHeight = ref(null);
  26104. this.headerHeight = ref(44);
  26105. this.appendHeight = ref(0);
  26106. this.footerHeight = ref(44);
  26107. this.viewportHeight = ref(null);
  26108. this.bodyHeight = ref(null);
  26109. this.bodyScrollHeight = ref(0);
  26110. this.fixedBodyHeight = ref(null);
  26111. this.gutterWidth = 0;
  26112. for (const name in options) {
  26113. if (hasOwn(options, name)) {
  26114. if (isRef(this[name])) {
  26115. this[name].value = options[name];
  26116. } else {
  26117. this[name] = options[name];
  26118. }
  26119. }
  26120. }
  26121. if (!this.table) {
  26122. throw new Error("Table is required for Table Layout");
  26123. }
  26124. if (!this.store) {
  26125. throw new Error("Store is required for Table Layout");
  26126. }
  26127. }
  26128. updateScrollY() {
  26129. const height = this.height.value;
  26130. if (height === null)
  26131. return false;
  26132. const bodyWrapper = this.table.refs.bodyWrapper;
  26133. if (this.table.vnode.el && bodyWrapper) {
  26134. let scrollY = true;
  26135. const prevScrollY = this.scrollY.value;
  26136. if (this.bodyHeight.value === null) {
  26137. scrollY = false;
  26138. } else {
  26139. scrollY = bodyWrapper.scrollHeight > this.bodyHeight.value;
  26140. }
  26141. this.scrollY.value = scrollY;
  26142. return prevScrollY !== scrollY;
  26143. }
  26144. return false;
  26145. }
  26146. setHeight(value, prop = "height") {
  26147. if (!isClient)
  26148. return;
  26149. const el = this.table.vnode.el;
  26150. value = parseHeight(value);
  26151. this.height.value = Number(value);
  26152. if (!el && (value || value === 0))
  26153. return nextTick(() => this.setHeight(value, prop));
  26154. if (typeof value === "number") {
  26155. el.style[prop] = `${value}px`;
  26156. this.updateElsHeight();
  26157. } else if (typeof value === "string") {
  26158. el.style[prop] = value;
  26159. this.updateElsHeight();
  26160. }
  26161. }
  26162. setMaxHeight(value) {
  26163. this.setHeight(value, "max-height");
  26164. }
  26165. getFlattenColumns() {
  26166. const flattenColumns = [];
  26167. const columns = this.table.store.states.columns.value;
  26168. columns.forEach((column) => {
  26169. if (column.isColumnGroup) {
  26170. flattenColumns.push.apply(flattenColumns, column.columns);
  26171. } else {
  26172. flattenColumns.push(column);
  26173. }
  26174. });
  26175. return flattenColumns;
  26176. }
  26177. updateElsHeight() {
  26178. var _a2, _b2;
  26179. if (!this.table.$ready)
  26180. return nextTick(() => this.updateElsHeight());
  26181. const {
  26182. tableWrapper,
  26183. headerWrapper,
  26184. appendWrapper,
  26185. footerWrapper,
  26186. tableHeader,
  26187. tableBody
  26188. } = this.table.refs;
  26189. if (tableWrapper && tableWrapper.style.display === "none") {
  26190. return;
  26191. }
  26192. const { tableLayout } = this.table.props;
  26193. this.appendHeight.value = appendWrapper ? appendWrapper.offsetHeight : 0;
  26194. if (this.showHeader && !headerWrapper && tableLayout === "fixed") {
  26195. return;
  26196. }
  26197. const headerTrElm = tableHeader ? tableHeader : null;
  26198. const noneHeader = this.headerDisplayNone(headerTrElm);
  26199. const headerWrapperOffsetHeight = (headerWrapper == null ? void 0 : headerWrapper.offsetHeight) || 0;
  26200. const headerHeight = this.headerHeight.value = !this.showHeader ? 0 : headerWrapperOffsetHeight;
  26201. if (this.showHeader && !noneHeader && headerWrapperOffsetHeight > 0 && (this.table.store.states.columns.value || []).length > 0 && headerHeight < 2) {
  26202. return nextTick(() => this.updateElsHeight());
  26203. }
  26204. const tableHeight = this.tableHeight.value = (_b2 = (_a2 = this.table) == null ? void 0 : _a2.vnode.el) == null ? void 0 : _b2.clientHeight;
  26205. const footerHeight = this.footerHeight.value = footerWrapper ? footerWrapper.offsetHeight : 0;
  26206. if (this.height.value !== null) {
  26207. if (this.bodyHeight.value === null) {
  26208. requestAnimationFrame(() => this.updateElsHeight());
  26209. }
  26210. this.bodyHeight.value = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
  26211. this.bodyScrollHeight.value = tableBody == null ? void 0 : tableBody.scrollHeight;
  26212. }
  26213. this.fixedBodyHeight.value = this.scrollX.value ? this.bodyHeight.value - this.gutterWidth : this.bodyHeight.value;
  26214. this.viewportHeight.value = this.scrollX.value ? tableHeight - this.gutterWidth : tableHeight;
  26215. this.updateScrollY();
  26216. this.notifyObservers("scrollable");
  26217. }
  26218. headerDisplayNone(elm) {
  26219. if (!elm)
  26220. return true;
  26221. let headerChild = elm;
  26222. while (headerChild.tagName !== "DIV") {
  26223. if (getComputedStyle(headerChild).display === "none") {
  26224. return true;
  26225. }
  26226. headerChild = headerChild.parentElement;
  26227. }
  26228. return false;
  26229. }
  26230. updateColumnsWidth() {
  26231. if (!isClient)
  26232. return;
  26233. const fit = this.fit;
  26234. const bodyWidth = this.table.vnode.el.clientWidth;
  26235. let bodyMinWidth = 0;
  26236. const flattenColumns = this.getFlattenColumns();
  26237. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  26238. flattenColumns.forEach((column) => {
  26239. if (typeof column.width === "number" && column.realWidth)
  26240. column.realWidth = null;
  26241. });
  26242. if (flexColumns.length > 0 && fit) {
  26243. flattenColumns.forEach((column) => {
  26244. bodyMinWidth += Number(column.width || column.minWidth || 80);
  26245. });
  26246. if (bodyMinWidth <= bodyWidth) {
  26247. this.scrollX.value = false;
  26248. const totalFlexWidth = bodyWidth - bodyMinWidth;
  26249. if (flexColumns.length === 1) {
  26250. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  26251. } else {
  26252. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  26253. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  26254. let noneFirstWidth = 0;
  26255. flexColumns.forEach((column, index) => {
  26256. if (index === 0)
  26257. return;
  26258. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  26259. noneFirstWidth += flexWidth;
  26260. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  26261. });
  26262. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  26263. }
  26264. } else {
  26265. this.scrollX.value = true;
  26266. flexColumns.forEach((column) => {
  26267. column.realWidth = Number(column.minWidth);
  26268. });
  26269. }
  26270. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  26271. this.table.state.resizeState.value.width = this.bodyWidth.value;
  26272. } else {
  26273. flattenColumns.forEach((column) => {
  26274. if (!column.width && !column.minWidth) {
  26275. column.realWidth = 80;
  26276. } else {
  26277. column.realWidth = Number(column.width || column.minWidth);
  26278. }
  26279. bodyMinWidth += column.realWidth;
  26280. });
  26281. this.scrollX.value = bodyMinWidth > bodyWidth;
  26282. this.bodyWidth.value = bodyMinWidth;
  26283. }
  26284. const fixedColumns = this.store.states.fixedColumns.value;
  26285. if (fixedColumns.length > 0) {
  26286. let fixedWidth = 0;
  26287. fixedColumns.forEach((column) => {
  26288. fixedWidth += Number(column.realWidth || column.width);
  26289. });
  26290. this.fixedWidth.value = fixedWidth;
  26291. }
  26292. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  26293. if (rightFixedColumns.length > 0) {
  26294. let rightFixedWidth = 0;
  26295. rightFixedColumns.forEach((column) => {
  26296. rightFixedWidth += Number(column.realWidth || column.width);
  26297. });
  26298. this.rightFixedWidth.value = rightFixedWidth;
  26299. }
  26300. this.notifyObservers("columns");
  26301. }
  26302. addObserver(observer) {
  26303. this.observers.push(observer);
  26304. }
  26305. removeObserver(observer) {
  26306. const index = this.observers.indexOf(observer);
  26307. if (index !== -1) {
  26308. this.observers.splice(index, 1);
  26309. }
  26310. }
  26311. notifyObservers(event) {
  26312. const observers = this.observers;
  26313. observers.forEach((observer) => {
  26314. var _a2, _b2;
  26315. switch (event) {
  26316. case "columns":
  26317. (_a2 = observer.state) == null ? void 0 : _a2.onColumnsChange(this);
  26318. break;
  26319. case "scrollable":
  26320. (_b2 = observer.state) == null ? void 0 : _b2.onScrollableChange(this);
  26321. break;
  26322. default:
  26323. throw new Error(`Table Layout don't have event ${event}.`);
  26324. }
  26325. });
  26326. }
  26327. }
  26328. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  26329. const _sfc_main$f = defineComponent({
  26330. name: "ElTableFilterPanel",
  26331. components: {
  26332. ElCheckbox,
  26333. ElCheckboxGroup,
  26334. ElScrollbar,
  26335. ElTooltip,
  26336. ElIcon,
  26337. ArrowDown: arrowDown,
  26338. ArrowUp: arrowUp
  26339. },
  26340. directives: { ClickOutside },
  26341. props: {
  26342. placement: {
  26343. type: String,
  26344. default: "bottom-start"
  26345. },
  26346. store: {
  26347. type: Object
  26348. },
  26349. column: {
  26350. type: Object
  26351. },
  26352. upDataColumn: {
  26353. type: Function
  26354. }
  26355. },
  26356. setup(props) {
  26357. const instance = getCurrentInstance();
  26358. const { t } = useLocale();
  26359. const ns = useNamespace("table-filter");
  26360. const parent = instance == null ? void 0 : instance.parent;
  26361. if (!parent.filterPanels.value[props.column.id]) {
  26362. parent.filterPanels.value[props.column.id] = instance;
  26363. }
  26364. const tooltipVisible = ref(false);
  26365. const tooltip = ref(null);
  26366. const filters = computed(() => {
  26367. return props.column && props.column.filters;
  26368. });
  26369. const filterValue = computed({
  26370. get: () => {
  26371. var _a2;
  26372. return (((_a2 = props.column) == null ? void 0 : _a2.filteredValue) || [])[0];
  26373. },
  26374. set: (value) => {
  26375. if (filteredValue.value) {
  26376. if (typeof value !== "undefined" && value !== null) {
  26377. filteredValue.value.splice(0, 1, value);
  26378. } else {
  26379. filteredValue.value.splice(0, 1);
  26380. }
  26381. }
  26382. }
  26383. });
  26384. const filteredValue = computed({
  26385. get() {
  26386. if (props.column) {
  26387. return props.column.filteredValue || [];
  26388. }
  26389. return [];
  26390. },
  26391. set(value) {
  26392. if (props.column) {
  26393. props.upDataColumn("filteredValue", value);
  26394. }
  26395. }
  26396. });
  26397. const multiple = computed(() => {
  26398. if (props.column) {
  26399. return props.column.filterMultiple;
  26400. }
  26401. return true;
  26402. });
  26403. const isActive = (filter) => {
  26404. return filter.value === filterValue.value;
  26405. };
  26406. const hidden = () => {
  26407. tooltipVisible.value = false;
  26408. };
  26409. const showFilterPanel = (e) => {
  26410. e.stopPropagation();
  26411. tooltipVisible.value = !tooltipVisible.value;
  26412. };
  26413. const hideFilterPanel = () => {
  26414. tooltipVisible.value = false;
  26415. };
  26416. const handleConfirm = () => {
  26417. confirmFilter(filteredValue.value);
  26418. hidden();
  26419. };
  26420. const handleReset = () => {
  26421. filteredValue.value = [];
  26422. confirmFilter(filteredValue.value);
  26423. hidden();
  26424. };
  26425. const handleSelect = (_filterValue) => {
  26426. filterValue.value = _filterValue;
  26427. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  26428. confirmFilter(filteredValue.value);
  26429. } else {
  26430. confirmFilter([]);
  26431. }
  26432. hidden();
  26433. };
  26434. const confirmFilter = (filteredValue2) => {
  26435. props.store.commit("filterChange", {
  26436. column: props.column,
  26437. values: filteredValue2
  26438. });
  26439. props.store.updateAllSelected();
  26440. };
  26441. watch(tooltipVisible, (value) => {
  26442. if (props.column) {
  26443. props.upDataColumn("filterOpened", value);
  26444. }
  26445. }, {
  26446. immediate: true
  26447. });
  26448. const popperPaneRef = computed(() => {
  26449. var _a2, _b2;
  26450. return (_b2 = (_a2 = tooltip.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b2.contentRef;
  26451. });
  26452. return {
  26453. tooltipVisible,
  26454. multiple,
  26455. filteredValue,
  26456. filterValue,
  26457. filters,
  26458. handleConfirm,
  26459. handleReset,
  26460. handleSelect,
  26461. isActive,
  26462. t,
  26463. ns,
  26464. showFilterPanel,
  26465. hideFilterPanel,
  26466. popperPaneRef,
  26467. tooltip
  26468. };
  26469. }
  26470. });
  26471. const _hoisted_1$c = { key: 0 };
  26472. const _hoisted_2$a = ["disabled"];
  26473. const _hoisted_3$7 = ["label", "onClick"];
  26474. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  26475. const _component_el_checkbox = resolveComponent("el-checkbox");
  26476. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  26477. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  26478. const _component_arrow_up = resolveComponent("arrow-up");
  26479. const _component_arrow_down = resolveComponent("arrow-down");
  26480. const _component_el_icon = resolveComponent("el-icon");
  26481. const _component_el_tooltip = resolveComponent("el-tooltip");
  26482. const _directive_click_outside = resolveDirective("click-outside");
  26483. return openBlock(), createBlock(_component_el_tooltip, {
  26484. ref: "tooltip",
  26485. visible: _ctx.tooltipVisible,
  26486. "onUpdate:visible": _cache[5] || (_cache[5] = ($event) => _ctx.tooltipVisible = $event),
  26487. offset: 0,
  26488. placement: _ctx.placement,
  26489. "show-arrow": false,
  26490. "stop-popper-mouse-event": false,
  26491. "append-to-body": "",
  26492. effect: "light",
  26493. pure: "",
  26494. "popper-class": _ctx.ns.b(),
  26495. persistent: ""
  26496. }, {
  26497. content: withCtx(() => [
  26498. _ctx.multiple ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
  26499. createElementVNode("div", {
  26500. class: normalizeClass(_ctx.ns.e("content"))
  26501. }, [
  26502. createVNode(_component_el_scrollbar, {
  26503. "wrap-class": _ctx.ns.e("wrap")
  26504. }, {
  26505. default: withCtx(() => [
  26506. createVNode(_component_el_checkbox_group, {
  26507. modelValue: _ctx.filteredValue,
  26508. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  26509. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  26510. }, {
  26511. default: withCtx(() => [
  26512. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  26513. return openBlock(), createBlock(_component_el_checkbox, {
  26514. key: filter.value,
  26515. label: filter.value
  26516. }, {
  26517. default: withCtx(() => [
  26518. createTextVNode(toDisplayString(filter.text), 1)
  26519. ]),
  26520. _: 2
  26521. }, 1032, ["label"]);
  26522. }), 128))
  26523. ]),
  26524. _: 1
  26525. }, 8, ["modelValue", "class"])
  26526. ]),
  26527. _: 1
  26528. }, 8, ["wrap-class"])
  26529. ], 2),
  26530. createElementVNode("div", {
  26531. class: normalizeClass(_ctx.ns.e("bottom"))
  26532. }, [
  26533. createElementVNode("button", {
  26534. class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  26535. disabled: _ctx.filteredValue.length === 0,
  26536. type: "button",
  26537. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  26538. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$a),
  26539. createElementVNode("button", {
  26540. type: "button",
  26541. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  26542. }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  26543. ], 2)
  26544. ])) : (openBlock(), createElementBlock("ul", {
  26545. key: 1,
  26546. class: normalizeClass(_ctx.ns.e("list"))
  26547. }, [
  26548. createElementVNode("li", {
  26549. class: normalizeClass([
  26550. _ctx.ns.e("list-item"),
  26551. {
  26552. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  26553. }
  26554. ]),
  26555. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  26556. }, toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  26557. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  26558. return openBlock(), createElementBlock("li", {
  26559. key: filter.value,
  26560. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  26561. label: filter.value,
  26562. onClick: ($event) => _ctx.handleSelect(filter.value)
  26563. }, toDisplayString(filter.text), 11, _hoisted_3$7);
  26564. }), 128))
  26565. ], 2))
  26566. ]),
  26567. default: withCtx(() => [
  26568. withDirectives((openBlock(), createElementBlock("span", {
  26569. class: normalizeClass([
  26570. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  26571. `${_ctx.ns.namespace.value}-none-outline`
  26572. ]),
  26573. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  26574. }, [
  26575. createVNode(_component_el_icon, null, {
  26576. default: withCtx(() => [
  26577. _ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
  26578. ]),
  26579. _: 1
  26580. })
  26581. ], 2)), [
  26582. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  26583. ])
  26584. ]),
  26585. _: 1
  26586. }, 8, ["visible", "placement", "popper-class"]);
  26587. }
  26588. var FilterPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["render", _sfc_render$3], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/filter-panel.vue"]]);
  26589. function useLayoutObserver(root2) {
  26590. const instance = getCurrentInstance();
  26591. onBeforeMount(() => {
  26592. tableLayout.value.addObserver(instance);
  26593. });
  26594. onMounted(() => {
  26595. onColumnsChange(tableLayout.value);
  26596. onScrollableChange(tableLayout.value);
  26597. });
  26598. onUpdated(() => {
  26599. onColumnsChange(tableLayout.value);
  26600. onScrollableChange(tableLayout.value);
  26601. });
  26602. onUnmounted(() => {
  26603. tableLayout.value.removeObserver(instance);
  26604. });
  26605. const tableLayout = computed(() => {
  26606. const layout2 = root2.layout;
  26607. if (!layout2) {
  26608. throw new Error("Can not find table layout.");
  26609. }
  26610. return layout2;
  26611. });
  26612. const onColumnsChange = (layout2) => {
  26613. var _a2;
  26614. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col")) || [];
  26615. if (!cols.length)
  26616. return;
  26617. const flattenColumns = layout2.getFlattenColumns();
  26618. const columnsMap = {};
  26619. flattenColumns.forEach((column) => {
  26620. columnsMap[column.id] = column;
  26621. });
  26622. for (let i = 0, j = cols.length; i < j; i++) {
  26623. const col = cols[i];
  26624. const name = col.getAttribute("name");
  26625. const column = columnsMap[name];
  26626. if (column) {
  26627. col.setAttribute("width", column.realWidth || column.width);
  26628. }
  26629. }
  26630. };
  26631. const onScrollableChange = (layout2) => {
  26632. var _a2, _b2;
  26633. const cols = ((_a2 = root2.vnode.el) == null ? void 0 : _a2.querySelectorAll("colgroup > col[name=gutter]")) || [];
  26634. for (let i = 0, j = cols.length; i < j; i++) {
  26635. const col = cols[i];
  26636. col.setAttribute("width", layout2.scrollY.value ? layout2.gutterWidth : "0");
  26637. }
  26638. const ths = ((_b2 = root2.vnode.el) == null ? void 0 : _b2.querySelectorAll("th.gutter")) || [];
  26639. for (let i = 0, j = ths.length; i < j; i++) {
  26640. const th = ths[i];
  26641. th.style.width = layout2.scrollY.value ? `${layout2.gutterWidth}px` : "0";
  26642. th.style.display = layout2.scrollY.value ? "" : "none";
  26643. }
  26644. };
  26645. return {
  26646. tableLayout: tableLayout.value,
  26647. onColumnsChange,
  26648. onScrollableChange
  26649. };
  26650. }
  26651. const TABLE_INJECTION_KEY = Symbol("ElTable");
  26652. function useEvent(props, emit) {
  26653. const instance = getCurrentInstance();
  26654. const parent = inject(TABLE_INJECTION_KEY);
  26655. const handleFilterClick = (event) => {
  26656. event.stopPropagation();
  26657. return;
  26658. };
  26659. const handleHeaderClick = (event, column) => {
  26660. if (!column.filters && column.sortable) {
  26661. handleSortClick(event, column, false);
  26662. } else if (column.filterable && !column.sortable) {
  26663. handleFilterClick(event);
  26664. }
  26665. parent == null ? void 0 : parent.emit("header-click", column, event);
  26666. };
  26667. const handleHeaderContextMenu = (event, column) => {
  26668. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  26669. };
  26670. const draggingColumn = ref(null);
  26671. const dragging = ref(false);
  26672. const dragState = ref({});
  26673. const handleMouseDown = (event, column) => {
  26674. if (!isClient)
  26675. return;
  26676. if (column.children && column.children.length > 0)
  26677. return;
  26678. if (draggingColumn.value && props.border) {
  26679. dragging.value = true;
  26680. const table = parent;
  26681. emit("set-drag-visible", true);
  26682. const tableEl = table == null ? void 0 : table.vnode.el;
  26683. const tableLeft = tableEl.getBoundingClientRect().left;
  26684. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  26685. const columnRect = columnEl.getBoundingClientRect();
  26686. const minLeft = columnRect.left - tableLeft + 30;
  26687. addClass(columnEl, "noclick");
  26688. dragState.value = {
  26689. startMouseLeft: event.clientX,
  26690. startLeft: columnRect.right - tableLeft,
  26691. startColumnLeft: columnRect.left - tableLeft,
  26692. tableLeft
  26693. };
  26694. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  26695. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  26696. document.onselectstart = function() {
  26697. return false;
  26698. };
  26699. document.ondragstart = function() {
  26700. return false;
  26701. };
  26702. const handleMouseMove2 = (event2) => {
  26703. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  26704. const proxyLeft = dragState.value.startLeft + deltaLeft;
  26705. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  26706. };
  26707. const handleMouseUp = () => {
  26708. if (dragging.value) {
  26709. const { startColumnLeft, startLeft } = dragState.value;
  26710. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  26711. const columnWidth = finalLeft - startColumnLeft;
  26712. column.width = column.realWidth = columnWidth;
  26713. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  26714. requestAnimationFrame(() => {
  26715. props.store.scheduleLayout(false, true);
  26716. });
  26717. document.body.style.cursor = "";
  26718. dragging.value = false;
  26719. draggingColumn.value = null;
  26720. dragState.value = {};
  26721. emit("set-drag-visible", false);
  26722. }
  26723. document.removeEventListener("mousemove", handleMouseMove2);
  26724. document.removeEventListener("mouseup", handleMouseUp);
  26725. document.onselectstart = null;
  26726. document.ondragstart = null;
  26727. setTimeout(() => {
  26728. removeClass(columnEl, "noclick");
  26729. }, 0);
  26730. };
  26731. document.addEventListener("mousemove", handleMouseMove2);
  26732. document.addEventListener("mouseup", handleMouseUp);
  26733. }
  26734. };
  26735. const handleMouseMove = (event, column) => {
  26736. if (column.children && column.children.length > 0)
  26737. return;
  26738. let target = event.target;
  26739. while (target && target.tagName !== "TH") {
  26740. target = target.parentNode;
  26741. }
  26742. if (!column || !column.resizable)
  26743. return;
  26744. if (!dragging.value && props.border) {
  26745. const rect = target.getBoundingClientRect();
  26746. const bodyStyle = document.body.style;
  26747. if (rect.width > 12 && rect.right - event.pageX < 8) {
  26748. bodyStyle.cursor = "col-resize";
  26749. if (hasClass(target, "is-sortable")) {
  26750. target.style.cursor = "col-resize";
  26751. }
  26752. draggingColumn.value = column;
  26753. } else if (!dragging.value) {
  26754. bodyStyle.cursor = "";
  26755. if (hasClass(target, "is-sortable")) {
  26756. target.style.cursor = "pointer";
  26757. }
  26758. draggingColumn.value = null;
  26759. }
  26760. }
  26761. };
  26762. const handleMouseOut = () => {
  26763. if (!isClient)
  26764. return;
  26765. document.body.style.cursor = "";
  26766. };
  26767. const toggleOrder = ({ order: order2, sortOrders }) => {
  26768. if (order2 === "")
  26769. return sortOrders[0];
  26770. const index = sortOrders.indexOf(order2 || null);
  26771. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  26772. };
  26773. const handleSortClick = (event, column, givenOrder) => {
  26774. event.stopPropagation();
  26775. const order2 = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  26776. let target = event.target;
  26777. while (target && target.tagName !== "TH") {
  26778. target = target.parentNode;
  26779. }
  26780. if (target && target.tagName === "TH") {
  26781. if (hasClass(target, "noclick")) {
  26782. removeClass(target, "noclick");
  26783. return;
  26784. }
  26785. }
  26786. if (!column.sortable)
  26787. return;
  26788. const states = props.store.states;
  26789. let sortProp = states.sortProp.value;
  26790. let sortOrder;
  26791. const sortingColumn = states.sortingColumn.value;
  26792. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  26793. if (sortingColumn) {
  26794. sortingColumn.order = null;
  26795. }
  26796. states.sortingColumn.value = column;
  26797. sortProp = column.property;
  26798. }
  26799. if (!order2) {
  26800. sortOrder = column.order = null;
  26801. } else {
  26802. sortOrder = column.order = order2;
  26803. }
  26804. states.sortProp.value = sortProp;
  26805. states.sortOrder.value = sortOrder;
  26806. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  26807. };
  26808. return {
  26809. handleHeaderClick,
  26810. handleHeaderContextMenu,
  26811. handleMouseDown,
  26812. handleMouseMove,
  26813. handleMouseOut,
  26814. handleSortClick,
  26815. handleFilterClick
  26816. };
  26817. }
  26818. function useStyle$2(props) {
  26819. const parent = inject(TABLE_INJECTION_KEY);
  26820. const ns = useNamespace("table");
  26821. const getHeaderRowStyle = (rowIndex) => {
  26822. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  26823. if (typeof headerRowStyle === "function") {
  26824. return headerRowStyle.call(null, { rowIndex });
  26825. }
  26826. return headerRowStyle;
  26827. };
  26828. const getHeaderRowClass = (rowIndex) => {
  26829. const classes = [];
  26830. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  26831. if (typeof headerRowClassName === "string") {
  26832. classes.push(headerRowClassName);
  26833. } else if (typeof headerRowClassName === "function") {
  26834. classes.push(headerRowClassName.call(null, { rowIndex }));
  26835. }
  26836. return classes.join(" ");
  26837. };
  26838. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  26839. var _a2;
  26840. let headerCellStyles = (_a2 = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a2 : {};
  26841. if (typeof headerCellStyles === "function") {
  26842. headerCellStyles = headerCellStyles.call(null, {
  26843. rowIndex,
  26844. columnIndex,
  26845. row,
  26846. column
  26847. });
  26848. }
  26849. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  26850. ensurePosition(fixedStyle, "left");
  26851. ensurePosition(fixedStyle, "right");
  26852. return Object.assign({}, headerCellStyles, fixedStyle);
  26853. };
  26854. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  26855. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  26856. const classes = [
  26857. column.id,
  26858. column.order,
  26859. column.headerAlign,
  26860. column.className,
  26861. column.labelClassName,
  26862. ...fixedClasses
  26863. ];
  26864. if (!column.children) {
  26865. classes.push("is-leaf");
  26866. }
  26867. if (column.sortable) {
  26868. classes.push("is-sortable");
  26869. }
  26870. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  26871. if (typeof headerCellClassName === "string") {
  26872. classes.push(headerCellClassName);
  26873. } else if (typeof headerCellClassName === "function") {
  26874. classes.push(headerCellClassName.call(null, {
  26875. rowIndex,
  26876. columnIndex,
  26877. row,
  26878. column
  26879. }));
  26880. }
  26881. classes.push(ns.e("cell"));
  26882. return classes.filter((className) => Boolean(className)).join(" ");
  26883. };
  26884. return {
  26885. getHeaderRowStyle,
  26886. getHeaderRowClass,
  26887. getHeaderCellStyle,
  26888. getHeaderCellClass
  26889. };
  26890. }
  26891. const getAllColumns = (columns) => {
  26892. const result = [];
  26893. columns.forEach((column) => {
  26894. if (column.children) {
  26895. result.push(column);
  26896. result.push.apply(result, getAllColumns(column.children));
  26897. } else {
  26898. result.push(column);
  26899. }
  26900. });
  26901. return result;
  26902. };
  26903. const convertToRows = (originColumns) => {
  26904. let maxLevel = 1;
  26905. const traverse = (column, parent) => {
  26906. if (parent) {
  26907. column.level = parent.level + 1;
  26908. if (maxLevel < column.level) {
  26909. maxLevel = column.level;
  26910. }
  26911. }
  26912. if (column.children) {
  26913. let colSpan = 0;
  26914. column.children.forEach((subColumn) => {
  26915. traverse(subColumn, column);
  26916. colSpan += subColumn.colSpan;
  26917. });
  26918. column.colSpan = colSpan;
  26919. } else {
  26920. column.colSpan = 1;
  26921. }
  26922. };
  26923. originColumns.forEach((column) => {
  26924. column.level = 1;
  26925. traverse(column, void 0);
  26926. });
  26927. const rows = [];
  26928. for (let i = 0; i < maxLevel; i++) {
  26929. rows.push([]);
  26930. }
  26931. const allColumns = getAllColumns(originColumns);
  26932. allColumns.forEach((column) => {
  26933. if (!column.children) {
  26934. column.rowSpan = maxLevel - column.level + 1;
  26935. } else {
  26936. column.rowSpan = 1;
  26937. column.children.forEach((col) => col.isSubColumn = true);
  26938. }
  26939. rows[column.level - 1].push(column);
  26940. });
  26941. return rows;
  26942. };
  26943. function useUtils$1(props) {
  26944. const parent = inject(TABLE_INJECTION_KEY);
  26945. const columnRows = computed(() => {
  26946. return convertToRows(props.store.states.originColumns.value);
  26947. });
  26948. const isGroup = computed(() => {
  26949. const result = columnRows.value.length > 1;
  26950. if (result && parent) {
  26951. parent.state.isGroup.value = true;
  26952. }
  26953. return result;
  26954. });
  26955. const toggleAllSelection = (event) => {
  26956. event.stopPropagation();
  26957. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  26958. };
  26959. return {
  26960. isGroup,
  26961. toggleAllSelection,
  26962. columnRows
  26963. };
  26964. }
  26965. var TableHeader = defineComponent({
  26966. name: "ElTableHeader",
  26967. components: {
  26968. ElCheckbox
  26969. },
  26970. props: {
  26971. fixed: {
  26972. type: String,
  26973. default: ""
  26974. },
  26975. store: {
  26976. required: true,
  26977. type: Object
  26978. },
  26979. border: Boolean,
  26980. defaultSort: {
  26981. type: Object,
  26982. default: () => {
  26983. return {
  26984. prop: "",
  26985. order: ""
  26986. };
  26987. }
  26988. }
  26989. },
  26990. setup(props, { emit }) {
  26991. const instance = getCurrentInstance();
  26992. const parent = inject(TABLE_INJECTION_KEY);
  26993. const ns = useNamespace("table");
  26994. const filterPanels = ref({});
  26995. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  26996. onMounted(async () => {
  26997. await nextTick();
  26998. await nextTick();
  26999. const { prop, order: order2 } = props.defaultSort;
  27000. parent == null ? void 0 : parent.store.commit("sort", { prop, order: order2, init: true });
  27001. });
  27002. const {
  27003. handleHeaderClick,
  27004. handleHeaderContextMenu,
  27005. handleMouseDown,
  27006. handleMouseMove,
  27007. handleMouseOut,
  27008. handleSortClick,
  27009. handleFilterClick
  27010. } = useEvent(props, emit);
  27011. const {
  27012. getHeaderRowStyle,
  27013. getHeaderRowClass,
  27014. getHeaderCellStyle,
  27015. getHeaderCellClass
  27016. } = useStyle$2(props);
  27017. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  27018. instance.state = {
  27019. onColumnsChange,
  27020. onScrollableChange
  27021. };
  27022. instance.filterPanels = filterPanels;
  27023. return {
  27024. ns,
  27025. filterPanels,
  27026. onColumnsChange,
  27027. onScrollableChange,
  27028. columnRows,
  27029. getHeaderRowClass,
  27030. getHeaderRowStyle,
  27031. getHeaderCellClass,
  27032. getHeaderCellStyle,
  27033. handleHeaderClick,
  27034. handleHeaderContextMenu,
  27035. handleMouseDown,
  27036. handleMouseMove,
  27037. handleMouseOut,
  27038. handleSortClick,
  27039. handleFilterClick,
  27040. isGroup,
  27041. toggleAllSelection
  27042. };
  27043. },
  27044. render() {
  27045. const {
  27046. ns,
  27047. isGroup,
  27048. columnRows,
  27049. getHeaderCellStyle,
  27050. getHeaderCellClass,
  27051. getHeaderRowClass,
  27052. getHeaderRowStyle,
  27053. handleHeaderClick,
  27054. handleHeaderContextMenu,
  27055. handleMouseDown,
  27056. handleMouseMove,
  27057. handleSortClick,
  27058. handleMouseOut,
  27059. store,
  27060. $parent
  27061. } = this;
  27062. let rowSpan = 1;
  27063. return h$1("thead", {
  27064. class: { [ns.is("group")]: isGroup }
  27065. }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
  27066. class: getHeaderRowClass(rowIndex),
  27067. key: rowIndex,
  27068. style: getHeaderRowStyle(rowIndex)
  27069. }, subColumns.map((column, cellIndex) => {
  27070. if (column.rowSpan > rowSpan) {
  27071. rowSpan = column.rowSpan;
  27072. }
  27073. return h$1("th", {
  27074. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  27075. colspan: column.colSpan,
  27076. key: `${column.id}-thead`,
  27077. rowspan: column.rowSpan,
  27078. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  27079. onClick: ($event) => handleHeaderClick($event, column),
  27080. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  27081. onMousedown: ($event) => handleMouseDown($event, column),
  27082. onMousemove: ($event) => handleMouseMove($event, column),
  27083. onMouseout: handleMouseOut
  27084. }, [
  27085. h$1("div", {
  27086. class: [
  27087. "cell",
  27088. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : "",
  27089. column.labelClassName
  27090. ]
  27091. }, [
  27092. column.renderHeader ? column.renderHeader({
  27093. column,
  27094. $index: cellIndex,
  27095. store,
  27096. _self: $parent
  27097. }) : column.label,
  27098. column.sortable && h$1("span", {
  27099. onClick: ($event) => handleSortClick($event, column),
  27100. class: "caret-wrapper"
  27101. }, [
  27102. h$1("i", {
  27103. onClick: ($event) => handleSortClick($event, column, "ascending"),
  27104. class: "sort-caret ascending"
  27105. }),
  27106. h$1("i", {
  27107. onClick: ($event) => handleSortClick($event, column, "descending"),
  27108. class: "sort-caret descending"
  27109. })
  27110. ]),
  27111. column.filterable && h$1(FilterPanel, {
  27112. store,
  27113. placement: column.filterPlacement || "bottom-start",
  27114. column,
  27115. upDataColumn: (key, value) => {
  27116. column[key] = value;
  27117. }
  27118. })
  27119. ])
  27120. ]);
  27121. }))));
  27122. }
  27123. });
  27124. function useEvents(props) {
  27125. const parent = inject(TABLE_INJECTION_KEY);
  27126. const tooltipContent = ref("");
  27127. const tooltipTrigger = ref(h$1("div"));
  27128. const handleEvent = (event, row, name) => {
  27129. var _a2;
  27130. const table = parent;
  27131. const cell = getCell(event);
  27132. let column;
  27133. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  27134. if (cell) {
  27135. column = getColumnByCell({
  27136. columns: props.store.states.columns.value
  27137. }, cell, namespace);
  27138. if (column) {
  27139. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  27140. }
  27141. }
  27142. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  27143. };
  27144. const handleDoubleClick = (event, row) => {
  27145. handleEvent(event, row, "dblclick");
  27146. };
  27147. const handleClick = (event, row) => {
  27148. props.store.commit("setCurrentRow", row);
  27149. handleEvent(event, row, "click");
  27150. };
  27151. const handleContextMenu = (event, row) => {
  27152. handleEvent(event, row, "contextmenu");
  27153. };
  27154. const handleMouseEnter = debounce$1((index) => {
  27155. props.store.commit("setHoverRow", index);
  27156. }, 30);
  27157. const handleMouseLeave = debounce$1(() => {
  27158. props.store.commit("setHoverRow", null);
  27159. }, 30);
  27160. const handleCellMouseEnter = (event, row) => {
  27161. var _a2;
  27162. const table = parent;
  27163. const cell = getCell(event);
  27164. const namespace = (_a2 = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a2.dataset.prefix;
  27165. if (cell) {
  27166. const column = getColumnByCell({
  27167. columns: props.store.states.columns.value
  27168. }, cell, namespace);
  27169. const hoverState = table.hoverState = { cell, column, row };
  27170. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  27171. }
  27172. const cellChild = event.target.querySelector(".cell");
  27173. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  27174. return;
  27175. }
  27176. const range3 = document.createRange();
  27177. range3.setStart(cellChild, 0);
  27178. range3.setEnd(cellChild, cellChild.childNodes.length);
  27179. const rangeWidth = range3.getBoundingClientRect().width;
  27180. const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0);
  27181. if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
  27182. createTablePopper(cell, cell.innerText || cell.textContent, {
  27183. placement: "top",
  27184. strategy: "fixed"
  27185. }, row.tooltipEffect);
  27186. }
  27187. };
  27188. const handleCellMouseLeave = (event) => {
  27189. const cell = getCell(event);
  27190. if (!cell)
  27191. return;
  27192. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  27193. 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);
  27194. };
  27195. return {
  27196. handleDoubleClick,
  27197. handleClick,
  27198. handleContextMenu,
  27199. handleMouseEnter,
  27200. handleMouseLeave,
  27201. handleCellMouseEnter,
  27202. handleCellMouseLeave,
  27203. tooltipContent,
  27204. tooltipTrigger
  27205. };
  27206. }
  27207. function useStyles(props) {
  27208. const parent = inject(TABLE_INJECTION_KEY);
  27209. const ns = useNamespace("table");
  27210. const getRowStyle = (row, rowIndex) => {
  27211. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  27212. if (typeof rowStyle === "function") {
  27213. return rowStyle.call(null, {
  27214. row,
  27215. rowIndex
  27216. });
  27217. }
  27218. return rowStyle || null;
  27219. };
  27220. const getRowClass = (row, rowIndex) => {
  27221. const classes = [ns.e("row")];
  27222. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  27223. classes.push("current-row");
  27224. }
  27225. if (props.stripe && rowIndex % 2 === 1) {
  27226. classes.push(ns.em("row", "striped"));
  27227. }
  27228. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  27229. if (typeof rowClassName === "string") {
  27230. classes.push(rowClassName);
  27231. } else if (typeof rowClassName === "function") {
  27232. classes.push(rowClassName.call(null, {
  27233. row,
  27234. rowIndex
  27235. }));
  27236. }
  27237. return classes;
  27238. };
  27239. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  27240. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  27241. let cellStyles = cellStyle != null ? cellStyle : {};
  27242. if (typeof cellStyle === "function") {
  27243. cellStyles = cellStyle.call(null, {
  27244. rowIndex,
  27245. columnIndex,
  27246. row,
  27247. column
  27248. });
  27249. }
  27250. const fixedStyle = column.isSubColumn ? null : getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  27251. ensurePosition(fixedStyle, "left");
  27252. ensurePosition(fixedStyle, "right");
  27253. return Object.assign({}, cellStyles, fixedStyle);
  27254. };
  27255. const getCellClass = (rowIndex, columnIndex, row, column) => {
  27256. const fixedClasses = column.isSubColumn ? [] : getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store);
  27257. const classes = [column.id, column.align, column.className, ...fixedClasses];
  27258. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  27259. if (typeof cellClassName === "string") {
  27260. classes.push(cellClassName);
  27261. } else if (typeof cellClassName === "function") {
  27262. classes.push(cellClassName.call(null, {
  27263. rowIndex,
  27264. columnIndex,
  27265. row,
  27266. column
  27267. }));
  27268. }
  27269. classes.push(ns.e("cell"));
  27270. return classes.filter((className) => Boolean(className)).join(" ");
  27271. };
  27272. const getSpan = (row, column, rowIndex, columnIndex) => {
  27273. let rowspan = 1;
  27274. let colspan = 1;
  27275. const fn2 = parent == null ? void 0 : parent.props.spanMethod;
  27276. if (typeof fn2 === "function") {
  27277. const result = fn2({
  27278. row,
  27279. column,
  27280. rowIndex,
  27281. columnIndex
  27282. });
  27283. if (Array.isArray(result)) {
  27284. rowspan = result[0];
  27285. colspan = result[1];
  27286. } else if (typeof result === "object") {
  27287. rowspan = result.rowspan;
  27288. colspan = result.colspan;
  27289. }
  27290. }
  27291. return { rowspan, colspan };
  27292. };
  27293. const getColspanRealWidth = (columns, colspan, index) => {
  27294. if (colspan < 1) {
  27295. return columns[index].realWidth;
  27296. }
  27297. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  27298. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  27299. };
  27300. return {
  27301. getRowStyle,
  27302. getRowClass,
  27303. getCellStyle,
  27304. getCellClass,
  27305. getSpan,
  27306. getColspanRealWidth
  27307. };
  27308. }
  27309. function useRender$1(props) {
  27310. const parent = inject(TABLE_INJECTION_KEY);
  27311. const {
  27312. handleDoubleClick,
  27313. handleClick,
  27314. handleContextMenu,
  27315. handleMouseEnter,
  27316. handleMouseLeave,
  27317. handleCellMouseEnter,
  27318. handleCellMouseLeave,
  27319. tooltipContent,
  27320. tooltipTrigger
  27321. } = useEvents(props);
  27322. const {
  27323. getRowStyle,
  27324. getRowClass,
  27325. getCellStyle,
  27326. getCellClass,
  27327. getSpan,
  27328. getColspanRealWidth
  27329. } = useStyles(props);
  27330. const firstDefaultColumnIndex = computed(() => {
  27331. return props.store.states.columns.value.findIndex(({ type: type4 }) => type4 === "default");
  27332. });
  27333. const getKeyOfRow = (row, index) => {
  27334. const rowKey = parent.props.rowKey;
  27335. if (rowKey) {
  27336. return getRowIdentity(row, rowKey);
  27337. }
  27338. return index;
  27339. };
  27340. const rowRender = (row, $index, treeRowData, expanded = false) => {
  27341. const { tooltipEffect, store } = props;
  27342. const { indent, columns } = store.states;
  27343. const rowClasses = getRowClass(row, $index);
  27344. let display = true;
  27345. if (treeRowData) {
  27346. rowClasses.push(`el-table__row--level-${treeRowData.level}`);
  27347. display = treeRowData.display;
  27348. }
  27349. const displayStyle = display ? null : {
  27350. display: "none"
  27351. };
  27352. return h$1("tr", {
  27353. style: [displayStyle, getRowStyle(row, $index)],
  27354. class: rowClasses,
  27355. key: getKeyOfRow(row, $index),
  27356. onDblclick: ($event) => handleDoubleClick($event, row),
  27357. onClick: ($event) => handleClick($event, row),
  27358. onContextmenu: ($event) => handleContextMenu($event, row),
  27359. onMouseenter: () => handleMouseEnter($index),
  27360. onMouseleave: handleMouseLeave
  27361. }, columns.value.map((column, cellIndex) => {
  27362. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  27363. if (!rowspan || !colspan) {
  27364. return null;
  27365. }
  27366. const columnData = __spreadValues({}, column);
  27367. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  27368. const data2 = {
  27369. store: props.store,
  27370. _self: props.context || parent,
  27371. column: columnData,
  27372. row,
  27373. $index,
  27374. cellIndex,
  27375. expanded
  27376. };
  27377. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  27378. data2.treeNode = {
  27379. indent: treeRowData.level * indent.value,
  27380. level: treeRowData.level
  27381. };
  27382. if (typeof treeRowData.expanded === "boolean") {
  27383. data2.treeNode.expanded = treeRowData.expanded;
  27384. if ("loading" in treeRowData) {
  27385. data2.treeNode.loading = treeRowData.loading;
  27386. }
  27387. if ("noLazyChildren" in treeRowData) {
  27388. data2.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  27389. }
  27390. }
  27391. }
  27392. const baseKey = `${$index},${cellIndex}`;
  27393. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  27394. const tdChildren = cellChildren(cellIndex, column, data2);
  27395. return h$1("td", {
  27396. style: getCellStyle($index, cellIndex, row, column),
  27397. class: getCellClass($index, cellIndex, row, column),
  27398. key: `${patchKey}${baseKey}`,
  27399. rowspan,
  27400. colspan,
  27401. onMouseenter: ($event) => handleCellMouseEnter($event, __spreadProps(__spreadValues({}, row), { tooltipEffect })),
  27402. onMouseleave: handleCellMouseLeave
  27403. }, [tdChildren]);
  27404. }));
  27405. };
  27406. const cellChildren = (cellIndex, column, data2) => {
  27407. return column.renderCell(data2);
  27408. };
  27409. const wrappedRowRender = (row, $index) => {
  27410. const store = props.store;
  27411. const { isRowExpanded, assertRowKey } = store;
  27412. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  27413. const columns = store.states.columns.value;
  27414. const hasExpandColumn = columns.some(({ type: type4 }) => type4 === "expand");
  27415. if (hasExpandColumn) {
  27416. const expanded = isRowExpanded(row);
  27417. const tr = rowRender(row, $index, void 0, expanded);
  27418. const renderExpanded = parent.renderExpanded;
  27419. if (expanded) {
  27420. if (!renderExpanded) {
  27421. console.error("[Element Error]renderExpanded is required.");
  27422. return tr;
  27423. }
  27424. return [
  27425. [
  27426. tr,
  27427. h$1("tr", {
  27428. key: `expanded-row__${tr.key}`
  27429. }, [
  27430. h$1("td", {
  27431. colspan: columns.length,
  27432. class: "el-table__cell el-table__expanded-cell"
  27433. }, [renderExpanded({ row, $index, store, expanded })])
  27434. ])
  27435. ]
  27436. ];
  27437. } else {
  27438. return [[tr]];
  27439. }
  27440. } else if (Object.keys(treeData.value).length) {
  27441. assertRowKey();
  27442. const key = getRowIdentity(row, rowKey.value);
  27443. let cur = treeData.value[key];
  27444. let treeRowData = null;
  27445. if (cur) {
  27446. treeRowData = {
  27447. expanded: cur.expanded,
  27448. level: cur.level,
  27449. display: true
  27450. };
  27451. if (typeof cur.lazy === "boolean") {
  27452. if (typeof cur.loaded === "boolean" && cur.loaded) {
  27453. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  27454. }
  27455. treeRowData.loading = cur.loading;
  27456. }
  27457. }
  27458. const tmp = [rowRender(row, $index, treeRowData)];
  27459. if (cur) {
  27460. let i = 0;
  27461. const traverse = (children, parent2) => {
  27462. if (!(children && children.length && parent2))
  27463. return;
  27464. children.forEach((node) => {
  27465. const innerTreeRowData = {
  27466. display: parent2.display && parent2.expanded,
  27467. level: parent2.level + 1,
  27468. expanded: false,
  27469. noLazyChildren: false,
  27470. loading: false
  27471. };
  27472. const childKey = getRowIdentity(node, rowKey.value);
  27473. if (childKey === void 0 || childKey === null) {
  27474. throw new Error("For nested data item, row-key is required.");
  27475. }
  27476. cur = __spreadValues({}, treeData.value[childKey]);
  27477. if (cur) {
  27478. innerTreeRowData.expanded = cur.expanded;
  27479. cur.level = cur.level || innerTreeRowData.level;
  27480. cur.display = !!(cur.expanded && innerTreeRowData.display);
  27481. if (typeof cur.lazy === "boolean") {
  27482. if (typeof cur.loaded === "boolean" && cur.loaded) {
  27483. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  27484. }
  27485. innerTreeRowData.loading = cur.loading;
  27486. }
  27487. }
  27488. i++;
  27489. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  27490. if (cur) {
  27491. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  27492. traverse(nodes2, cur);
  27493. }
  27494. });
  27495. };
  27496. cur.display = true;
  27497. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  27498. traverse(nodes, cur);
  27499. }
  27500. return tmp;
  27501. } else {
  27502. return rowRender(row, $index, void 0);
  27503. }
  27504. };
  27505. return {
  27506. wrappedRowRender,
  27507. tooltipContent,
  27508. tooltipTrigger
  27509. };
  27510. }
  27511. const defaultProps$2 = {
  27512. store: {
  27513. required: true,
  27514. type: Object
  27515. },
  27516. stripe: Boolean,
  27517. tooltipEffect: String,
  27518. context: {
  27519. default: () => ({}),
  27520. type: Object
  27521. },
  27522. rowClassName: [String, Function],
  27523. rowStyle: [Object, Function],
  27524. fixed: {
  27525. type: String,
  27526. default: ""
  27527. },
  27528. highlight: Boolean
  27529. };
  27530. var TableBody = defineComponent({
  27531. name: "ElTableBody",
  27532. props: defaultProps$2,
  27533. setup(props) {
  27534. const instance = getCurrentInstance();
  27535. const parent = inject(TABLE_INJECTION_KEY);
  27536. const ns = useNamespace("table");
  27537. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  27538. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  27539. watch(props.store.states.hoverRow, (newVal, oldVal) => {
  27540. if (!props.store.states.isComplex.value || !isClient)
  27541. return;
  27542. let raf = window.requestAnimationFrame;
  27543. if (!raf) {
  27544. raf = (fn2) => window.setTimeout(fn2, 16);
  27545. }
  27546. raf(() => {
  27547. var _a2;
  27548. const rows = (_a2 = instance == null ? void 0 : instance.vnode.el) == null ? void 0 : _a2.querySelectorAll(`.${ns.e("row")}`);
  27549. const oldRow = rows[oldVal];
  27550. const newRow = rows[newVal];
  27551. if (oldRow) {
  27552. removeClass(oldRow, "hover-row");
  27553. }
  27554. if (newRow) {
  27555. addClass(newRow, "hover-row");
  27556. }
  27557. });
  27558. });
  27559. onUnmounted(() => {
  27560. var _a2;
  27561. (_a2 = removePopper) == null ? void 0 : _a2();
  27562. });
  27563. onUpdated(() => {
  27564. var _a2;
  27565. (_a2 = removePopper) == null ? void 0 : _a2();
  27566. });
  27567. return {
  27568. ns,
  27569. onColumnsChange,
  27570. onScrollableChange,
  27571. wrappedRowRender,
  27572. tooltipContent,
  27573. tooltipTrigger
  27574. };
  27575. },
  27576. render() {
  27577. const { wrappedRowRender, store } = this;
  27578. const data2 = store.states.data.value || [];
  27579. return h$1("tbody", {}, [
  27580. data2.reduce((acc, row) => {
  27581. return acc.concat(wrappedRowRender(row, acc.length));
  27582. }, [])
  27583. ]);
  27584. }
  27585. });
  27586. function hColgroup(props) {
  27587. const isAuto = props.tableLayout === "auto";
  27588. let columns = props.columns || [];
  27589. if (isAuto) {
  27590. if (columns.every((column) => column.width === void 0)) {
  27591. columns = [];
  27592. }
  27593. }
  27594. const getPropsData = (column) => {
  27595. const propsData = {
  27596. key: `${props.tableLayout}_${column.id}`,
  27597. style: {},
  27598. name: void 0
  27599. };
  27600. if (isAuto) {
  27601. propsData.style = {
  27602. width: `${column.width}px`
  27603. };
  27604. } else {
  27605. propsData.name = column.id;
  27606. }
  27607. return propsData;
  27608. };
  27609. return h$1("colgroup", {}, columns.map((column) => h$1("col", getPropsData(column))));
  27610. }
  27611. hColgroup.props = ["columns", "tableLayout"];
  27612. function useMapState() {
  27613. const table = inject(TABLE_INJECTION_KEY);
  27614. const store = table == null ? void 0 : table.store;
  27615. const leftFixedLeafCount = computed(() => {
  27616. return store.states.fixedLeafColumnsLength.value;
  27617. });
  27618. const rightFixedLeafCount = computed(() => {
  27619. return store.states.rightFixedColumns.value.length;
  27620. });
  27621. const columnsCount = computed(() => {
  27622. return store.states.columns.value.length;
  27623. });
  27624. const leftFixedCount = computed(() => {
  27625. return store.states.fixedColumns.value.length;
  27626. });
  27627. const rightFixedCount = computed(() => {
  27628. return store.states.rightFixedColumns.value.length;
  27629. });
  27630. return {
  27631. leftFixedLeafCount,
  27632. rightFixedLeafCount,
  27633. columnsCount,
  27634. leftFixedCount,
  27635. rightFixedCount,
  27636. columns: store.states.columns
  27637. };
  27638. }
  27639. function useStyle$1(props) {
  27640. const { columns } = useMapState();
  27641. const ns = useNamespace("table");
  27642. const getCellClasses = (columns2, cellIndex) => {
  27643. const column = columns2[cellIndex];
  27644. const classes = [
  27645. ns.e("cell"),
  27646. column.id,
  27647. column.align,
  27648. column.labelClassName,
  27649. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  27650. ];
  27651. if (column.className) {
  27652. classes.push(column.className);
  27653. }
  27654. if (!column.children) {
  27655. classes.push(ns.is("leaf"));
  27656. }
  27657. return classes;
  27658. };
  27659. const getCellStyles = (column, cellIndex) => {
  27660. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  27661. ensurePosition(fixedStyle, "left");
  27662. ensurePosition(fixedStyle, "right");
  27663. return fixedStyle;
  27664. };
  27665. return {
  27666. getCellClasses,
  27667. getCellStyles,
  27668. columns
  27669. };
  27670. }
  27671. var TableFooter = defineComponent({
  27672. name: "ElTableFooter",
  27673. props: {
  27674. fixed: {
  27675. type: String,
  27676. default: ""
  27677. },
  27678. store: {
  27679. required: true,
  27680. type: Object
  27681. },
  27682. summaryMethod: Function,
  27683. sumText: String,
  27684. border: Boolean,
  27685. defaultSort: {
  27686. type: Object,
  27687. default: () => {
  27688. return {
  27689. prop: "",
  27690. order: ""
  27691. };
  27692. }
  27693. }
  27694. },
  27695. setup(props) {
  27696. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  27697. const ns = useNamespace("table");
  27698. return {
  27699. ns,
  27700. getCellClasses,
  27701. getCellStyles,
  27702. columns
  27703. };
  27704. },
  27705. render() {
  27706. const {
  27707. columns,
  27708. getCellStyles,
  27709. getCellClasses,
  27710. summaryMethod,
  27711. sumText,
  27712. ns
  27713. } = this;
  27714. const data2 = this.store.states.data.value;
  27715. let sums = [];
  27716. if (summaryMethod) {
  27717. sums = summaryMethod({
  27718. columns,
  27719. data: data2
  27720. });
  27721. } else {
  27722. columns.forEach((column, index) => {
  27723. if (index === 0) {
  27724. sums[index] = sumText;
  27725. return;
  27726. }
  27727. const values = data2.map((item) => Number(item[column.property]));
  27728. const precisions = [];
  27729. let notNumber = true;
  27730. values.forEach((value) => {
  27731. if (!Number.isNaN(+value)) {
  27732. notNumber = false;
  27733. const decimal = `${value}`.split(".")[1];
  27734. precisions.push(decimal ? decimal.length : 0);
  27735. }
  27736. });
  27737. const precision = Math.max.apply(null, precisions);
  27738. if (!notNumber) {
  27739. sums[index] = values.reduce((prev, curr) => {
  27740. const value = Number(curr);
  27741. if (!Number.isNaN(+value)) {
  27742. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  27743. } else {
  27744. return prev;
  27745. }
  27746. }, 0);
  27747. } else {
  27748. sums[index] = "";
  27749. }
  27750. });
  27751. }
  27752. return h$1("table", {
  27753. class: ns.e("footer"),
  27754. cellspacing: "0",
  27755. cellpadding: "0",
  27756. border: "0"
  27757. }, [
  27758. hColgroup({
  27759. columns
  27760. }),
  27761. h$1("tbody", [
  27762. h$1("tr", {}, [
  27763. ...columns.map((column, cellIndex) => h$1("td", {
  27764. key: cellIndex,
  27765. colspan: column.colSpan,
  27766. rowspan: column.rowSpan,
  27767. class: getCellClasses(columns, cellIndex),
  27768. style: getCellStyles(column, cellIndex)
  27769. }, [
  27770. h$1("div", {
  27771. class: ["cell", column.labelClassName]
  27772. }, [sums[cellIndex]])
  27773. ]))
  27774. ])
  27775. ])
  27776. ]);
  27777. }
  27778. });
  27779. function useUtils(store) {
  27780. const setCurrentRow = (row) => {
  27781. store.commit("setCurrentRow", row);
  27782. };
  27783. const getSelectionRows = () => {
  27784. return store.getSelectionRows();
  27785. };
  27786. const toggleRowSelection = (row, selected) => {
  27787. store.toggleRowSelection(row, selected, false);
  27788. store.updateAllSelected();
  27789. };
  27790. const clearSelection = () => {
  27791. store.clearSelection();
  27792. };
  27793. const clearFilter = (columnKeys) => {
  27794. store.clearFilter(columnKeys);
  27795. };
  27796. const toggleAllSelection = () => {
  27797. store.commit("toggleAllSelection");
  27798. };
  27799. const toggleRowExpansion = (row, expanded) => {
  27800. store.toggleRowExpansionAdapter(row, expanded);
  27801. };
  27802. const clearSort = () => {
  27803. store.clearSort();
  27804. };
  27805. const sort = (prop, order2) => {
  27806. store.commit("sort", { prop, order: order2 });
  27807. };
  27808. return {
  27809. setCurrentRow,
  27810. getSelectionRows,
  27811. toggleRowSelection,
  27812. clearSelection,
  27813. clearFilter,
  27814. toggleAllSelection,
  27815. toggleRowExpansion,
  27816. clearSort,
  27817. sort
  27818. };
  27819. }
  27820. function useStyle(props, layout2, store, table) {
  27821. const isHidden = ref(false);
  27822. const renderExpanded = ref(null);
  27823. const resizeProxyVisible = ref(false);
  27824. const setDragVisible = (visible) => {
  27825. resizeProxyVisible.value = visible;
  27826. };
  27827. const resizeState = ref({
  27828. width: null,
  27829. height: null
  27830. });
  27831. const isGroup = ref(false);
  27832. const scrollbarViewStyle = {
  27833. display: "inline-block",
  27834. verticalAlign: "middle"
  27835. };
  27836. const tableWidth = ref();
  27837. watchEffect(() => {
  27838. layout2.setHeight(props.height);
  27839. });
  27840. watchEffect(() => {
  27841. layout2.setMaxHeight(props.maxHeight);
  27842. });
  27843. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  27844. if (!unref(rowKey))
  27845. return;
  27846. store.setCurrentRowKey(`${currentRowKey}`);
  27847. }, {
  27848. immediate: true
  27849. });
  27850. watch(() => props.data, (data2) => {
  27851. table.store.commit("setData", data2);
  27852. }, {
  27853. immediate: true,
  27854. deep: true
  27855. });
  27856. watchEffect(() => {
  27857. if (props.expandRowKeys) {
  27858. store.setExpandRowKeysAdapter(props.expandRowKeys);
  27859. }
  27860. });
  27861. const handleMouseLeave = () => {
  27862. table.store.commit("setHoverRow", null);
  27863. if (table.hoverState)
  27864. table.hoverState = null;
  27865. };
  27866. const handleHeaderFooterMousewheel = (event, data2) => {
  27867. const { pixelX, pixelY } = data2;
  27868. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  27869. table.refs.bodyWrapper.scrollLeft += data2.pixelX / 5;
  27870. }
  27871. };
  27872. const shouldUpdateHeight = computed(() => {
  27873. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  27874. });
  27875. const tableBodyStyles = computed(() => {
  27876. return {
  27877. width: layout2.bodyWidth.value ? `${layout2.bodyWidth.value}px` : ""
  27878. };
  27879. });
  27880. const doLayout = () => {
  27881. if (shouldUpdateHeight.value) {
  27882. layout2.updateElsHeight();
  27883. }
  27884. layout2.updateColumnsWidth();
  27885. requestAnimationFrame(syncPostion);
  27886. };
  27887. onMounted(async () => {
  27888. await nextTick();
  27889. store.updateColumns();
  27890. bindEvents();
  27891. requestAnimationFrame(doLayout);
  27892. resizeState.value = {
  27893. width: tableWidth.value = table.vnode.el.offsetWidth,
  27894. height: table.vnode.el.offsetHeight
  27895. };
  27896. store.states.columns.value.forEach((column) => {
  27897. if (column.filteredValue && column.filteredValue.length) {
  27898. table.store.commit("filterChange", {
  27899. column,
  27900. values: column.filteredValue,
  27901. silent: true
  27902. });
  27903. }
  27904. });
  27905. table.$ready = true;
  27906. });
  27907. const setScrollClassByEl = (el, className) => {
  27908. if (!el)
  27909. return;
  27910. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  27911. classList.push(layout2.scrollX.value ? className : "is-scrolling-none");
  27912. el.className = classList.join(" ");
  27913. };
  27914. const setScrollClass = (className) => {
  27915. const { tableWrapper } = table.refs;
  27916. setScrollClassByEl(tableWrapper, className);
  27917. };
  27918. const hasScrollClass = (className) => {
  27919. const { tableWrapper } = table.refs;
  27920. if (tableWrapper && tableWrapper.classList.contains(className)) {
  27921. return true;
  27922. }
  27923. return false;
  27924. };
  27925. const syncPostion = function() {
  27926. if (!table.refs.scrollBarRef)
  27927. return;
  27928. if (!layout2.scrollX.value) {
  27929. const scrollingNoneClass = "is-scrolling-none";
  27930. if (!hasScrollClass(scrollingNoneClass)) {
  27931. setScrollClass(scrollingNoneClass);
  27932. }
  27933. return;
  27934. }
  27935. const scrollContainer = table.refs.scrollBarRef.wrap$;
  27936. if (!scrollContainer)
  27937. return;
  27938. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  27939. const { headerWrapper, footerWrapper } = table.refs;
  27940. if (headerWrapper)
  27941. headerWrapper.scrollLeft = scrollLeft;
  27942. if (footerWrapper)
  27943. footerWrapper.scrollLeft = scrollLeft;
  27944. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  27945. if (scrollLeft >= maxScrollLeftPosition) {
  27946. setScrollClass("is-scrolling-right");
  27947. } else if (scrollLeft === 0) {
  27948. setScrollClass("is-scrolling-left");
  27949. } else {
  27950. setScrollClass("is-scrolling-middle");
  27951. }
  27952. };
  27953. const bindEvents = () => {
  27954. var _a2;
  27955. if (!table.refs.scrollBarRef)
  27956. return;
  27957. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.addEventListener("scroll", syncPostion, {
  27958. passive: true
  27959. });
  27960. if (props.fit) {
  27961. addResizeListener(table.vnode.el, resizeListener);
  27962. } else {
  27963. on(window, "resize", doLayout);
  27964. }
  27965. };
  27966. onBeforeUnmount(() => {
  27967. unbindEvents();
  27968. });
  27969. const unbindEvents = () => {
  27970. var _a2;
  27971. (_a2 = table.refs.scrollBarRef.wrap$) == null ? void 0 : _a2.removeEventListener("scroll", syncPostion, true);
  27972. if (props.fit) {
  27973. removeResizeListener(table.vnode.el, resizeListener);
  27974. } else {
  27975. off(window, "resize", doLayout);
  27976. }
  27977. };
  27978. const resizeListener = () => {
  27979. if (!table.$ready)
  27980. return;
  27981. let shouldUpdateLayout = false;
  27982. const el = table.vnode.el;
  27983. const { width: oldWidth, height: oldHeight } = resizeState.value;
  27984. const width = tableWidth.value = el.offsetWidth;
  27985. if (oldWidth !== width) {
  27986. shouldUpdateLayout = true;
  27987. }
  27988. const height2 = el.offsetHeight;
  27989. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height2) {
  27990. shouldUpdateLayout = true;
  27991. }
  27992. if (shouldUpdateLayout) {
  27993. resizeState.value = {
  27994. width,
  27995. height: height2
  27996. };
  27997. doLayout();
  27998. }
  27999. };
  28000. const tableSize = useSize();
  28001. const bodyWidth = computed(() => {
  28002. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout2;
  28003. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  28004. });
  28005. const tableLayout = computed(() => {
  28006. if (props.maxHeight)
  28007. return "fixed";
  28008. return props.tableLayout;
  28009. });
  28010. function calcMaxHeight(maxHeight, footerHeight, headerHeight) {
  28011. const parsedMaxHeight = parseHeight(maxHeight);
  28012. const tableHeaderHeight = props.showHeader ? headerHeight : 0;
  28013. if (parsedMaxHeight === null)
  28014. return;
  28015. if (isString(parsedMaxHeight)) {
  28016. return `calc(${parsedMaxHeight} - ${footerHeight}px - ${tableHeaderHeight}px)`;
  28017. }
  28018. return parsedMaxHeight - footerHeight - tableHeaderHeight;
  28019. }
  28020. const height = computed(() => {
  28021. const headerHeight = layout2.headerHeight.value || 0;
  28022. const bodyHeight2 = layout2.bodyHeight.value;
  28023. const footerHeight = layout2.footerHeight.value || 0;
  28024. if (props.height) {
  28025. return bodyHeight2 ? bodyHeight2 : void 0;
  28026. } else if (props.maxHeight) {
  28027. return calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  28028. }
  28029. return void 0;
  28030. });
  28031. const bodyHeight = computed(() => {
  28032. const headerHeight = layout2.headerHeight.value || 0;
  28033. const bodyHeight2 = layout2.bodyHeight.value;
  28034. const footerHeight = layout2.footerHeight.value || 0;
  28035. if (props.height) {
  28036. return {
  28037. height: bodyHeight2 ? `${bodyHeight2}px` : ""
  28038. };
  28039. } else if (props.maxHeight) {
  28040. const maxHeight = calcMaxHeight(props.maxHeight, footerHeight, headerHeight);
  28041. if (maxHeight !== null) {
  28042. return {
  28043. "max-height": `${maxHeight}${isNumber(maxHeight) ? "px" : ""}`
  28044. };
  28045. }
  28046. }
  28047. return {};
  28048. });
  28049. const emptyBlockStyle = computed(() => {
  28050. if (props.data && props.data.length)
  28051. return null;
  28052. let height2 = "100%";
  28053. if (layout2.appendHeight.value) {
  28054. height2 = `calc(100% - ${layout2.appendHeight.value}px)`;
  28055. }
  28056. return {
  28057. width: tableWidth.value ? `${tableWidth.value}px` : "",
  28058. height: height2
  28059. };
  28060. });
  28061. const handleFixedMousewheel = (event, data2) => {
  28062. const bodyWrapper = table.refs.bodyWrapper;
  28063. if (Math.abs(data2.spinY) > 0) {
  28064. const currentScrollTop = bodyWrapper.scrollTop;
  28065. if (data2.pixelY < 0 && currentScrollTop !== 0) {
  28066. event.preventDefault();
  28067. }
  28068. if (data2.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  28069. event.preventDefault();
  28070. }
  28071. bodyWrapper.scrollTop += Math.ceil(data2.pixelY / 5);
  28072. } else {
  28073. bodyWrapper.scrollLeft += Math.ceil(data2.pixelX / 5);
  28074. }
  28075. };
  28076. const fixedHeight = computed(() => {
  28077. if (props.maxHeight) {
  28078. if (props.showSummary) {
  28079. return {
  28080. bottom: 0
  28081. };
  28082. }
  28083. return {
  28084. bottom: layout2.scrollX.value && props.data.length ? `${layout2.gutterWidth}px` : ""
  28085. };
  28086. } else {
  28087. if (props.showSummary) {
  28088. return {
  28089. height: layout2.tableHeight.value ? `${layout2.tableHeight.value}px` : ""
  28090. };
  28091. }
  28092. return {
  28093. height: layout2.viewportHeight.value ? `${layout2.viewportHeight.value}px` : ""
  28094. };
  28095. }
  28096. });
  28097. const fixedBodyHeight = computed(() => {
  28098. if (props.height) {
  28099. return {
  28100. height: layout2.fixedBodyHeight.value ? `${layout2.fixedBodyHeight.value}px` : ""
  28101. };
  28102. } else if (props.maxHeight) {
  28103. let maxHeight = parseHeight(props.maxHeight);
  28104. if (typeof maxHeight === "number") {
  28105. maxHeight = layout2.scrollX.value ? maxHeight - layout2.gutterWidth : maxHeight;
  28106. if (props.showHeader) {
  28107. maxHeight -= layout2.headerHeight.value;
  28108. }
  28109. maxHeight -= layout2.footerHeight.value;
  28110. return {
  28111. "max-height": `${maxHeight}px`
  28112. };
  28113. }
  28114. }
  28115. return {};
  28116. });
  28117. return {
  28118. isHidden,
  28119. renderExpanded,
  28120. setDragVisible,
  28121. isGroup,
  28122. handleMouseLeave,
  28123. handleHeaderFooterMousewheel,
  28124. tableSize,
  28125. bodyHeight,
  28126. height,
  28127. emptyBlockStyle,
  28128. handleFixedMousewheel,
  28129. fixedHeight,
  28130. fixedBodyHeight,
  28131. resizeProxyVisible,
  28132. bodyWidth,
  28133. resizeState,
  28134. doLayout,
  28135. tableBodyStyles,
  28136. tableLayout,
  28137. scrollbarViewStyle
  28138. };
  28139. }
  28140. var defaultProps$1 = {
  28141. data: {
  28142. type: Array,
  28143. default: () => {
  28144. return [];
  28145. }
  28146. },
  28147. size: String,
  28148. width: [String, Number],
  28149. height: [String, Number],
  28150. maxHeight: [String, Number],
  28151. fit: {
  28152. type: Boolean,
  28153. default: true
  28154. },
  28155. stripe: Boolean,
  28156. border: Boolean,
  28157. rowKey: [String, Function],
  28158. showHeader: {
  28159. type: Boolean,
  28160. default: true
  28161. },
  28162. showSummary: Boolean,
  28163. sumText: String,
  28164. summaryMethod: Function,
  28165. rowClassName: [String, Function],
  28166. rowStyle: [Object, Function],
  28167. cellClassName: [String, Function],
  28168. cellStyle: [Object, Function],
  28169. headerRowClassName: [String, Function],
  28170. headerRowStyle: [Object, Function],
  28171. headerCellClassName: [String, Function],
  28172. headerCellStyle: [Object, Function],
  28173. highlightCurrentRow: Boolean,
  28174. currentRowKey: [String, Number],
  28175. emptyText: String,
  28176. expandRowKeys: Array,
  28177. defaultExpandAll: Boolean,
  28178. defaultSort: Object,
  28179. tooltipEffect: String,
  28180. spanMethod: Function,
  28181. selectOnIndeterminate: {
  28182. type: Boolean,
  28183. default: true
  28184. },
  28185. indent: {
  28186. type: Number,
  28187. default: 16
  28188. },
  28189. treeProps: {
  28190. type: Object,
  28191. default: () => {
  28192. return {
  28193. hasChildren: "hasChildren",
  28194. children: "children"
  28195. };
  28196. }
  28197. },
  28198. lazy: Boolean,
  28199. load: Function,
  28200. style: {
  28201. type: Object,
  28202. default: () => ({})
  28203. },
  28204. className: {
  28205. type: String,
  28206. default: ""
  28207. },
  28208. tableLayout: {
  28209. type: String,
  28210. default: "fixed"
  28211. },
  28212. scrollbarAlwaysOn: {
  28213. type: Boolean,
  28214. default: false
  28215. }
  28216. };
  28217. const useScrollbar = () => {
  28218. const scrollBarRef = ref();
  28219. const scrollTo = (options, yCoord) => {
  28220. const scrollbar = scrollBarRef.value;
  28221. if (scrollbar) {
  28222. scrollbar.scrollTo(options, yCoord);
  28223. }
  28224. };
  28225. const setScrollPosition = (position, offset2) => {
  28226. const scrollbar = scrollBarRef.value;
  28227. if (scrollbar && isNumber(offset2) && ["Top", "Left"].includes(position)) {
  28228. scrollbar[`setScroll${position}`](offset2);
  28229. }
  28230. };
  28231. const setScrollTop = (top2) => setScrollPosition("Top", top2);
  28232. const setScrollLeft = (left2) => setScrollPosition("Left", left2);
  28233. return {
  28234. scrollBarRef,
  28235. scrollTo,
  28236. setScrollTop,
  28237. setScrollLeft
  28238. };
  28239. };
  28240. let tableIdSeed = 1;
  28241. const _sfc_main$e = defineComponent({
  28242. name: "ElTable",
  28243. directives: {
  28244. Mousewheel
  28245. },
  28246. components: {
  28247. TableHeader,
  28248. TableBody,
  28249. TableFooter,
  28250. ElScrollbar,
  28251. hColgroup
  28252. },
  28253. props: defaultProps$1,
  28254. emits: [
  28255. "select",
  28256. "select-all",
  28257. "selection-change",
  28258. "cell-mouse-enter",
  28259. "cell-mouse-leave",
  28260. "cell-contextmenu",
  28261. "cell-click",
  28262. "cell-dblclick",
  28263. "row-click",
  28264. "row-contextmenu",
  28265. "row-dblclick",
  28266. "header-click",
  28267. "header-contextmenu",
  28268. "sort-change",
  28269. "filter-change",
  28270. "current-change",
  28271. "header-dragend",
  28272. "expand-change"
  28273. ],
  28274. setup(props) {
  28275. const { t } = useLocale();
  28276. const ns = useNamespace("table");
  28277. const table = getCurrentInstance();
  28278. provide(TABLE_INJECTION_KEY, table);
  28279. const store = createStore(table, props);
  28280. table.store = store;
  28281. const layout2 = new TableLayout({
  28282. store: table.store,
  28283. table,
  28284. fit: props.fit,
  28285. showHeader: props.showHeader
  28286. });
  28287. table.layout = layout2;
  28288. const isEmpty3 = computed(() => (store.states.data.value || []).length === 0);
  28289. const {
  28290. setCurrentRow,
  28291. getSelectionRows,
  28292. toggleRowSelection,
  28293. clearSelection,
  28294. clearFilter,
  28295. toggleAllSelection,
  28296. toggleRowExpansion,
  28297. clearSort,
  28298. sort
  28299. } = useUtils(store);
  28300. const {
  28301. isHidden,
  28302. renderExpanded,
  28303. setDragVisible,
  28304. isGroup,
  28305. handleMouseLeave,
  28306. handleHeaderFooterMousewheel,
  28307. tableSize,
  28308. bodyHeight,
  28309. height,
  28310. emptyBlockStyle,
  28311. handleFixedMousewheel,
  28312. fixedHeight,
  28313. fixedBodyHeight,
  28314. resizeProxyVisible,
  28315. bodyWidth,
  28316. resizeState,
  28317. doLayout,
  28318. tableBodyStyles,
  28319. tableLayout,
  28320. scrollbarViewStyle
  28321. } = useStyle(props, layout2, store, table);
  28322. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar();
  28323. const debouncedUpdateLayout = debounce$1(doLayout, 50);
  28324. const tableId = `el-table_${tableIdSeed++}`;
  28325. table.tableId = tableId;
  28326. table.state = {
  28327. isGroup,
  28328. resizeState,
  28329. doLayout,
  28330. debouncedUpdateLayout
  28331. };
  28332. const computedSumText = computed(() => props.sumText || t("el.table.sumText"));
  28333. const computedEmptyText = computed(() => {
  28334. return props.emptyText || t("el.table.emptyText");
  28335. });
  28336. return {
  28337. ns,
  28338. layout: layout2,
  28339. store,
  28340. handleHeaderFooterMousewheel,
  28341. handleMouseLeave,
  28342. tableId,
  28343. tableSize,
  28344. isHidden,
  28345. isEmpty: isEmpty3,
  28346. renderExpanded,
  28347. resizeProxyVisible,
  28348. resizeState,
  28349. isGroup,
  28350. bodyWidth,
  28351. bodyHeight,
  28352. height,
  28353. tableBodyStyles,
  28354. emptyBlockStyle,
  28355. debouncedUpdateLayout,
  28356. handleFixedMousewheel,
  28357. fixedHeight,
  28358. fixedBodyHeight,
  28359. setCurrentRow,
  28360. getSelectionRows,
  28361. toggleRowSelection,
  28362. clearSelection,
  28363. clearFilter,
  28364. toggleAllSelection,
  28365. toggleRowExpansion,
  28366. clearSort,
  28367. doLayout,
  28368. sort,
  28369. t,
  28370. setDragVisible,
  28371. context: table,
  28372. computedSumText,
  28373. computedEmptyText,
  28374. tableLayout,
  28375. scrollbarViewStyle,
  28376. scrollBarRef,
  28377. scrollTo,
  28378. setScrollLeft,
  28379. setScrollTop
  28380. };
  28381. }
  28382. });
  28383. const _hoisted_1$b = ["data-prefix"];
  28384. const _hoisted_2$9 = {
  28385. ref: "hiddenColumns",
  28386. class: "hidden-columns"
  28387. };
  28388. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  28389. const _component_hColgroup = resolveComponent("hColgroup");
  28390. const _component_table_header = resolveComponent("table-header");
  28391. const _component_table_body = resolveComponent("table-body");
  28392. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  28393. const _component_table_footer = resolveComponent("table-footer");
  28394. const _directive_mousewheel = resolveDirective("mousewheel");
  28395. return openBlock(), createElementBlock("div", {
  28396. ref: "tableWrapper",
  28397. class: normalizeClass([
  28398. {
  28399. [_ctx.ns.m("fit")]: _ctx.fit,
  28400. [_ctx.ns.m("striped")]: _ctx.stripe,
  28401. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  28402. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  28403. [_ctx.ns.m("group")]: _ctx.isGroup,
  28404. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  28405. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  28406. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  28407. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  28408. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  28409. "has-footer": _ctx.showSummary
  28410. },
  28411. _ctx.ns.m(_ctx.tableSize),
  28412. _ctx.className,
  28413. _ctx.ns.b(),
  28414. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  28415. ]),
  28416. style: normalizeStyle(_ctx.style),
  28417. "data-prefix": _ctx.ns.namespace.value,
  28418. onMouseleave: _cache[0] || (_cache[0] = ($event) => _ctx.handleMouseLeave())
  28419. }, [
  28420. createElementVNode("div", {
  28421. class: normalizeClass(_ctx.ns.e("inner-wrapper"))
  28422. }, [
  28423. createElementVNode("div", _hoisted_2$9, [
  28424. renderSlot(_ctx.$slots, "default")
  28425. ], 512),
  28426. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  28427. key: 0,
  28428. ref: "headerWrapper",
  28429. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  28430. }, [
  28431. createElementVNode("table", {
  28432. ref: "tableHeader",
  28433. class: normalizeClass(_ctx.ns.e("header")),
  28434. style: normalizeStyle(_ctx.tableBodyStyles),
  28435. border: "0",
  28436. cellpadding: "0",
  28437. cellspacing: "0"
  28438. }, [
  28439. createVNode(_component_hColgroup, {
  28440. columns: _ctx.store.states.columns.value,
  28441. "table-layout": _ctx.tableLayout
  28442. }, null, 8, ["columns", "table-layout"]),
  28443. createVNode(_component_table_header, {
  28444. ref: "tableHeaderRef",
  28445. border: _ctx.border,
  28446. "default-sort": _ctx.defaultSort,
  28447. store: _ctx.store,
  28448. onSetDragVisible: _ctx.setDragVisible
  28449. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  28450. ], 6)
  28451. ], 2)), [
  28452. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  28453. ]) : createCommentVNode("v-if", true),
  28454. createElementVNode("div", {
  28455. ref: "bodyWrapper",
  28456. style: normalizeStyle(_ctx.bodyHeight),
  28457. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  28458. }, [
  28459. createVNode(_component_el_scrollbar, {
  28460. ref: "scrollBarRef",
  28461. height: _ctx.maxHeight ? void 0 : _ctx.height,
  28462. "max-height": _ctx.maxHeight ? _ctx.height : void 0,
  28463. "view-style": _ctx.scrollbarViewStyle,
  28464. always: _ctx.scrollbarAlwaysOn
  28465. }, {
  28466. default: withCtx(() => [
  28467. createElementVNode("table", {
  28468. ref: "tableBody",
  28469. class: normalizeClass(_ctx.ns.e("body")),
  28470. cellspacing: "0",
  28471. cellpadding: "0",
  28472. border: "0",
  28473. style: normalizeStyle({
  28474. width: _ctx.bodyWidth,
  28475. tableLayout: _ctx.tableLayout
  28476. })
  28477. }, [
  28478. createVNode(_component_hColgroup, {
  28479. columns: _ctx.store.states.columns.value,
  28480. "table-layout": _ctx.tableLayout
  28481. }, null, 8, ["columns", "table-layout"]),
  28482. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  28483. key: 0,
  28484. border: _ctx.border,
  28485. "default-sort": _ctx.defaultSort,
  28486. store: _ctx.store,
  28487. onSetDragVisible: _ctx.setDragVisible
  28488. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : createCommentVNode("v-if", true),
  28489. createVNode(_component_table_body, {
  28490. context: _ctx.context,
  28491. highlight: _ctx.highlightCurrentRow,
  28492. "row-class-name": _ctx.rowClassName,
  28493. "tooltip-effect": _ctx.tooltipEffect,
  28494. "row-style": _ctx.rowStyle,
  28495. store: _ctx.store,
  28496. stripe: _ctx.stripe
  28497. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "row-style", "store", "stripe"])
  28498. ], 6),
  28499. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  28500. key: 0,
  28501. ref: "emptyBlock",
  28502. style: normalizeStyle(_ctx.emptyBlockStyle),
  28503. class: normalizeClass(_ctx.ns.e("empty-block"))
  28504. }, [
  28505. createElementVNode("span", {
  28506. class: normalizeClass(_ctx.ns.e("empty-text"))
  28507. }, [
  28508. renderSlot(_ctx.$slots, "empty", {}, () => [
  28509. createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
  28510. ])
  28511. ], 2)
  28512. ], 6)) : createCommentVNode("v-if", true),
  28513. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  28514. key: 1,
  28515. ref: "appendWrapper",
  28516. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  28517. }, [
  28518. renderSlot(_ctx.$slots, "append")
  28519. ], 2)) : createCommentVNode("v-if", true)
  28520. ]),
  28521. _: 3
  28522. }, 8, ["height", "max-height", "view-style", "always"])
  28523. ], 6),
  28524. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  28525. key: 1,
  28526. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  28527. }, null, 2)) : createCommentVNode("v-if", true)
  28528. ], 2),
  28529. _ctx.showSummary ? withDirectives((openBlock(), createElementBlock("div", {
  28530. key: 0,
  28531. ref: "footerWrapper",
  28532. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  28533. }, [
  28534. createVNode(_component_table_footer, {
  28535. border: _ctx.border,
  28536. "default-sort": _ctx.defaultSort,
  28537. store: _ctx.store,
  28538. style: normalizeStyle(_ctx.tableBodyStyles),
  28539. "sum-text": _ctx.computedSumText,
  28540. "summary-method": _ctx.summaryMethod
  28541. }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"])
  28542. ], 2)), [
  28543. [vShow, !_ctx.isEmpty],
  28544. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  28545. ]) : createCommentVNode("v-if", true),
  28546. withDirectives(createElementVNode("div", {
  28547. ref: "resizeProxy",
  28548. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  28549. }, null, 2), [
  28550. [vShow, _ctx.resizeProxyVisible]
  28551. ])
  28552. ], 46, _hoisted_1$b);
  28553. }
  28554. var Table = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$2], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/table/src/table.vue"]]);
  28555. const defaultClassNames = {
  28556. selection: "table-column--selection",
  28557. expand: "table__expand-column"
  28558. };
  28559. const cellStarts = {
  28560. default: {
  28561. order: ""
  28562. },
  28563. selection: {
  28564. width: 48,
  28565. minWidth: 48,
  28566. realWidth: 48,
  28567. order: ""
  28568. },
  28569. expand: {
  28570. width: 48,
  28571. minWidth: 48,
  28572. realWidth: 48,
  28573. order: ""
  28574. },
  28575. index: {
  28576. width: 48,
  28577. minWidth: 48,
  28578. realWidth: 48,
  28579. order: ""
  28580. }
  28581. };
  28582. const getDefaultClassName = (type4) => {
  28583. return defaultClassNames[type4] || "";
  28584. };
  28585. const cellForced = {
  28586. selection: {
  28587. renderHeader({ store }) {
  28588. function isDisabled() {
  28589. return store.states.data.value && store.states.data.value.length === 0;
  28590. }
  28591. return h$1(ElCheckbox, {
  28592. disabled: isDisabled(),
  28593. size: store.states.tableSize.value,
  28594. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  28595. "onUpdate:modelValue": store.toggleAllSelection,
  28596. modelValue: store.states.isAllSelected.value
  28597. });
  28598. },
  28599. renderCell({
  28600. row,
  28601. column,
  28602. store,
  28603. $index
  28604. }) {
  28605. return h$1(ElCheckbox, {
  28606. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  28607. size: store.states.tableSize.value,
  28608. onChange: () => {
  28609. store.commit("rowSelectedChanged", row);
  28610. },
  28611. onClick: (event) => event.stopPropagation(),
  28612. modelValue: store.isSelected(row)
  28613. });
  28614. },
  28615. sortable: false,
  28616. resizable: false
  28617. },
  28618. index: {
  28619. renderHeader({ column }) {
  28620. return column.label || "#";
  28621. },
  28622. renderCell({
  28623. column,
  28624. $index
  28625. }) {
  28626. let i = $index + 1;
  28627. const index = column.index;
  28628. if (typeof index === "number") {
  28629. i = $index + index;
  28630. } else if (typeof index === "function") {
  28631. i = index($index);
  28632. }
  28633. return h$1("div", {}, [i]);
  28634. },
  28635. sortable: false
  28636. },
  28637. expand: {
  28638. renderHeader({ column }) {
  28639. return column.label || "";
  28640. },
  28641. renderCell({
  28642. row,
  28643. store,
  28644. expanded
  28645. }) {
  28646. const { ns } = store;
  28647. const classes = [ns.e("expand-icon")];
  28648. if (expanded) {
  28649. classes.push(ns.em("expand-icon", "expanded"));
  28650. }
  28651. const callback = function(e) {
  28652. e.stopPropagation();
  28653. store.toggleRowExpansion(row);
  28654. };
  28655. return h$1("div", {
  28656. class: classes,
  28657. onClick: callback
  28658. }, {
  28659. default: () => {
  28660. return [
  28661. h$1(ElIcon, null, {
  28662. default: () => {
  28663. return [h$1(arrowRight)];
  28664. }
  28665. })
  28666. ];
  28667. }
  28668. });
  28669. },
  28670. sortable: false,
  28671. resizable: false
  28672. }
  28673. };
  28674. function defaultRenderCell({
  28675. row,
  28676. column,
  28677. $index
  28678. }) {
  28679. var _a2;
  28680. const property = column.property;
  28681. const value = property && getProp(row, property).value;
  28682. if (column && column.formatter) {
  28683. return column.formatter(row, column, value, $index);
  28684. }
  28685. return ((_a2 = value == null ? void 0 : value.toString) == null ? void 0 : _a2.call(value)) || "";
  28686. }
  28687. function treeCellPrefix({
  28688. row,
  28689. treeNode,
  28690. store
  28691. }, createPlacehoder = false) {
  28692. const { ns } = store;
  28693. if (!treeNode) {
  28694. if (createPlacehoder) {
  28695. return [
  28696. h$1("span", {
  28697. class: ns.e("placeholder")
  28698. })
  28699. ];
  28700. }
  28701. return null;
  28702. }
  28703. const ele = [];
  28704. const callback = function(e) {
  28705. e.stopPropagation();
  28706. store.loadOrToggle(row);
  28707. };
  28708. if (treeNode.indent) {
  28709. ele.push(h$1("span", {
  28710. class: ns.e("indent"),
  28711. style: { "padding-left": `${treeNode.indent}px` }
  28712. }));
  28713. }
  28714. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  28715. const expandClasses = [
  28716. ns.e("expand-icon"),
  28717. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  28718. ];
  28719. let icon = arrowRight;
  28720. if (treeNode.loading) {
  28721. icon = loading;
  28722. }
  28723. ele.push(h$1("div", {
  28724. class: expandClasses,
  28725. onClick: callback
  28726. }, {
  28727. default: () => {
  28728. return [
  28729. h$1(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  28730. default: () => [h$1(icon)]
  28731. })
  28732. ];
  28733. }
  28734. }));
  28735. } else {
  28736. ele.push(h$1("span", {
  28737. class: ns.e("placeholder")
  28738. }));
  28739. }
  28740. return ele;
  28741. }
  28742. function getAllAliases(props, aliases) {
  28743. return props.reduce((prev, cur) => {
  28744. prev[cur] = cur;
  28745. return prev;
  28746. }, aliases);
  28747. }
  28748. function useWatcher(owner, props_) {
  28749. const instance = getCurrentInstance();
  28750. const registerComplexWatchers = () => {
  28751. const props = ["fixed"];
  28752. const aliases = {
  28753. realWidth: "width",
  28754. realMinWidth: "minWidth"
  28755. };
  28756. const allAliases = getAllAliases(props, aliases);
  28757. Object.keys(allAliases).forEach((key) => {
  28758. const columnKey = aliases[key];
  28759. if (hasOwn(props_, columnKey)) {
  28760. watch(() => props_[columnKey], (newVal) => {
  28761. let value = newVal;
  28762. if (columnKey === "width" && key === "realWidth") {
  28763. value = parseWidth(newVal);
  28764. }
  28765. if (columnKey === "minWidth" && key === "realMinWidth") {
  28766. value = parseMinWidth(newVal);
  28767. }
  28768. instance.columnConfig.value[columnKey] = value;
  28769. instance.columnConfig.value[key] = value;
  28770. const updateColumns = columnKey === "fixed";
  28771. owner.value.store.scheduleLayout(updateColumns);
  28772. });
  28773. }
  28774. });
  28775. };
  28776. const registerNormalWatchers = () => {
  28777. const props = [
  28778. "label",
  28779. "filters",
  28780. "filterMultiple",
  28781. "sortable",
  28782. "index",
  28783. "formatter",
  28784. "className",
  28785. "labelClassName",
  28786. "showOverflowTooltip"
  28787. ];
  28788. const aliases = {
  28789. property: "prop",
  28790. align: "realAlign",
  28791. headerAlign: "realHeaderAlign"
  28792. };
  28793. const allAliases = getAllAliases(props, aliases);
  28794. Object.keys(allAliases).forEach((key) => {
  28795. const columnKey = aliases[key];
  28796. if (hasOwn(props_, columnKey)) {
  28797. watch(() => props_[columnKey], (newVal) => {
  28798. instance.columnConfig.value[key] = newVal;
  28799. });
  28800. }
  28801. });
  28802. };
  28803. return {
  28804. registerComplexWatchers,
  28805. registerNormalWatchers
  28806. };
  28807. }
  28808. function useRender(props, slots, owner) {
  28809. const instance = getCurrentInstance();
  28810. const columnId = ref("");
  28811. const isSubColumn = ref(false);
  28812. const realAlign = ref();
  28813. const realHeaderAlign = ref();
  28814. const ns = useNamespace("table");
  28815. watchEffect(() => {
  28816. realAlign.value = props.align ? `is-${props.align}` : null;
  28817. realAlign.value;
  28818. });
  28819. watchEffect(() => {
  28820. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  28821. realHeaderAlign.value;
  28822. });
  28823. const columnOrTableParent = computed(() => {
  28824. let parent = instance.vnode.vParent || instance.parent;
  28825. while (parent && !parent.tableId && !parent.columnId) {
  28826. parent = parent.vnode.vParent || parent.parent;
  28827. }
  28828. return parent;
  28829. });
  28830. const hasTreeColumn = computed(() => {
  28831. const { store } = instance.parent;
  28832. if (!store)
  28833. return false;
  28834. const { treeData } = store.states;
  28835. const treeDataValue = treeData.value;
  28836. return treeDataValue && Object.keys(treeDataValue).length > 0;
  28837. });
  28838. const realWidth = ref(parseWidth(props.width));
  28839. const realMinWidth = ref(parseMinWidth(props.minWidth));
  28840. const setColumnWidth = (column) => {
  28841. if (realWidth.value)
  28842. column.width = realWidth.value;
  28843. if (realMinWidth.value) {
  28844. column.minWidth = realMinWidth.value;
  28845. }
  28846. if (!column.minWidth) {
  28847. column.minWidth = 80;
  28848. }
  28849. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  28850. return column;
  28851. };
  28852. const setColumnForcedProps = (column) => {
  28853. const type4 = column.type;
  28854. const source = cellForced[type4] || {};
  28855. Object.keys(source).forEach((prop) => {
  28856. const value = source[prop];
  28857. if (prop !== "className" && value !== void 0) {
  28858. column[prop] = value;
  28859. }
  28860. });
  28861. const className = getDefaultClassName(type4);
  28862. if (className) {
  28863. const forceClass = `${unref(ns.namespace)}-${className}`;
  28864. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  28865. }
  28866. return column;
  28867. };
  28868. const checkSubColumn = (children) => {
  28869. if (Array.isArray(children)) {
  28870. children.forEach((child) => check2(child));
  28871. } else {
  28872. check2(children);
  28873. }
  28874. function check2(item) {
  28875. var _a2;
  28876. if (((_a2 = item == null ? void 0 : item.type) == null ? void 0 : _a2.name) === "ElTableColumn") {
  28877. item.vParent = instance;
  28878. }
  28879. }
  28880. };
  28881. const setColumnRenders = (column) => {
  28882. if (props.renderHeader)
  28883. ;
  28884. else if (column.type !== "selection") {
  28885. column.renderHeader = (scope) => {
  28886. instance.columnConfig.value["label"];
  28887. const renderHeader = slots.header;
  28888. return renderHeader ? renderHeader(scope) : column.label;
  28889. };
  28890. }
  28891. let originRenderCell = column.renderCell;
  28892. const hasTreeColumnValue = hasTreeColumn.value;
  28893. if (column.type === "expand") {
  28894. column.renderCell = (data2) => h$1("div", {
  28895. class: "cell"
  28896. }, [originRenderCell(data2)]);
  28897. owner.value.renderExpanded = (data2) => {
  28898. return slots.default ? slots.default(data2) : slots.default;
  28899. };
  28900. } else {
  28901. originRenderCell = originRenderCell || defaultRenderCell;
  28902. column.renderCell = (data2) => {
  28903. let children = null;
  28904. if (slots.default) {
  28905. const vnodes = slots.default(data2);
  28906. children = vnodes.some((v2) => v2.type !== Comment) ? vnodes : originRenderCell(data2);
  28907. } else {
  28908. children = originRenderCell(data2);
  28909. }
  28910. const shouldCreatePlaceholder = hasTreeColumnValue && data2.cellIndex === 0;
  28911. const prefix = treeCellPrefix(data2, shouldCreatePlaceholder);
  28912. const props2 = {
  28913. class: "cell",
  28914. style: {}
  28915. };
  28916. if (column.showOverflowTooltip) {
  28917. props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
  28918. props2.style = {
  28919. width: `${(data2.column.realWidth || Number(data2.column.width)) - 1}px`
  28920. };
  28921. }
  28922. checkSubColumn(children);
  28923. return h$1("div", props2, [prefix, children]);
  28924. };
  28925. }
  28926. return column;
  28927. };
  28928. const getPropsData = (...propsKey) => {
  28929. return propsKey.reduce((prev, cur) => {
  28930. if (Array.isArray(cur)) {
  28931. cur.forEach((key) => {
  28932. prev[key] = props[key];
  28933. });
  28934. }
  28935. return prev;
  28936. }, {});
  28937. };
  28938. const getColumnElIndex = (children, child) => {
  28939. return Array.prototype.indexOf.call(children, child);
  28940. };
  28941. return {
  28942. columnId,
  28943. realAlign,
  28944. isSubColumn,
  28945. realHeaderAlign,
  28946. columnOrTableParent,
  28947. setColumnWidth,
  28948. setColumnForcedProps,
  28949. setColumnRenders,
  28950. getPropsData,
  28951. getColumnElIndex
  28952. };
  28953. }
  28954. var defaultProps = {
  28955. type: {
  28956. type: String,
  28957. default: "default"
  28958. },
  28959. label: String,
  28960. className: String,
  28961. labelClassName: String,
  28962. property: String,
  28963. prop: String,
  28964. width: {
  28965. type: [String, Number],
  28966. default: ""
  28967. },
  28968. minWidth: {
  28969. type: [String, Number],
  28970. default: ""
  28971. },
  28972. renderHeader: Function,
  28973. sortable: {
  28974. type: [Boolean, String],
  28975. default: false
  28976. },
  28977. sortMethod: Function,
  28978. sortBy: [String, Function, Array],
  28979. resizable: {
  28980. type: Boolean,
  28981. default: true
  28982. },
  28983. columnKey: String,
  28984. align: String,
  28985. headerAlign: String,
  28986. showTooltipWhenOverflow: Boolean,
  28987. showOverflowTooltip: Boolean,
  28988. fixed: [Boolean, String],
  28989. formatter: Function,
  28990. selectable: Function,
  28991. reserveSelection: Boolean,
  28992. filterMethod: Function,
  28993. filteredValue: Array,
  28994. filters: Array,
  28995. filterPlacement: String,
  28996. filterMultiple: {
  28997. type: Boolean,
  28998. default: true
  28999. },
  29000. index: [Number, Function],
  29001. sortOrders: {
  29002. type: Array,
  29003. default: () => {
  29004. return ["ascending", "descending", null];
  29005. },
  29006. validator: (val) => {
  29007. return val.every((order2) => ["ascending", "descending", null].includes(order2));
  29008. }
  29009. }
  29010. };
  29011. let columnIdSeed = 1;
  29012. var ElTableColumn$1 = defineComponent({
  29013. name: "ElTableColumn",
  29014. components: {
  29015. ElCheckbox
  29016. },
  29017. props: defaultProps,
  29018. setup(props, { slots }) {
  29019. const instance = getCurrentInstance();
  29020. const columnConfig = ref({});
  29021. const owner = computed(() => {
  29022. let parent2 = instance.parent;
  29023. while (parent2 && !parent2.tableId) {
  29024. parent2 = parent2.parent;
  29025. }
  29026. return parent2;
  29027. });
  29028. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  29029. const {
  29030. columnId,
  29031. isSubColumn,
  29032. realHeaderAlign,
  29033. columnOrTableParent,
  29034. setColumnWidth,
  29035. setColumnForcedProps,
  29036. setColumnRenders,
  29037. getPropsData,
  29038. getColumnElIndex,
  29039. realAlign
  29040. } = useRender(props, slots, owner);
  29041. const parent = columnOrTableParent.value;
  29042. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  29043. onBeforeMount(() => {
  29044. isSubColumn.value = owner.value !== parent;
  29045. const type4 = props.type || "default";
  29046. const sortable = props.sortable === "" ? true : props.sortable;
  29047. const defaults = __spreadProps(__spreadValues({}, cellStarts[type4]), {
  29048. id: columnId.value,
  29049. type: type4,
  29050. property: props.prop || props.property,
  29051. align: realAlign,
  29052. headerAlign: realHeaderAlign,
  29053. showOverflowTooltip: props.showOverflowTooltip || props.showTooltipWhenOverflow,
  29054. filterable: props.filters || props.filterMethod,
  29055. filteredValue: [],
  29056. filterPlacement: "",
  29057. isColumnGroup: false,
  29058. isSubColumn: false,
  29059. filterOpened: false,
  29060. sortable,
  29061. index: props.index,
  29062. rawColumnKey: instance.vnode.key
  29063. });
  29064. const basicProps = [
  29065. "columnKey",
  29066. "label",
  29067. "className",
  29068. "labelClassName",
  29069. "type",
  29070. "renderHeader",
  29071. "formatter",
  29072. "fixed",
  29073. "resizable"
  29074. ];
  29075. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  29076. const selectProps = ["selectable", "reserveSelection"];
  29077. const filterProps = [
  29078. "filterMethod",
  29079. "filters",
  29080. "filterMultiple",
  29081. "filterOpened",
  29082. "filteredValue",
  29083. "filterPlacement"
  29084. ];
  29085. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  29086. column = mergeOptions(defaults, column);
  29087. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  29088. column = chains(column);
  29089. columnConfig.value = column;
  29090. registerNormalWatchers();
  29091. registerComplexWatchers();
  29092. });
  29093. onMounted(() => {
  29094. var _a2;
  29095. const parent2 = columnOrTableParent.value;
  29096. const children = isSubColumn.value ? parent2.vnode.el.children : (_a2 = parent2.refs.hiddenColumns) == null ? void 0 : _a2.children;
  29097. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  29098. columnConfig.value.getColumnIndex = getColumnIndex;
  29099. const columnIndex = getColumnIndex();
  29100. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null);
  29101. });
  29102. onBeforeUnmount(() => {
  29103. owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null);
  29104. });
  29105. instance.columnId = columnId.value;
  29106. instance.columnConfig = columnConfig;
  29107. return;
  29108. },
  29109. render() {
  29110. var _a2, _b2, _c;
  29111. try {
  29112. const renderDefault = (_b2 = (_a2 = this.$slots).default) == null ? void 0 : _b2.call(_a2, {
  29113. row: {},
  29114. column: {},
  29115. $index: -1
  29116. });
  29117. const children = [];
  29118. if (Array.isArray(renderDefault)) {
  29119. for (const childNode of renderDefault) {
  29120. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  29121. children.push(childNode);
  29122. } else if (childNode.type === Fragment && Array.isArray(childNode.children)) {
  29123. childNode.children.forEach((vnode2) => {
  29124. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) {
  29125. children.push(vnode2);
  29126. }
  29127. });
  29128. }
  29129. }
  29130. }
  29131. const vnode = h$1("div", children);
  29132. return vnode;
  29133. } catch (e) {
  29134. return h$1("div", []);
  29135. }
  29136. }
  29137. });
  29138. const ElTable = withInstall(Table, {
  29139. TableColumn: ElTableColumn$1
  29140. });
  29141. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  29142. const SCOPE$1 = "ElUpload";
  29143. class UploadAjaxError extends Error {
  29144. constructor(message, status, method4, url2) {
  29145. super(message);
  29146. this.name = "UploadAjaxError";
  29147. this.status = status;
  29148. this.method = method4;
  29149. this.url = url2;
  29150. }
  29151. }
  29152. function getError(action, option, xhr) {
  29153. let msg;
  29154. if (xhr.response) {
  29155. msg = `${xhr.response.error || xhr.response}`;
  29156. } else if (xhr.responseText) {
  29157. msg = `${xhr.responseText}`;
  29158. } else {
  29159. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  29160. }
  29161. return new UploadAjaxError(msg, xhr.status, option.method, action);
  29162. }
  29163. function getBody(xhr) {
  29164. const text = xhr.responseText || xhr.response;
  29165. if (!text) {
  29166. return text;
  29167. }
  29168. try {
  29169. return JSON.parse(text);
  29170. } catch (e) {
  29171. return text;
  29172. }
  29173. }
  29174. const ajaxUpload = (option) => {
  29175. if (typeof XMLHttpRequest === "undefined")
  29176. throwError(SCOPE$1, "XMLHttpRequest is undefined");
  29177. const xhr = new XMLHttpRequest();
  29178. const action = option.action;
  29179. if (xhr.upload) {
  29180. xhr.upload.addEventListener("progress", (evt) => {
  29181. const progressEvt = evt;
  29182. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  29183. option.onProgress(progressEvt);
  29184. });
  29185. }
  29186. const formData = new FormData();
  29187. if (option.data) {
  29188. for (const [key, value] of Object.entries(option.data)) {
  29189. if (Array.isArray(value))
  29190. formData.append(key, ...value);
  29191. else
  29192. formData.append(key, value);
  29193. }
  29194. }
  29195. formData.append(option.filename, option.file, option.file.name);
  29196. xhr.addEventListener("error", () => {
  29197. option.onError(getError(action, option, xhr));
  29198. });
  29199. xhr.addEventListener("load", () => {
  29200. if (xhr.status < 200 || xhr.status >= 300) {
  29201. return option.onError(getError(action, option, xhr));
  29202. }
  29203. option.onSuccess(getBody(xhr));
  29204. });
  29205. xhr.open(option.method, action, true);
  29206. if (option.withCredentials && "withCredentials" in xhr) {
  29207. xhr.withCredentials = true;
  29208. }
  29209. const headers = option.headers || {};
  29210. if (headers instanceof Headers) {
  29211. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  29212. } else {
  29213. for (const [key, value] of Object.entries(headers)) {
  29214. if (isNil(value))
  29215. continue;
  29216. xhr.setRequestHeader(key, String(value));
  29217. }
  29218. }
  29219. xhr.send(formData);
  29220. return xhr;
  29221. };
  29222. const uploadListTypes = ["text", "picture", "picture-card"];
  29223. let fileId = 1;
  29224. const genFileId = () => Date.now() + fileId++;
  29225. const uploadBaseProps = buildProps({
  29226. action: {
  29227. type: String,
  29228. required: true
  29229. },
  29230. headers: {
  29231. type: definePropType(Object)
  29232. },
  29233. method: {
  29234. type: String,
  29235. default: "post"
  29236. },
  29237. data: {
  29238. type: Object,
  29239. default: () => mutable({})
  29240. },
  29241. multiple: {
  29242. type: Boolean,
  29243. default: false
  29244. },
  29245. name: {
  29246. type: String,
  29247. default: "file"
  29248. },
  29249. drag: {
  29250. type: Boolean,
  29251. default: false
  29252. },
  29253. withCredentials: Boolean,
  29254. showFileList: {
  29255. type: Boolean,
  29256. default: true
  29257. },
  29258. accept: {
  29259. type: String,
  29260. default: ""
  29261. },
  29262. type: {
  29263. type: String,
  29264. default: "select"
  29265. },
  29266. fileList: {
  29267. type: definePropType(Array),
  29268. default: () => mutable([])
  29269. },
  29270. autoUpload: {
  29271. type: Boolean,
  29272. default: true
  29273. },
  29274. listType: {
  29275. type: String,
  29276. values: uploadListTypes,
  29277. default: "text"
  29278. },
  29279. httpRequest: {
  29280. type: definePropType(Function),
  29281. default: ajaxUpload
  29282. },
  29283. disabled: Boolean,
  29284. limit: Number
  29285. });
  29286. const uploadProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  29287. beforeUpload: {
  29288. type: definePropType(Function),
  29289. default: NOOP
  29290. },
  29291. beforeRemove: {
  29292. type: definePropType(Function)
  29293. },
  29294. onRemove: {
  29295. type: definePropType(Function),
  29296. default: NOOP
  29297. },
  29298. onChange: {
  29299. type: definePropType(Function),
  29300. default: NOOP
  29301. },
  29302. onPreview: {
  29303. type: definePropType(Function),
  29304. default: NOOP
  29305. },
  29306. onSuccess: {
  29307. type: definePropType(Function),
  29308. default: NOOP
  29309. },
  29310. onProgress: {
  29311. type: definePropType(Function),
  29312. default: NOOP
  29313. },
  29314. onError: {
  29315. type: definePropType(Function),
  29316. default: NOOP
  29317. },
  29318. onExceed: {
  29319. type: definePropType(Function),
  29320. default: NOOP
  29321. }
  29322. }));
  29323. const uploadListProps = buildProps({
  29324. files: {
  29325. type: definePropType(Array),
  29326. default: () => mutable([])
  29327. },
  29328. disabled: {
  29329. type: Boolean,
  29330. default: false
  29331. },
  29332. handlePreview: {
  29333. type: definePropType(Function),
  29334. default: NOOP
  29335. },
  29336. listType: {
  29337. type: String,
  29338. values: uploadListTypes,
  29339. default: "text"
  29340. }
  29341. });
  29342. const uploadListEmits = {
  29343. remove: (file) => !!file
  29344. };
  29345. const _hoisted_1$a = ["onKeydown"];
  29346. const _hoisted_2$8 = ["src"];
  29347. const _hoisted_3$6 = ["onClick"];
  29348. const _hoisted_4$6 = ["onClick"];
  29349. const _hoisted_5$6 = ["onClick"];
  29350. const __default__$4 = {
  29351. name: "ElUploadList"
  29352. };
  29353. const _sfc_main$d = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
  29354. props: uploadListProps,
  29355. emits: uploadListEmits,
  29356. setup(__props, { emit }) {
  29357. const props = __props;
  29358. const { t } = useLocale();
  29359. const nsUpload = useNamespace("upload");
  29360. const nsIcon = useNamespace("icon");
  29361. const nsList = useNamespace("list");
  29362. const focusing = ref(false);
  29363. const handleClick = (file) => {
  29364. props.handlePreview(file);
  29365. };
  29366. const onFileClicked = (e) => {
  29367. e.target.focus();
  29368. };
  29369. const handleRemove = (file) => {
  29370. emit("remove", file);
  29371. };
  29372. return (_ctx, _cache) => {
  29373. return openBlock(), createBlock(TransitionGroup, {
  29374. tag: "ul",
  29375. class: normalizeClass([
  29376. unref(nsUpload).b("list"),
  29377. unref(nsUpload).bm("list", _ctx.listType),
  29378. unref(nsUpload).is("disabled", _ctx.disabled)
  29379. ]),
  29380. name: unref(nsList).b()
  29381. }, {
  29382. default: withCtx(() => [
  29383. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file) => {
  29384. return openBlock(), createElementBlock("li", {
  29385. key: file.uid || file.name,
  29386. class: normalizeClass([
  29387. unref(nsUpload).be("list", "item"),
  29388. unref(nsUpload).is(file.status),
  29389. { focusing: focusing.value }
  29390. ]),
  29391. tabindex: "0",
  29392. onKeydown: withKeys(($event) => !_ctx.disabled && handleRemove(file), ["delete"]),
  29393. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  29394. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  29395. onClick: onFileClicked
  29396. }, [
  29397. renderSlot(_ctx.$slots, "default", { file }, () => [
  29398. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  29399. key: 0,
  29400. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  29401. src: file.url,
  29402. alt: ""
  29403. }, null, 10, _hoisted_2$8)) : createCommentVNode("v-if", true),
  29404. _ctx.listType !== "picture" && (file.status === "uploading" || _ctx.listType !== "picture-card") ? (openBlock(), createElementBlock("div", {
  29405. key: 1,
  29406. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  29407. }, [
  29408. createElementVNode("a", {
  29409. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  29410. onClick: ($event) => handleClick(file)
  29411. }, [
  29412. createVNode(unref(ElIcon), {
  29413. class: normalizeClass(unref(nsIcon).m("document"))
  29414. }, {
  29415. default: withCtx(() => [
  29416. createVNode(unref(document$1))
  29417. ]),
  29418. _: 1
  29419. }, 8, ["class"]),
  29420. createTextVNode(" " + toDisplayString(file.name), 1)
  29421. ], 10, _hoisted_3$6),
  29422. file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  29423. key: 0,
  29424. type: _ctx.listType === "picture-card" ? "circle" : "line",
  29425. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  29426. percentage: Number(file.percentage),
  29427. style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  29428. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
  29429. ], 2)) : createCommentVNode("v-if", true),
  29430. createElementVNode("label", {
  29431. class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
  29432. }, [
  29433. _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  29434. key: 0,
  29435. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  29436. }, {
  29437. default: withCtx(() => [
  29438. createVNode(unref(circleCheck))
  29439. ]),
  29440. _: 1
  29441. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  29442. key: 1,
  29443. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  29444. }, {
  29445. default: withCtx(() => [
  29446. createVNode(unref(check))
  29447. ]),
  29448. _: 1
  29449. }, 8, ["class"])) : createCommentVNode("v-if", true)
  29450. ], 2),
  29451. !_ctx.disabled ? (openBlock(), createBlock(unref(ElIcon), {
  29452. key: 2,
  29453. class: normalizeClass(unref(nsIcon).m("close")),
  29454. onClick: ($event) => handleRemove(file)
  29455. }, {
  29456. default: withCtx(() => [
  29457. createVNode(unref(close))
  29458. ]),
  29459. _: 2
  29460. }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
  29461. createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  29462. createCommentVNode(" This is a bug which needs to be fixed "),
  29463. createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  29464. !_ctx.disabled ? (openBlock(), createElementBlock("i", {
  29465. key: 3,
  29466. class: normalizeClass(unref(nsIcon).m("close-tip"))
  29467. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  29468. _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  29469. key: 4,
  29470. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  29471. }, [
  29472. createElementVNode("span", {
  29473. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  29474. onClick: ($event) => _ctx.handlePreview(file)
  29475. }, [
  29476. createVNode(unref(ElIcon), {
  29477. class: normalizeClass(unref(nsIcon).m("zoom-in"))
  29478. }, {
  29479. default: withCtx(() => [
  29480. createVNode(unref(zoomIn))
  29481. ]),
  29482. _: 1
  29483. }, 8, ["class"])
  29484. ], 10, _hoisted_4$6),
  29485. !_ctx.disabled ? (openBlock(), createElementBlock("span", {
  29486. key: 0,
  29487. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  29488. onClick: ($event) => handleRemove(file)
  29489. }, [
  29490. createVNode(unref(ElIcon), {
  29491. class: normalizeClass(unref(nsIcon).m("delete"))
  29492. }, {
  29493. default: withCtx(() => [
  29494. createVNode(unref(_delete))
  29495. ]),
  29496. _: 1
  29497. }, 8, ["class"])
  29498. ], 10, _hoisted_5$6)) : createCommentVNode("v-if", true)
  29499. ], 2)) : createCommentVNode("v-if", true)
  29500. ])
  29501. ], 42, _hoisted_1$a);
  29502. }), 128)),
  29503. renderSlot(_ctx.$slots, "append")
  29504. ]),
  29505. _: 3
  29506. }, 8, ["class", "name"]);
  29507. };
  29508. }
  29509. }));
  29510. var UploadList = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);
  29511. const uploadDraggerProps = buildProps({
  29512. disabled: {
  29513. type: Boolean,
  29514. default: false
  29515. }
  29516. });
  29517. const uploadDraggerEmits = {
  29518. file: (file) => isArray(file)
  29519. };
  29520. const _hoisted_1$9 = ["onDrop", "onDragover"];
  29521. const __default__$3 = {
  29522. name: "ElUploadDrag"
  29523. };
  29524. const _sfc_main$c = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
  29525. props: uploadDraggerProps,
  29526. emits: uploadDraggerEmits,
  29527. setup(__props, { emit }) {
  29528. const props = __props;
  29529. const COMPONENT_NAME2 = "ElUploadDrag";
  29530. const uploaderContext = inject(uploadContextKey);
  29531. if (!uploaderContext) {
  29532. throwError(COMPONENT_NAME2, "usage: <el-upload><el-upload-dragger /></el-upload>");
  29533. }
  29534. const ns = useNamespace("upload");
  29535. const dragover = ref(false);
  29536. const onDrop = (e) => {
  29537. if (props.disabled)
  29538. return;
  29539. dragover.value = false;
  29540. const files = Array.from(e.dataTransfer.files);
  29541. const accept = uploaderContext.accept.value;
  29542. if (!accept) {
  29543. emit("file", files);
  29544. return;
  29545. }
  29546. const filesFiltered = files.filter((file) => {
  29547. const { type: type4, name } = file;
  29548. const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
  29549. const baseType = type4.replace(/\/.*$/, "");
  29550. return accept.split(",").map((type22) => type22.trim()).filter((type22) => type22).some((acceptedType) => {
  29551. if (acceptedType.startsWith(".")) {
  29552. return extension === acceptedType;
  29553. }
  29554. if (/\/\*$/.test(acceptedType)) {
  29555. return baseType === acceptedType.replace(/\/\*$/, "");
  29556. }
  29557. if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
  29558. return type4 === acceptedType;
  29559. }
  29560. return false;
  29561. });
  29562. });
  29563. emit("file", filesFiltered);
  29564. };
  29565. const onDragover = () => {
  29566. if (!props.disabled)
  29567. dragover.value = true;
  29568. };
  29569. return (_ctx, _cache) => {
  29570. return openBlock(), createElementBlock("div", {
  29571. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  29572. onDrop: withModifiers(onDrop, ["prevent"]),
  29573. onDragover: withModifiers(onDragover, ["prevent"]),
  29574. onDragleave: _cache[0] || (_cache[0] = withModifiers(($event) => dragover.value = false, ["prevent"]))
  29575. }, [
  29576. renderSlot(_ctx.$slots, "default")
  29577. ], 42, _hoisted_1$9);
  29578. };
  29579. }
  29580. }));
  29581. var UploadDragger = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);
  29582. const uploadContentProps = buildProps(__spreadProps(__spreadValues({}, uploadBaseProps), {
  29583. fileList: {
  29584. type: definePropType(Array),
  29585. default: () => mutable([])
  29586. },
  29587. beforeUpload: {
  29588. type: definePropType(Function),
  29589. default: NOOP
  29590. },
  29591. onRemove: {
  29592. type: definePropType(Function),
  29593. default: NOOP
  29594. },
  29595. onStart: {
  29596. type: definePropType(Function),
  29597. default: NOOP
  29598. },
  29599. onSuccess: {
  29600. type: definePropType(Function),
  29601. default: NOOP
  29602. },
  29603. onProgress: {
  29604. type: definePropType(Function),
  29605. default: NOOP
  29606. },
  29607. onError: {
  29608. type: definePropType(Function),
  29609. default: NOOP
  29610. },
  29611. onExceed: {
  29612. type: definePropType(Function),
  29613. default: NOOP
  29614. }
  29615. }));
  29616. const _hoisted_1$8 = ["onKeydown"];
  29617. const _hoisted_2$7 = ["name", "multiple", "accept"];
  29618. const __default__$2 = {
  29619. name: "ElUploadContent",
  29620. inheritAttrs: false
  29621. };
  29622. const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
  29623. props: uploadContentProps,
  29624. setup(__props, { expose }) {
  29625. const props = __props;
  29626. const ns = useNamespace("upload");
  29627. const requests = shallowRef({});
  29628. const inputRef = shallowRef();
  29629. const uploadFiles = (files) => {
  29630. if (files.length === 0)
  29631. return;
  29632. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  29633. if (limit && fileList.length + files.length > limit) {
  29634. onExceed(files, fileList);
  29635. return;
  29636. }
  29637. if (!multiple) {
  29638. files = files.slice(0, 1);
  29639. }
  29640. for (const file of files) {
  29641. const rawFile = file;
  29642. rawFile.uid = genFileId();
  29643. onStart(rawFile);
  29644. if (autoUpload)
  29645. upload(rawFile);
  29646. }
  29647. };
  29648. const upload = async (rawFile) => {
  29649. inputRef.value.value = "";
  29650. if (!props.beforeUpload) {
  29651. return doUpload(rawFile);
  29652. }
  29653. let hookResult;
  29654. try {
  29655. hookResult = await props.beforeUpload(rawFile);
  29656. } catch (e) {
  29657. hookResult = false;
  29658. }
  29659. if (hookResult === false) {
  29660. props.onRemove(rawFile);
  29661. return;
  29662. }
  29663. let file = rawFile;
  29664. if (hookResult instanceof Blob) {
  29665. if (hookResult instanceof File) {
  29666. file = hookResult;
  29667. } else {
  29668. file = new File([hookResult], rawFile.name, {
  29669. type: rawFile.type
  29670. });
  29671. }
  29672. for (const key of Object.keys(rawFile)) {
  29673. file[key] = rawFile[key];
  29674. }
  29675. }
  29676. doUpload(rawFile);
  29677. };
  29678. const doUpload = (rawFile) => {
  29679. const {
  29680. headers,
  29681. data: data2,
  29682. method: method4,
  29683. withCredentials,
  29684. name: filename,
  29685. action,
  29686. onProgress,
  29687. onSuccess,
  29688. onError,
  29689. httpRequest
  29690. } = props;
  29691. const { uid: uid2 } = rawFile;
  29692. const options = {
  29693. headers: headers || {},
  29694. withCredentials,
  29695. file: rawFile,
  29696. data: data2,
  29697. method: method4,
  29698. filename,
  29699. action,
  29700. onProgress: (evt) => {
  29701. onProgress(evt, rawFile);
  29702. },
  29703. onSuccess: (res) => {
  29704. onSuccess(res, rawFile);
  29705. delete requests.value[uid2];
  29706. },
  29707. onError: (err) => {
  29708. onError(err, rawFile);
  29709. delete requests.value[uid2];
  29710. }
  29711. };
  29712. const request = httpRequest(options);
  29713. requests.value[uid2] = request;
  29714. if (request instanceof Promise) {
  29715. request.then(options.onSuccess, options.onError);
  29716. }
  29717. };
  29718. const handleChange2 = (e) => {
  29719. const files = e.target.files;
  29720. if (!files)
  29721. return;
  29722. uploadFiles(Array.from(files));
  29723. };
  29724. const handleClick = () => {
  29725. if (!props.disabled) {
  29726. inputRef.value.value = "";
  29727. inputRef.value.click();
  29728. }
  29729. };
  29730. const handleKeydown = () => {
  29731. handleClick();
  29732. };
  29733. const abort = (file) => {
  29734. const _reqs = entriesOf(requests.value).filter(file ? ([uid2]) => String(file.uid) === uid2 : () => true);
  29735. _reqs.forEach(([uid2, req]) => {
  29736. if (req instanceof XMLHttpRequest)
  29737. req.abort();
  29738. delete requests.value[uid2];
  29739. });
  29740. };
  29741. expose({
  29742. abort,
  29743. upload
  29744. });
  29745. return (_ctx, _cache) => {
  29746. return openBlock(), createElementBlock("div", {
  29747. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.listType)]),
  29748. tabindex: "0",
  29749. onClick: handleClick,
  29750. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  29751. }, [
  29752. _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
  29753. key: 0,
  29754. disabled: _ctx.disabled,
  29755. onFile: uploadFiles
  29756. }, {
  29757. default: withCtx(() => [
  29758. renderSlot(_ctx.$slots, "default")
  29759. ]),
  29760. _: 3
  29761. }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
  29762. createElementVNode("input", {
  29763. ref_key: "inputRef",
  29764. ref: inputRef,
  29765. class: normalizeClass(unref(ns).e("input")),
  29766. name: _ctx.name,
  29767. multiple: _ctx.multiple,
  29768. accept: _ctx.accept,
  29769. type: "file",
  29770. onChange: handleChange2
  29771. }, null, 42, _hoisted_2$7)
  29772. ], 42, _hoisted_1$8);
  29773. };
  29774. }
  29775. }));
  29776. var UploadContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);
  29777. const SCOPE = "ElUpload";
  29778. const revokeObjectURL = (file) => {
  29779. var _a2;
  29780. if ((_a2 = file.url) == null ? void 0 : _a2.startsWith("blob:")) {
  29781. URL.revokeObjectURL(file.url);
  29782. }
  29783. };
  29784. const useHandlers = (props, uploadRef) => {
  29785. const uploadFiles = ref([]);
  29786. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  29787. function abort(file) {
  29788. var _a2;
  29789. (_a2 = uploadRef.value) == null ? void 0 : _a2.abort(file);
  29790. }
  29791. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  29792. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  29793. }
  29794. const handleError = (err, rawFile) => {
  29795. const file = getFile(rawFile);
  29796. if (!file)
  29797. return;
  29798. file.status = "fail";
  29799. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  29800. props.onError(err, file, uploadFiles.value);
  29801. props.onChange(file, uploadFiles.value);
  29802. };
  29803. const handleProgress = (evt, rawFile) => {
  29804. const file = getFile(rawFile);
  29805. if (!file)
  29806. return;
  29807. props.onProgress(evt, file, uploadFiles.value);
  29808. file.status = "uploading";
  29809. file.percentage = Math.round(evt.percent);
  29810. };
  29811. const handleSuccess = (response, rawFile) => {
  29812. const file = getFile(rawFile);
  29813. if (!file)
  29814. return;
  29815. file.status = "success";
  29816. file.response = response;
  29817. props.onSuccess(response, file, uploadFiles.value);
  29818. props.onChange(file, uploadFiles.value);
  29819. };
  29820. const handleStart = (file) => {
  29821. const uploadFile = {
  29822. name: file.name,
  29823. percentage: 0,
  29824. status: "ready",
  29825. size: file.size,
  29826. raw: file,
  29827. uid: file.uid
  29828. };
  29829. if (props.listType === "picture-card" || props.listType === "picture") {
  29830. try {
  29831. uploadFile.url = URL.createObjectURL(file);
  29832. } catch (err) {
  29833. debugWarn(SCOPE, err.message);
  29834. props.onError(err, uploadFile, uploadFiles.value);
  29835. }
  29836. }
  29837. uploadFiles.value.push(uploadFile);
  29838. props.onChange(uploadFile, uploadFiles.value);
  29839. };
  29840. const handleRemove = async (file, rawFile) => {
  29841. if (rawFile) {
  29842. useDeprecated({
  29843. scope: SCOPE,
  29844. from: "handleRemove second argument",
  29845. version: "2.2",
  29846. replacement: "first argument `file`",
  29847. ref: "https://element-plus.org/en-US/component/upload.html#methods"
  29848. }, true);
  29849. }
  29850. const _file = rawFile || file;
  29851. const uploadFile = _file instanceof File ? getFile(_file) : _file;
  29852. if (!uploadFile)
  29853. throwError(SCOPE, "file to be removed not found");
  29854. const doRemove = (file2) => {
  29855. abort(file2);
  29856. const fileList = uploadFiles.value;
  29857. fileList.splice(fileList.indexOf(file2), 1);
  29858. props.onRemove(file2, fileList);
  29859. revokeObjectURL(file2);
  29860. };
  29861. if (props.beforeRemove) {
  29862. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  29863. if (before !== false)
  29864. doRemove(uploadFile);
  29865. } else {
  29866. doRemove(uploadFile);
  29867. }
  29868. };
  29869. function submit() {
  29870. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  29871. var _a2;
  29872. return raw && ((_a2 = uploadRef.value) == null ? void 0 : _a2.upload(raw));
  29873. });
  29874. }
  29875. watch(() => props.listType, (val) => {
  29876. if (val !== "picture-card" && val !== "picture") {
  29877. return;
  29878. }
  29879. uploadFiles.value = uploadFiles.value.map((file) => {
  29880. const { raw, url: url2 } = file;
  29881. if (!url2 && raw) {
  29882. try {
  29883. file.url = URL.createObjectURL(raw);
  29884. } catch (err) {
  29885. props.onError(err, file, uploadFiles.value);
  29886. }
  29887. }
  29888. return file;
  29889. });
  29890. });
  29891. watch(() => props.fileList, (fileList) => {
  29892. for (const file of fileList) {
  29893. file.uid || (file.uid = genFileId());
  29894. file.status || (file.status = "success");
  29895. }
  29896. uploadFiles.value = fileList;
  29897. }, { immediate: true, deep: true });
  29898. return {
  29899. abort,
  29900. clearFiles,
  29901. handleError,
  29902. handleProgress,
  29903. handleStart,
  29904. handleSuccess,
  29905. handleRemove,
  29906. submit,
  29907. uploadFiles
  29908. };
  29909. };
  29910. const __default__$1 = {
  29911. name: "ElUpload"
  29912. };
  29913. const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
  29914. props: uploadProps,
  29915. setup(__props, { expose }) {
  29916. const props = __props;
  29917. const slots = useSlots();
  29918. const disabled = useDisabled$1();
  29919. const uploadRef = shallowRef();
  29920. const {
  29921. abort,
  29922. submit,
  29923. clearFiles,
  29924. uploadFiles,
  29925. handleStart,
  29926. handleError,
  29927. handleRemove,
  29928. handleSuccess,
  29929. handleProgress
  29930. } = useHandlers(props, uploadRef);
  29931. const isPictureCard = computed(() => props.listType === "picture-card");
  29932. const uploadContentProps2 = computed(() => __spreadProps(__spreadValues({}, props), {
  29933. onStart: handleStart,
  29934. onProgress: handleProgress,
  29935. onSuccess: handleSuccess,
  29936. onError: handleError,
  29937. onRemove: handleRemove
  29938. }));
  29939. onBeforeUnmount(() => {
  29940. uploadFiles.value.forEach(({ url: url2 }) => {
  29941. if (url2 == null ? void 0 : url2.startsWith("blob:"))
  29942. URL.revokeObjectURL(url2);
  29943. });
  29944. });
  29945. provide(uploadContextKey, {
  29946. accept: toRef(props, "accept")
  29947. });
  29948. expose({
  29949. abort,
  29950. submit,
  29951. clearFiles,
  29952. handleStart,
  29953. handleRemove
  29954. });
  29955. return (_ctx, _cache) => {
  29956. return openBlock(), createElementBlock("div", null, [
  29957. unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  29958. key: 0,
  29959. disabled: unref(disabled),
  29960. "list-type": _ctx.listType,
  29961. files: unref(uploadFiles),
  29962. "handle-preview": _ctx.onPreview,
  29963. onRemove: unref(handleRemove)
  29964. }, createSlots({
  29965. append: withCtx(() => [
  29966. _ctx.listType === "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  29967. key: 0,
  29968. ref_key: "uploadRef",
  29969. ref: uploadRef
  29970. }, unref(uploadContentProps2)), {
  29971. default: withCtx(() => [
  29972. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  29973. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  29974. ]),
  29975. _: 3
  29976. }, 16)) : createCommentVNode("v-if", true)
  29977. ]),
  29978. _: 2
  29979. }, [
  29980. _ctx.$slots.file ? {
  29981. name: "default",
  29982. fn: withCtx(({ file }) => [
  29983. renderSlot(_ctx.$slots, "file", { file })
  29984. ])
  29985. } : void 0
  29986. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
  29987. _ctx.listType !== "picture-card" ? (openBlock(), createBlock(UploadContent, mergeProps({
  29988. key: 1,
  29989. ref_key: "uploadRef",
  29990. ref: uploadRef
  29991. }, unref(uploadContentProps2)), {
  29992. default: withCtx(() => [
  29993. unref(slots).trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  29994. !unref(slots).trigger && unref(slots).default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  29995. ]),
  29996. _: 3
  29997. }, 16)) : createCommentVNode("v-if", true),
  29998. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  29999. renderSlot(_ctx.$slots, "tip"),
  30000. !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  30001. key: 3,
  30002. disabled: unref(disabled),
  30003. "list-type": _ctx.listType,
  30004. files: unref(uploadFiles),
  30005. "handle-preview": _ctx.onPreview,
  30006. onRemove: unref(handleRemove)
  30007. }, createSlots({ _: 2 }, [
  30008. _ctx.$slots.file ? {
  30009. name: "default",
  30010. fn: withCtx(({ file }) => [
  30011. renderSlot(_ctx.$slots, "file", { file })
  30012. ])
  30013. } : void 0
  30014. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
  30015. ]);
  30016. };
  30017. }
  30018. }));
  30019. var Upload = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);
  30020. const ElUpload = withInstall(Upload);
  30021. var base = "";
  30022. var elDialog = "";
  30023. var elOverlay = "";
  30024. var elButton = "";
  30025. var elForm = "";
  30026. var elFormItem = "";
  30027. var elCascader = "";
  30028. var elInput = "";
  30029. var elPopper = "";
  30030. var elTag = "";
  30031. var elCascaderPanel = "";
  30032. var elCheckbox = "";
  30033. var elRadio = "";
  30034. var elScrollbar = "";
  30035. var elUpload = "";
  30036. var elProgress = "";
  30037. var elImage = "";
  30038. var elImageViewer = "";
  30039. var elSlider = "";
  30040. var elInputNumber = "";
  30041. var elTooltip = "";
  30042. var elSwitch = "";
  30043. var elOption = "";
  30044. var elOptionGroup = "";
  30045. var elSelect = "";
  30046. var elRate = "";
  30047. var elDatePicker = "";
  30048. var elConfigProvider = "";
  30049. var elTimePicker = "";
  30050. var elCheckboxGroup = "";
  30051. var elRadioGroup = "";
  30052. var elDivider = "";
  30053. var elTable = "";
  30054. var elTableColumn = "";
  30055. var zhCn = {
  30056. name: "zh-cn",
  30057. el: {
  30058. colorpicker: {
  30059. confirm: "\u786E\u5B9A",
  30060. clear: "\u6E05\u7A7A"
  30061. },
  30062. datepicker: {
  30063. now: "\u6B64\u523B",
  30064. today: "\u4ECA\u5929",
  30065. cancel: "\u53D6\u6D88",
  30066. clear: "\u6E05\u7A7A",
  30067. confirm: "\u786E\u5B9A",
  30068. selectDate: "\u9009\u62E9\u65E5\u671F",
  30069. selectTime: "\u9009\u62E9\u65F6\u95F4",
  30070. startDate: "\u5F00\u59CB\u65E5\u671F",
  30071. startTime: "\u5F00\u59CB\u65F6\u95F4",
  30072. endDate: "\u7ED3\u675F\u65E5\u671F",
  30073. endTime: "\u7ED3\u675F\u65F6\u95F4",
  30074. prevYear: "\u524D\u4E00\u5E74",
  30075. nextYear: "\u540E\u4E00\u5E74",
  30076. prevMonth: "\u4E0A\u4E2A\u6708",
  30077. nextMonth: "\u4E0B\u4E2A\u6708",
  30078. year: "\u5E74",
  30079. month1: "1 \u6708",
  30080. month2: "2 \u6708",
  30081. month3: "3 \u6708",
  30082. month4: "4 \u6708",
  30083. month5: "5 \u6708",
  30084. month6: "6 \u6708",
  30085. month7: "7 \u6708",
  30086. month8: "8 \u6708",
  30087. month9: "9 \u6708",
  30088. month10: "10 \u6708",
  30089. month11: "11 \u6708",
  30090. month12: "12 \u6708",
  30091. weeks: {
  30092. sun: "\u65E5",
  30093. mon: "\u4E00",
  30094. tue: "\u4E8C",
  30095. wed: "\u4E09",
  30096. thu: "\u56DB",
  30097. fri: "\u4E94",
  30098. sat: "\u516D"
  30099. },
  30100. months: {
  30101. jan: "\u4E00\u6708",
  30102. feb: "\u4E8C\u6708",
  30103. mar: "\u4E09\u6708",
  30104. apr: "\u56DB\u6708",
  30105. may: "\u4E94\u6708",
  30106. jun: "\u516D\u6708",
  30107. jul: "\u4E03\u6708",
  30108. aug: "\u516B\u6708",
  30109. sep: "\u4E5D\u6708",
  30110. oct: "\u5341\u6708",
  30111. nov: "\u5341\u4E00\u6708",
  30112. dec: "\u5341\u4E8C\u6708"
  30113. }
  30114. },
  30115. select: {
  30116. loading: "\u52A0\u8F7D\u4E2D",
  30117. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  30118. noData: "\u65E0\u6570\u636E",
  30119. placeholder: "\u8BF7\u9009\u62E9"
  30120. },
  30121. cascader: {
  30122. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  30123. loading: "\u52A0\u8F7D\u4E2D",
  30124. placeholder: "\u8BF7\u9009\u62E9",
  30125. noData: "\u6682\u65E0\u6570\u636E"
  30126. },
  30127. pagination: {
  30128. goto: "\u524D\u5F80",
  30129. pagesize: "\u6761/\u9875",
  30130. total: "\u5171 {total} \u6761",
  30131. pageClassifier: "\u9875",
  30132. 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"
  30133. },
  30134. messagebox: {
  30135. title: "\u63D0\u793A",
  30136. confirm: "\u786E\u5B9A",
  30137. cancel: "\u53D6\u6D88",
  30138. error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
  30139. },
  30140. upload: {
  30141. deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
  30142. delete: "\u5220\u9664",
  30143. preview: "\u67E5\u770B\u56FE\u7247",
  30144. continue: "\u7EE7\u7EED\u4E0A\u4F20"
  30145. },
  30146. table: {
  30147. emptyText: "\u6682\u65E0\u6570\u636E",
  30148. confirmFilter: "\u7B5B\u9009",
  30149. resetFilter: "\u91CD\u7F6E",
  30150. clearFilter: "\u5168\u90E8",
  30151. sumText: "\u5408\u8BA1"
  30152. },
  30153. tree: {
  30154. emptyText: "\u6682\u65E0\u6570\u636E"
  30155. },
  30156. transfer: {
  30157. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  30158. noData: "\u65E0\u6570\u636E",
  30159. titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
  30160. filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
  30161. noCheckedFormat: "\u5171 {total} \u9879",
  30162. hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
  30163. },
  30164. image: {
  30165. error: "\u52A0\u8F7D\u5931\u8D25"
  30166. },
  30167. pageHeader: {
  30168. title: "\u8FD4\u56DE"
  30169. },
  30170. popconfirm: {
  30171. confirmButtonText: "\u786E\u5B9A",
  30172. cancelButtonText: "\u53D6\u6D88"
  30173. }
  30174. }
  30175. };
  30176. var elSelectV2 = "";
  30177. var personnelSearch_vue_vue_type_style_index_0_lang = "";
  30178. const _hoisted_1$7 = { class: "selectV2SingleChoiceReset" };
  30179. const _hoisted_2$6 = {
  30180. key: 0,
  30181. style: { "color": "#A8ABB2" }
  30182. };
  30183. const _hoisted_3$5 = {
  30184. key: 1,
  30185. style: { "color": "#606266" }
  30186. };
  30187. const _hoisted_4$5 = { class: "selectV2SingleChoiceTwoReset" };
  30188. const _hoisted_5$5 = {
  30189. key: 0,
  30190. style: { "color": "#A8ABB2" }
  30191. };
  30192. const _hoisted_6$5 = { class: "flex items-center" };
  30193. const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  30194. props: {
  30195. modelValue: { type: null, required: true },
  30196. multiple: { type: Boolean, required: false, default: false },
  30197. size: { type: String, required: true, default: () => "" },
  30198. placeholder: { type: String, required: false, default: () => "\u8BF7\u9009\u62E9" },
  30199. disabled: { type: Boolean, required: false, default: false },
  30200. options: { type: Array, required: false, default: () => [] },
  30201. clearable: { type: Boolean, required: false, default: true },
  30202. width: { type: String, required: false, default: () => "100%" },
  30203. url: { type: String, required: false, default: () => "" }
  30204. },
  30205. emits: ["change", "update:modelValue"],
  30206. setup(__props, { emit }) {
  30207. const props = __props;
  30208. const personnelArray = ref([]);
  30209. const { userInfo = {}, personnelList = [] } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
  30210. const textSize = ref({
  30211. "small": { height: "20px", fontSize: "12px" },
  30212. "default": { height: "28px", fontSize: "14px" },
  30213. "": { height: "28px", fontSize: "14px" },
  30214. "large": { height: "36px", fontSize: "14px" }
  30215. });
  30216. const selectLoading = ref(false);
  30217. const controlTranslation = reactive({
  30218. visibleFlag: false
  30219. });
  30220. const selectedValue = ref(props.modelValue);
  30221. watch(() => props.modelValue, (newValue, _oldValue) => {
  30222. if (newValue != selectedValue.value) {
  30223. selectedValue.value = newValue;
  30224. }
  30225. });
  30226. const getSelectedLabel = computed(() => {
  30227. if (!props.multiple) {
  30228. const item = getPersonnelListItems(selectedValue.value || props.modelValue);
  30229. return item ? item.label : props.placeholder;
  30230. }
  30231. if (props.multiple) {
  30232. if (Array.isArray(selectedValue.value)) {
  30233. if (selectedValue.value.length <= 0) {
  30234. return props.placeholder;
  30235. }
  30236. const item = getPersonnelListItems(selectedValue.value || props.modelValue);
  30237. return item ? item.label : props.placeholder;
  30238. } else {
  30239. return props.placeholder;
  30240. }
  30241. }
  30242. return props.placeholder;
  30243. });
  30244. function tagClose(_evt) {
  30245. if (Array.isArray(selectedValue.value)) {
  30246. selectedValue.value.shift();
  30247. updateValue(selectedValue.value);
  30248. }
  30249. }
  30250. function getPersonnelListItems(val) {
  30251. let value = val;
  30252. if (Array.isArray(val) && val.length > 0) {
  30253. value = val[0];
  30254. }
  30255. return personnelList.find((item) => item.value == value);
  30256. }
  30257. function getUserList(keyword = "") {
  30258. newPost(props.url, keyword).then((res) => {
  30259. personnelArray.value = res || [];
  30260. }).finally(() => {
  30261. selectLoading.value = false;
  30262. });
  30263. }
  30264. function newPost(url2, keyword) {
  30265. return new Promise((resolve, reject) => {
  30266. const token = sessionStorage.getItem("token");
  30267. if (!token) {
  30268. reject(new Error("Token is missing"));
  30269. return;
  30270. }
  30271. const body = new URLSearchParams();
  30272. body.append("keyword", keyword);
  30273. fetch(url2, {
  30274. method: "POST",
  30275. headers: {
  30276. "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  30277. "Token": token
  30278. },
  30279. body: body.toString()
  30280. }).then((resp) => {
  30281. if (!resp.ok) {
  30282. reject(new Error(`Error: ${resp.statusText}`));
  30283. }
  30284. return resp.json();
  30285. }).then((json) => {
  30286. const res = json.data;
  30287. if (Array.isArray(res)) {
  30288. const personnelArray2 = res.map((data2) => ({
  30289. label: data2["label"],
  30290. value: data2["value"]
  30291. }));
  30292. resolve(personnelArray2);
  30293. } else {
  30294. reject(new Error("Invalid data format"));
  30295. }
  30296. }).catch((error) => {
  30297. reject(error);
  30298. });
  30299. });
  30300. }
  30301. function visibleChange(visible) {
  30302. if (visible) {
  30303. personnelArray.value = personnelList;
  30304. }
  30305. controlTranslation.visibleFlag = visible;
  30306. }
  30307. const filterMethod = debounce2(filterMethods, 500);
  30308. function filterMethods(val) {
  30309. if (val == "") {
  30310. personnelArray.value = personnelList;
  30311. selectLoading.value = false;
  30312. return personnelArray.value;
  30313. }
  30314. selectLoading.value = true;
  30315. getUserList(val);
  30316. }
  30317. function updateValue(val) {
  30318. emit("update:modelValue", selectedValue.value);
  30319. emit("change", val);
  30320. }
  30321. function debounce2(func, delay) {
  30322. let timer;
  30323. return (...args) => {
  30324. if (timer) {
  30325. clearTimeout(timer);
  30326. }
  30327. timer = setTimeout(() => {
  30328. func(...args);
  30329. }, delay);
  30330. };
  30331. }
  30332. onMounted(() => {
  30333. if (personnelList.length == 0) {
  30334. getUserList();
  30335. } else {
  30336. personnelArray.value = personnelList;
  30337. }
  30338. });
  30339. return (_ctx, _cache) => {
  30340. const _component_ww_open_data = resolveComponent("ww-open-data");
  30341. const _component_el_tag = ElTag;
  30342. const _component_el_select_v2 = ElSelectV2;
  30343. return openBlock(), createBlock(_component_el_select_v2, {
  30344. modelValue: selectedValue.value,
  30345. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedValue.value = $event),
  30346. multiple: __props.multiple,
  30347. size: __props.size,
  30348. loading: selectLoading.value,
  30349. placeholder: __props.placeholder,
  30350. disabled: __props.disabled,
  30351. clearable: __props.clearable,
  30352. filterable: "",
  30353. "collapse-tags": "",
  30354. options: personnelArray.value,
  30355. style: normalizeStyle(`width: ${__props.width}`),
  30356. class: normalizeClass(`custom-select-v2-reset ${!unref(controlTranslation).visibleFlag ? "setUpInputReset" : ""}`),
  30357. onChange: updateValue,
  30358. onVisibleChange: visibleChange,
  30359. "filter-method": unref(filterMethod)
  30360. }, createSlots({
  30361. default: withCtx(({ item }) => [
  30362. createElementVNode("div", _hoisted_6$5, [
  30363. unref(userInfo).userNameNeedTranslate == 1 ? (openBlock(), createBlock(_component_ww_open_data, {
  30364. key: 0,
  30365. type: "userName",
  30366. openid: item.label
  30367. }, null, 8, ["openid"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  30368. createTextVNode(toDisplayString(item.label), 1)
  30369. ], 64))
  30370. ])
  30371. ]),
  30372. _: 2
  30373. }, [
  30374. !__props.multiple ? {
  30375. name: "prefix",
  30376. fn: withCtx(() => [
  30377. createElementVNode("div", _hoisted_1$7, [
  30378. !unref(controlTranslation).visibleFlag ? (openBlock(), createElementBlock("div", {
  30379. key: 0,
  30380. class: "selectSingleChoice",
  30381. style: normalizeStyle(`line-height: ${textSize.value[__props.size].height};font-size:${textSize.value[__props.size].fontSize}`)
  30382. }, [
  30383. unref(getSelectedLabel) == __props.placeholder ? (openBlock(), createElementBlock("span", _hoisted_2$6, toDisplayString(__props.placeholder), 1)) : (openBlock(), createElementBlock("span", _hoisted_3$5, [
  30384. unref(userInfo).userNameNeedTranslate == 1 ? (openBlock(), createBlock(_component_ww_open_data, {
  30385. key: 0,
  30386. type: "userName",
  30387. openid: unref(getSelectedLabel)
  30388. }, null, 8, ["openid"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  30389. createTextVNode(toDisplayString(unref(getSelectedLabel)), 1)
  30390. ], 64))
  30391. ]))
  30392. ], 4)) : createCommentVNode("", true)
  30393. ])
  30394. ])
  30395. } : void 0,
  30396. __props.multiple ? {
  30397. name: "prefix",
  30398. fn: withCtx(() => [
  30399. createElementVNode("div", _hoisted_4$5, [
  30400. createElementVNode("div", {
  30401. class: "selectSingleChoice",
  30402. style: normalizeStyle(`line-height: ${textSize.value[__props.size].height};font-size:${textSize.value[__props.size].fontSize}`)
  30403. }, [
  30404. unref(getSelectedLabel) == __props.placeholder ? (openBlock(), createElementBlock("span", _hoisted_5$5, toDisplayString(__props.placeholder), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  30405. createVNode(_component_el_tag, {
  30406. type: "info",
  30407. size: __props.size,
  30408. closable: "",
  30409. onClose: tagClose,
  30410. style: { "margin-right": "5px" }
  30411. }, {
  30412. default: withCtx(() => [
  30413. unref(userInfo).userNameNeedTranslate == 1 ? (openBlock(), createBlock(_component_ww_open_data, {
  30414. key: 0,
  30415. type: "userName",
  30416. openid: unref(getSelectedLabel)
  30417. }, null, 8, ["openid"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  30418. createTextVNode(toDisplayString(unref(getSelectedLabel)), 1)
  30419. ], 64))
  30420. ]),
  30421. _: 1
  30422. }, 8, ["size"]),
  30423. selectedValue.value.length > 1 ? (openBlock(), createBlock(_component_el_tag, {
  30424. key: 0,
  30425. type: "info",
  30426. size: __props.size
  30427. }, {
  30428. default: withCtx(() => [
  30429. createTextVNode("+" + toDisplayString(selectedValue.value.length), 1)
  30430. ]),
  30431. _: 1
  30432. }, 8, ["size"])) : createCommentVNode("", true)
  30433. ], 64))
  30434. ], 4)
  30435. ])
  30436. ])
  30437. } : void 0
  30438. ]), 1032, ["modelValue", "multiple", "size", "loading", "placeholder", "disabled", "clearable", "options", "style", "class", "filter-method"]);
  30439. };
  30440. }
  30441. });
  30442. var GenerateFormItem_vue_vue_type_style_index_0_scoped_true_lang = "";
  30443. var _export_sfc = (sfc, props) => {
  30444. const target = sfc.__vccOpts || sfc;
  30445. for (const [key, val] of props) {
  30446. target[key] = val;
  30447. }
  30448. return target;
  30449. };
  30450. const _withScopeId = (n) => (pushScopeId("data-v-38ee7c8b"), n = n(), popScopeId(), n);
  30451. const _hoisted_1$6 = { key: 12 };
  30452. const _hoisted_2$5 = {
  30453. key: 1,
  30454. class: "custom:insert"
  30455. };
  30456. const _hoisted_3$4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("i", { class: "custom:img-upload mr-2" }, null, -1));
  30457. const _hoisted_4$4 = /* @__PURE__ */ createTextVNode("\u70B9\u51FB\u4E0A\u4F20 ");
  30458. const _hoisted_5$4 = ["href"];
  30459. const _hoisted_6$4 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  30460. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  30461. props: {
  30462. config: null,
  30463. element: null,
  30464. model: null,
  30465. updatedModel: null,
  30466. disabled: { type: Boolean },
  30467. request: null,
  30468. widgetFormData: null
  30469. },
  30470. emits: ["updateWidgetForm"],
  30471. setup(__props, { emit: emits }) {
  30472. const props = __props;
  30473. const { userInfo = {} } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
  30474. const originData = props.model[props.element.model];
  30475. const data2 = computed({
  30476. get: () => props.model[props.element.model],
  30477. set: (val) => {
  30478. props.model[props.element.model] = val;
  30479. if (JSON.stringify(originData) === JSON.stringify(val)) {
  30480. Reflect.deleteProperty(props.updatedModel, props.element.model);
  30481. } else {
  30482. props.updatedModel[props.element.model] = val;
  30483. }
  30484. }
  30485. });
  30486. const handleUploadSuccess = (_res, _file, fileList) => {
  30487. data2.value = fileList;
  30488. };
  30489. async function download(defaultValue, label) {
  30490. const a2 = document.createElement("a");
  30491. if (!props.request)
  30492. return;
  30493. a2.href = await props.request({
  30494. url: `/sys/common/static/${defaultValue}`,
  30495. responseType: "blob"
  30496. }).then((i) => {
  30497. if (i.size === 0)
  30498. return "";
  30499. return URL.createObjectURL(i);
  30500. });
  30501. a2.download = `${label}.${defaultValue.split(".")[1]}`;
  30502. a2.click();
  30503. }
  30504. const specializedHandleSelect = (val, element) => {
  30505. const field = element.model;
  30506. if (field == "customerId") {
  30507. let list = JSON.parse(JSON.stringify(props.widgetFormData));
  30508. for (var i in list) {
  30509. if (list[i].list[0].model == "contactsId") {
  30510. let item = list[i].list[0];
  30511. const token = sessionStorage.getItem("token");
  30512. fetch(`${item.options.remoteFunc}?customerId=${val}`, {
  30513. headers: {
  30514. "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
  30515. "Token": token
  30516. }
  30517. }).then((resp) => resp.json()).then((json) => {
  30518. const res = json.data;
  30519. if (res instanceof Array) {
  30520. item.options.remoteOptions = res.map((data22) => ({
  30521. label: data22[item.options.props.label],
  30522. value: data22[item.options.props.value],
  30523. children: data22[item.options.props.children]
  30524. }));
  30525. }
  30526. list[i].list[0].options = __spreadProps(__spreadValues({}, list[i].list[0].options), { disabled: false, defaultValue: "" });
  30527. });
  30528. }
  30529. }
  30530. setTimeout(() => {
  30531. console.log("\u5F00\u59CB\u6267\u884C");
  30532. updateWidgetForm(list);
  30533. }, 100);
  30534. }
  30535. };
  30536. const updateWidgetForm = (list) => {
  30537. emits("updateWidgetForm", list);
  30538. };
  30539. return (_ctx, _cache) => {
  30540. const _component_GenerateFormItem = resolveComponent("GenerateFormItem", true);
  30541. const _component_el_table_column = ElTableColumn;
  30542. const _component_el_table = ElTable;
  30543. const _component_el_divider = ElDivider;
  30544. const _component_el_input = ElInput;
  30545. const _component_el_input_number = ElInputNumber;
  30546. const _component_el_radio = ElRadio;
  30547. const _component_el_radio_group = ElRadioGroup;
  30548. const _component_el_checkbox = ElCheckbox;
  30549. const _component_el_checkbox_group = ElCheckboxGroup$1;
  30550. const _component_el_time_picker = ElTimePicker;
  30551. const _component_el_config_provider = ElConfigProvider;
  30552. const _component_el_date_picker = ElDatePicker;
  30553. const _component_el_rate = ElRate;
  30554. const _component_el_option = ElOption;
  30555. const _component_el_select = ElSelect;
  30556. const _component_el_switch = ElSwitch;
  30557. const _component_el_slider = ElSlider;
  30558. const _component_el_image = ElImage;
  30559. const _component_el_button = ElButton;
  30560. const _component_el_upload = ElUpload;
  30561. const _component_el_cascader = ElCascader;
  30562. const _component_el_form_item = ElFormItem;
  30563. return __props.element.type === "grid" ? (openBlock(), createElementBlock("div", {
  30564. key: 0,
  30565. grid: "~ cols-24",
  30566. style: normalizeStyle(`gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};`)
  30567. }, [
  30568. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (col, colIndex) => {
  30569. return openBlock(), createElementBlock("div", {
  30570. key: colIndex,
  30571. style: normalizeStyle(`grid-column: span ${col.span}`)
  30572. }, [
  30573. (openBlock(true), createElementBlock(Fragment, null, renderList(col.list, (colItem) => {
  30574. return openBlock(), createBlock(_component_GenerateFormItem, {
  30575. key: colItem.key,
  30576. request: __props.request,
  30577. model: __props.model,
  30578. "updated-model": __props.updatedModel,
  30579. element: colItem,
  30580. config: __props.config,
  30581. disabled: __props.disabled,
  30582. widgetFormData: __props.element.columns,
  30583. onUpdateWidgetForm: updateWidgetForm
  30584. }, null, 8, ["request", "model", "updated-model", "element", "config", "disabled", "widgetFormData"]);
  30585. }), 128))
  30586. ], 4);
  30587. }), 128))
  30588. ], 4)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  30589. key: 1,
  30590. border: "",
  30591. class: "mb-4.5",
  30592. data: __props.element.options.defaultValue
  30593. }, {
  30594. default: withCtx(() => [
  30595. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  30596. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  30597. key: i.prop,
  30598. align: __props.element.options.align
  30599. }, i), null, 16, ["align"]);
  30600. }), 128))
  30601. ]),
  30602. _: 1
  30603. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  30604. key: 2,
  30605. data: __props.element.options.defaultValue,
  30606. "content-position": "left"
  30607. }, {
  30608. default: withCtx(() => [
  30609. createTextVNode(toDisplayString(__props.element.label), 1)
  30610. ]),
  30611. _: 1
  30612. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  30613. key: __props.element.key,
  30614. label: __props.element.label,
  30615. prop: __props.element.model,
  30616. style: normalizeStyle(__props.element.type === "download" ? "display:inline-flex;margin-right:40px" : ""),
  30617. "label-width": __props.element.labelWidth
  30618. }, createSlots({
  30619. default: withCtx(() => [
  30620. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  30621. key: 0,
  30622. modelValue: unref(data2),
  30623. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(data2) ? data2.value = $event : null),
  30624. modelModifiers: { trim: true },
  30625. style: normalizeStyle({ width: __props.element.options.width }),
  30626. placeholder: __props.element.options.placeholder,
  30627. maxlength: parseInt(__props.element.options.maxlength),
  30628. clearable: __props.element.options.clearable,
  30629. readonly: __props.element.options.readonly,
  30630. disabled: __props.disabled || __props.element.options.disabled
  30631. }, createSlots({ _: 2 }, [
  30632. __props.element.options.prefix ? {
  30633. name: "prefix",
  30634. fn: withCtx(() => [
  30635. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  30636. ])
  30637. } : void 0,
  30638. __props.element.options.suffix ? {
  30639. name: "suffix",
  30640. fn: withCtx(() => [
  30641. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  30642. ])
  30643. } : void 0,
  30644. __props.element.options.prepend ? {
  30645. name: "prepend",
  30646. fn: withCtx(() => [
  30647. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  30648. ])
  30649. } : void 0,
  30650. __props.element.options.append ? {
  30651. name: "append",
  30652. fn: withCtx(() => [
  30653. createTextVNode(toDisplayString(__props.element.options.append), 1)
  30654. ])
  30655. } : void 0
  30656. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  30657. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  30658. key: 1,
  30659. modelValue: unref(data2),
  30660. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(data2) ? data2.value = $event : null),
  30661. modelModifiers: { trim: true },
  30662. style: normalizeStyle({ width: __props.element.options.width }),
  30663. placeholder: __props.element.options.placeholder,
  30664. maxlength: parseInt(__props.element.options.maxlength),
  30665. clearable: __props.element.options.clearable,
  30666. disabled: __props.disabled || __props.element.options.disabled,
  30667. readonly: __props.element.options.readonly,
  30668. "show-password": __props.element.options.showPassword
  30669. }, createSlots({ _: 2 }, [
  30670. __props.element.options.prefix ? {
  30671. name: "prefix",
  30672. fn: withCtx(() => [
  30673. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  30674. ])
  30675. } : void 0,
  30676. __props.element.options.suffix ? {
  30677. name: "suffix",
  30678. fn: withCtx(() => [
  30679. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  30680. ])
  30681. } : void 0,
  30682. __props.element.options.prepend ? {
  30683. name: "prepend",
  30684. fn: withCtx(() => [
  30685. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  30686. ])
  30687. } : void 0,
  30688. __props.element.options.append ? {
  30689. name: "append",
  30690. fn: withCtx(() => [
  30691. createTextVNode(toDisplayString(__props.element.options.append), 1)
  30692. ])
  30693. } : void 0
  30694. ]), 1032, ["modelValue", "style", "placeholder", "maxlength", "clearable", "disabled", "readonly", "show-password"])) : createCommentVNode("", true),
  30695. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  30696. key: 2,
  30697. modelValue: unref(data2),
  30698. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(data2) ? data2.value = $event : null),
  30699. modelModifiers: { trim: true },
  30700. type: "textarea",
  30701. resize: "none",
  30702. rows: __props.element.options.rows,
  30703. style: normalizeStyle({ width: __props.element.options.width }),
  30704. placeholder: __props.element.options.placeholder,
  30705. maxlength: parseInt(__props.element.options.maxlength),
  30706. "show-word-limit": __props.element.options.showWordLimit,
  30707. autosize: __props.element.options.autosize,
  30708. clearable: __props.element.options.clearable,
  30709. readonly: __props.element.options.readonly,
  30710. disabled: __props.disabled || __props.element.options.disabled
  30711. }, null, 8, ["modelValue", "rows", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "readonly", "disabled"])) : createCommentVNode("", true),
  30712. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  30713. key: 3,
  30714. modelValue: unref(data2),
  30715. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(data2) ? data2.value = $event : null),
  30716. style: normalizeStyle({ width: __props.element.options.width }),
  30717. max: __props.element.options.max,
  30718. min: __props.element.options.min,
  30719. disabled: __props.disabled || __props.element.options.disabled,
  30720. "controls-position": "right"
  30721. }, null, 8, ["modelValue", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  30722. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  30723. key: 4,
  30724. modelValue: unref(data2),
  30725. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => isRef(data2) ? data2.value = $event : null),
  30726. style: normalizeStyle({ width: __props.element.options.width }),
  30727. disabled: __props.disabled || __props.element.options.disabled
  30728. }, {
  30729. default: withCtx(() => [
  30730. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  30731. return openBlock(), createBlock(_component_el_radio, {
  30732. key: item.value,
  30733. label: item.value,
  30734. style: normalizeStyle({
  30735. display: __props.element.options.inline ? "inline-block" : "block"
  30736. })
  30737. }, {
  30738. default: withCtx(() => [
  30739. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  30740. ]),
  30741. _: 2
  30742. }, 1032, ["label", "style"]);
  30743. }), 128))
  30744. ]),
  30745. _: 1
  30746. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  30747. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  30748. key: 5,
  30749. modelValue: unref(data2),
  30750. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(data2) ? data2.value = $event : null),
  30751. style: normalizeStyle({ width: __props.element.options.width }),
  30752. disabled: __props.disabled || __props.element.options.disabled
  30753. }, {
  30754. default: withCtx(() => [
  30755. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  30756. return openBlock(), createBlock(_component_el_checkbox, {
  30757. key: item.value,
  30758. label: item.value,
  30759. style: normalizeStyle({
  30760. display: __props.element.options.inline ? "inline-block" : "block"
  30761. })
  30762. }, {
  30763. default: withCtx(() => [
  30764. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  30765. ]),
  30766. _: 2
  30767. }, 1032, ["label", "style"]);
  30768. }), 128))
  30769. ]),
  30770. _: 1
  30771. }, 8, ["modelValue", "style", "disabled"])) : createCommentVNode("", true),
  30772. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_config_provider, {
  30773. key: 6,
  30774. locale: unref(zhCn)
  30775. }, {
  30776. default: withCtx(() => [
  30777. createVNode(_component_el_time_picker, {
  30778. modelValue: unref(data2),
  30779. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => isRef(data2) ? data2.value = $event : null),
  30780. placeholder: __props.element.options.placeholder,
  30781. readonly: __props.element.options.readonly,
  30782. editable: __props.element.options.editable,
  30783. clearable: __props.element.options.clearable,
  30784. format: __props.element.options.format,
  30785. disabled: __props.disabled || __props.element.options.disabled,
  30786. style: normalizeStyle({ width: __props.element.options.width })
  30787. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
  30788. ]),
  30789. _: 1
  30790. }, 8, ["locale"])) : createCommentVNode("", true),
  30791. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_config_provider, {
  30792. key: 7,
  30793. locale: unref(zhCn)
  30794. }, {
  30795. default: withCtx(() => [
  30796. createVNode(_component_el_date_picker, {
  30797. modelValue: unref(data2),
  30798. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => isRef(data2) ? data2.value = $event : null),
  30799. placeholder: __props.element.options.placeholder,
  30800. readonly: __props.element.options.readonly,
  30801. editable: __props.element.options.editable,
  30802. clearable: __props.element.options.clearable,
  30803. format: __props.element.options.format,
  30804. disabled: __props.disabled || __props.element.options.disabled,
  30805. style: normalizeStyle({ width: __props.element.options.width })
  30806. }, null, 8, ["modelValue", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])
  30807. ]),
  30808. _: 1
  30809. }, 8, ["locale"])) : createCommentVNode("", true),
  30810. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  30811. key: 8,
  30812. modelValue: unref(data2),
  30813. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => isRef(data2) ? data2.value = $event : null),
  30814. max: __props.element.options.max,
  30815. "allow-half": __props.element.options.allowHalf,
  30816. disabled: __props.disabled || __props.element.options.disabled
  30817. }, null, 8, ["modelValue", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  30818. __props.element.type === "select" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
  30819. unref(userInfo).userNameNeedTranslate == 1 && __props.element.options.remoteFunc.indexOf("getSimpleActiveUserListNew") > -1 ? (openBlock(), createBlock(_sfc_main$9, {
  30820. key: 0,
  30821. modelValue: unref(data2),
  30822. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => isRef(data2) ? data2.value = $event : null),
  30823. multiple: __props.element.options.multiple,
  30824. placeholder: __props.element.options.placeholder,
  30825. clearable: __props.element.options.clearable,
  30826. filterable: __props.element.options.filterable,
  30827. disabled: __props.disabled || __props.element.options.disabled,
  30828. url: __props.element.options.remoteFunc,
  30829. size: __props.config.size,
  30830. options: [],
  30831. style: normalizeStyle({ width: __props.element.options.width }),
  30832. onChange: _cache[10] || (_cache[10] = (value) => specializedHandleSelect(value, __props.element))
  30833. }, null, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "url", "size", "style"])) : (openBlock(), createBlock(_component_el_select, {
  30834. key: 1,
  30835. modelValue: unref(data2),
  30836. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => isRef(data2) ? data2.value = $event : null),
  30837. multiple: __props.element.options.multiple,
  30838. placeholder: __props.element.options.placeholder,
  30839. clearable: __props.element.options.clearable,
  30840. filterable: __props.element.options.filterable,
  30841. disabled: __props.disabled || __props.element.options.disabled,
  30842. style: normalizeStyle({ width: __props.element.options.width }),
  30843. onChange: _cache[12] || (_cache[12] = (value) => specializedHandleSelect(value, __props.element))
  30844. }, {
  30845. default: withCtx(() => [
  30846. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.remote ? __props.element.options.remoteOptions : __props.element.options.options, (item) => {
  30847. return openBlock(), createBlock(_component_el_option, {
  30848. key: item.value,
  30849. value: item.value,
  30850. label: __props.element.options.showLabel ? item.label : item.value
  30851. }, null, 8, ["value", "label"]);
  30852. }), 128))
  30853. ]),
  30854. _: 1
  30855. }, 8, ["modelValue", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"]))
  30856. ], 64)) : createCommentVNode("", true),
  30857. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  30858. key: 10,
  30859. modelValue: unref(data2),
  30860. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => isRef(data2) ? data2.value = $event : null),
  30861. "active-text": __props.element.options.activeText,
  30862. "inactive-text": __props.element.options.inactiveText,
  30863. disabled: __props.disabled || __props.element.options.disabled
  30864. }, null, 8, ["modelValue", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  30865. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  30866. key: 11,
  30867. modelValue: unref(data2),
  30868. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => isRef(data2) ? data2.value = $event : null),
  30869. min: __props.element.options.min,
  30870. max: __props.element.options.max,
  30871. step: __props.element.options.step,
  30872. range: __props.element.options.range,
  30873. disabled: __props.disabled || __props.element.options.disabled,
  30874. style: normalizeStyle({ width: __props.element.options.width })
  30875. }, null, 8, ["modelValue", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  30876. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$6, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  30877. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  30878. key: 13,
  30879. name: __props.element.options.file,
  30880. action: __props.element.options.action,
  30881. accept: __props.element.options.accept,
  30882. "list-type": __props.element.options.listType,
  30883. multiple: __props.element.options.multiple,
  30884. limit: __props.element.options.limit,
  30885. disabled: __props.disabled || __props.element.options.disabled,
  30886. "on-success": handleUploadSuccess
  30887. }, {
  30888. default: withCtx(() => {
  30889. var _a2;
  30890. return [
  30891. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  30892. ((_a2 = __props.element.options.defaultValue) == null ? void 0 : _a2.length) ? (openBlock(), createBlock(_component_el_image, {
  30893. key: 0,
  30894. style: { "width": "100%", "height": "100%" },
  30895. "preview-src-list": [
  30896. "/api/sys/common/static/" + __props.element.options.defaultValue
  30897. ],
  30898. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  30899. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$5))
  30900. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  30901. default: withCtx(() => [
  30902. _hoisted_3$4,
  30903. _hoisted_4$4
  30904. ]),
  30905. _: 1
  30906. }))
  30907. ];
  30908. }),
  30909. _: 1
  30910. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  30911. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  30912. key: 14,
  30913. style: { "margin-top": "-4px" },
  30914. type: "text",
  30915. onClick: _cache[15] || (_cache[15] = ($event) => download(__props.element.options.defaultValue, __props.element.label))
  30916. }, {
  30917. default: withCtx(() => [
  30918. _hoisted_6$4
  30919. ]),
  30920. _: 1
  30921. })) : createCommentVNode("", true),
  30922. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  30923. key: 15,
  30924. modelValue: unref(data2),
  30925. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => isRef(data2) ? data2.value = $event : null),
  30926. options: __props.element.options.remoteOptions,
  30927. placeholder: __props.element.options.placeholder,
  30928. filterable: __props.element.options.filterable,
  30929. clearable: __props.element.options.clearable,
  30930. disabled: __props.disabled || __props.element.options.disabled,
  30931. style: normalizeStyle({ width: __props.element.options.width })
  30932. }, null, 8, ["modelValue", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  30933. ]),
  30934. _: 2
  30935. }, [
  30936. __props.element.type === "download" ? {
  30937. name: "label",
  30938. fn: withCtx(({ label }) => [
  30939. createElementVNode("a", {
  30940. href: `/api/sys/common/static/${__props.element.options.defaultValue}?inline=1`,
  30941. style: { "color": "#606266" },
  30942. target: "_blank"
  30943. }, toDisplayString(label), 9, _hoisted_5$4)
  30944. ])
  30945. } : void 0
  30946. ]), 1032, ["label", "prop", "style", "label-width"])) : createCommentVNode("", true);
  30947. };
  30948. }
  30949. });
  30950. var GenerateFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-38ee7c8b"]]);
  30951. const _sfc_main$7 = defineComponent({
  30952. name: "FormGenerate",
  30953. components: {
  30954. GenerateFormItem
  30955. },
  30956. props: {
  30957. data: {
  30958. type: Object,
  30959. default: getWidgetForm()
  30960. },
  30961. value: {
  30962. type: Object
  30963. },
  30964. disabled: {
  30965. type: Boolean,
  30966. default: false
  30967. },
  30968. request: {
  30969. type: Function
  30970. }
  30971. },
  30972. setup(props) {
  30973. var _a2;
  30974. const state = reactive({
  30975. generateForm: null,
  30976. model: {},
  30977. updatedModel: {},
  30978. rules: {},
  30979. widgetForm: (_a2 = props.data && JSON.parse(JSON.stringify(props.data))) != null ? _a2 : getWidgetForm()
  30980. });
  30981. const generateModel = (list) => {
  30982. for (let index = 0; index < list.length; index++) {
  30983. const model = list[index].model;
  30984. if (!model)
  30985. return;
  30986. if (list[index].type === "grid") {
  30987. list[index].columns.forEach((col) => generateModel(col.list));
  30988. } else {
  30989. if (props.value && Object.keys(props.value).includes(model))
  30990. state.model[model] = props.value[model];
  30991. else
  30992. state.model[model] = list[index].options.defaultValue;
  30993. state.rules[model] = list[index].options.rules;
  30994. }
  30995. }
  30996. };
  30997. const generateOptions = (list) => {
  30998. list.forEach(async (item) => {
  30999. if (item.type === "grid") {
  31000. item.columns.forEach((col) => generateOptions(col.list));
  31001. } else {
  31002. if (item.options.remote && item.options.remoteFunc) {
  31003. if (props.request) {
  31004. const { data: data2 } = await props.request({
  31005. url: item.options.remoteFunc
  31006. });
  31007. item.options.remoteOptions = data2.map((i) => ({
  31008. label: i[item.options.props.label],
  31009. value: i[item.options.props.value],
  31010. children: i[item.options.props.children]
  31011. }));
  31012. return;
  31013. }
  31014. const token = sessionStorage.getItem("token");
  31015. fetch(item.options.remoteFunc, {
  31016. headers: {
  31017. "Content-type": " application/x-www-form-urlencoded; charset=UTF-8",
  31018. "Token": token
  31019. }
  31020. }).then((resp) => resp.json()).then((json) => {
  31021. const res = json.data;
  31022. if (res instanceof Array) {
  31023. item.options.remoteOptions = res.map((data2) => ({
  31024. label: data2[item.options.props.label],
  31025. value: data2[item.options.props.value],
  31026. children: data2[item.options.props.children]
  31027. }));
  31028. }
  31029. });
  31030. }
  31031. }
  31032. });
  31033. };
  31034. const updateWidgetForm = (list) => {
  31035. const listIndex2 = state.widgetForm.list.findIndex((item) => item.type === "grid");
  31036. state.widgetForm.list[listIndex2].columns = list;
  31037. state.model = __spreadProps(__spreadValues({}, state.model), { contactsId: "" });
  31038. };
  31039. watch(() => props.data, (val) => {
  31040. var _a3;
  31041. state.widgetForm = (_a3 = val && JSON.parse(JSON.stringify(val))) != null ? _a3 : getWidgetForm();
  31042. state.model = {};
  31043. state.rules = {};
  31044. generateModel(state.widgetForm.list);
  31045. generateOptions(state.widgetForm.list);
  31046. }, { deep: true, immediate: true });
  31047. const getData = () => {
  31048. return new Promise((resolve, reject) => {
  31049. state.generateForm.validate().then((validate) => {
  31050. if (validate)
  31051. resolve(state.updatedModel);
  31052. else
  31053. ElMessage.error("\u9A8C\u8BC1\u5931\u8D25");
  31054. }).catch((error) => {
  31055. reject(error);
  31056. });
  31057. });
  31058. };
  31059. const reset = () => {
  31060. state.generateForm.resetFields();
  31061. };
  31062. return __spreadProps(__spreadValues({}, toRefs(state)), {
  31063. getData,
  31064. reset,
  31065. updateWidgetForm
  31066. });
  31067. }
  31068. });
  31069. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  31070. const _component_GenerateFormItem = resolveComponent("GenerateFormItem");
  31071. const _component_el_form = ElForm;
  31072. return openBlock(), createBlock(_component_el_form, {
  31073. ref: "generateForm",
  31074. "label-suffix": ":",
  31075. model: _ctx.model,
  31076. rules: _ctx.rules,
  31077. size: _ctx.widgetForm.config.size,
  31078. "label-position": _ctx.widgetForm.config.labelPosition,
  31079. "label-width": `${_ctx.widgetForm.config.labelWidth}px`,
  31080. "hide-required-asterisk": _ctx.widgetForm.config.hideRequiredAsterisk
  31081. }, {
  31082. default: withCtx(() => [
  31083. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.widgetForm.list, (element, index) => {
  31084. return openBlock(), createBlock(_component_GenerateFormItem, {
  31085. key: element.key,
  31086. model: _ctx.model,
  31087. "updated-model": _ctx.updatedModel,
  31088. element: _ctx.widgetForm.list[index],
  31089. config: _ctx.data.config,
  31090. disabled: _ctx.disabled,
  31091. request: _ctx.request,
  31092. widgetFormData: _ctx.widgetForm.list,
  31093. onUpdateWidgetForm: _ctx.updateWidgetForm
  31094. }, null, 8, ["model", "updated-model", "element", "config", "disabled", "request", "widgetFormData", "onUpdateWidgetForm"]);
  31095. }), 128))
  31096. ]),
  31097. _: 1
  31098. }, 8, ["model", "rules", "size", "label-position", "label-width", "hide-required-asterisk"]);
  31099. }
  31100. var GenerateForm = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$1]]);
  31101. const _hoisted_1$5 = { class: "px-3 py-2 text-sm text-gray-700" };
  31102. const _hoisted_2$4 = {
  31103. key: 0,
  31104. 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"
  31105. };
  31106. let listIndex = 1;
  31107. function setListIndex(list) {
  31108. if (list.list.length > 0) {
  31109. const array4 = list.list.map((item) => item.model);
  31110. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  31111. const match = item.match(/plate(\d+)/);
  31112. return match ? match[1] : null;
  31113. });
  31114. listIndex = findMissingPositive(plateNumbers);
  31115. }
  31116. }
  31117. function cloneWidget(params) {
  31118. const key = Math.random().toString(36).substring(2, 9);
  31119. params = cloneDeep(__spreadProps(__spreadValues({}, params), {
  31120. key,
  31121. model: `plate${listIndex}`
  31122. }));
  31123. if (params.type === "grid") {
  31124. params.columns.forEach((i) => {
  31125. i.list = i.list.map(cloneWidget);
  31126. });
  31127. }
  31128. return params;
  31129. }
  31130. function findMissingPositive(nums) {
  31131. let numbers = nums.map(Number);
  31132. numbers.sort((a2, b2) => a2 - b2);
  31133. let missing = 1;
  31134. for (let i = 0; i < numbers.length; i++) {
  31135. if (numbers[i] === missing) {
  31136. missing++;
  31137. }
  31138. }
  31139. return missing;
  31140. }
  31141. const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  31142. props: {
  31143. fields: null,
  31144. title: null,
  31145. list: null,
  31146. allList: null
  31147. },
  31148. setup(__props) {
  31149. const props = __props;
  31150. let moveFlag = ref(false);
  31151. const moveStart = () => {
  31152. const array4 = props.allList.list.map((item) => item.model);
  31153. const plateNumbers = array4.filter((item) => item.includes("plate")).map((item) => {
  31154. const match = item.match(/plate(\d+)/);
  31155. return match ? match[1] : null;
  31156. });
  31157. const flag = plateNumbers.length < 5;
  31158. if (!flag && !moveFlag.value) {
  31159. moveFlag.value = true;
  31160. ElMessage.warning("\u6700\u591A\u6DFB\u52A0\u4E94\u4E2A");
  31161. return false;
  31162. }
  31163. return flag;
  31164. };
  31165. const stopMove = () => {
  31166. moveFlag.value = false;
  31167. };
  31168. return (_ctx, _cache) => {
  31169. return openBlock(), createElementBlock(Fragment, null, [
  31170. createElementVNode("div", _hoisted_1$5, toDisplayString(__props.title), 1),
  31171. createVNode(unref(Draggable), {
  31172. tag: "ul",
  31173. class: "m-0 p-3 pt-0 grid grid-cols-2 gap-1",
  31174. "item-key": "type",
  31175. group: { name: "form-design", pull: "clone", put: false },
  31176. clone: cloneWidget,
  31177. sort: false,
  31178. list: __props.list,
  31179. allList: __props.allList,
  31180. move: moveStart,
  31181. choose: setListIndex(__props.allList),
  31182. onAdd: _cache[0] || (_cache[0] = ($event) => stopMove())
  31183. }, {
  31184. item: withCtx(({ element }) => [
  31185. __props.fields.includes(element.type) ? (openBlock(), createElementBlock("li", _hoisted_2$4, [
  31186. createElementVNode("i", {
  31187. class: normalizeClass(["custom:" + element.type, "ml-2 mr-1"])
  31188. }, null, 2),
  31189. createElementVNode("span", null, toDisplayString(element.label), 1)
  31190. ])) : createCommentVNode("", true)
  31191. ]),
  31192. _: 1
  31193. }, 8, ["list", "allList", "choose"])
  31194. ], 64);
  31195. };
  31196. }
  31197. });
  31198. const _hoisted_1$4 = { key: 12 };
  31199. const _hoisted_2$3 = {
  31200. key: 1,
  31201. class: "custom:insert"
  31202. };
  31203. const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("i", {
  31204. "icon-class": "custom:img-upload",
  31205. style: { "margin-right": "10px" }
  31206. }, null, -1);
  31207. const _hoisted_4$3 = /* @__PURE__ */ createTextVNode(" \u70B9\u51FB\u4E0A\u4F20 ");
  31208. const _hoisted_5$3 = /* @__PURE__ */ createTextVNode(" \u4E0B\u8F7D ");
  31209. const _hoisted_6$3 = /* @__PURE__ */ createElementVNode("i", {
  31210. class: "eva:move-outline",
  31211. "text-lg": ""
  31212. }, null, -1);
  31213. const _hoisted_7$2 = [
  31214. _hoisted_6$3
  31215. ];
  31216. const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  31217. props: {
  31218. list: null,
  31219. element: null,
  31220. index: null,
  31221. selectWidget: null,
  31222. configurationItems: null
  31223. },
  31224. emits: ["itemClick", "delete", "update:selectWidget"],
  31225. setup(__props) {
  31226. const props = createPropsRestProxy(__props, ["element", "index", "list"]);
  31227. let selectWidget = useVModel(props, "selectWidget");
  31228. const { userInfo = {} } = JSON.parse(sessionStorage.getItem("storeInfo") || "{}");
  31229. const handleDeleteClick = () => {
  31230. __props.list.splice(__props.index, 1);
  31231. selectWidget.value = __props.list[__props.list.length === __props.index ? __props.index - 1 : __props.index];
  31232. };
  31233. return (_ctx, _cache) => {
  31234. var _a2, _b2;
  31235. const _component_WidgetFormItem = resolveComponent("WidgetFormItem", true);
  31236. const _component_el_table_column = ElTableColumn;
  31237. const _component_el_table = ElTable;
  31238. const _component_el_divider = ElDivider;
  31239. const _component_el_input = ElInput;
  31240. const _component_el_input_number = ElInputNumber;
  31241. const _component_el_radio = ElRadio;
  31242. const _component_el_radio_group = ElRadioGroup;
  31243. const _component_el_checkbox = ElCheckbox;
  31244. const _component_el_checkbox_group = ElCheckboxGroup$1;
  31245. const _component_el_time_picker = ElTimePicker;
  31246. const _component_el_date_picker = ElDatePicker;
  31247. const _component_el_rate = ElRate;
  31248. const _component_el_option = ElOption;
  31249. const _component_el_select = ElSelect;
  31250. const _component_el_switch = ElSwitch;
  31251. const _component_el_slider = ElSlider;
  31252. const _component_el_image = ElImage;
  31253. const _component_el_button = ElButton;
  31254. const _component_el_upload = ElUpload;
  31255. const _component_el_cascader = ElCascader;
  31256. const _component_el_form_item = ElFormItem;
  31257. return openBlock(), createElementBlock("div", {
  31258. class: normalizeClass(["widget-view", { active: ((_a2 = selectWidget.value) == null ? void 0 : _a2.key) === __props.element.key, col: __props.element.type === "grid" }]),
  31259. style: normalizeStyle(__props.element.type === "grid" ? `gap: ${__props.element.options.gutter}px; align-items: ${__props.element.options.align};` : ""),
  31260. onClick: _cache[3] || (_cache[3] = withModifiers(($event) => selectWidget.value = __props.element, ["stop"]))
  31261. }, [
  31262. __props.element.type === "grid" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.element.columns, (col, key) => {
  31263. return openBlock(), createBlock(unref(Draggable), {
  31264. key,
  31265. class: "bg-white min-h-12 border border-dashed border-gray-300",
  31266. style: normalizeStyle(`grid-column: span ${col.span}`),
  31267. "item-key": "key",
  31268. handle: "[cursor-move]",
  31269. animation: 200,
  31270. group: "form-design",
  31271. "no-transition-on-drag": true,
  31272. list: col.list,
  31273. onAdd: ($event) => selectWidget.value = col.list[$event.newIndex]
  31274. }, {
  31275. item: withCtx(({ element: colElement, index: colIndex }) => [
  31276. createVNode(_component_WidgetFormItem, {
  31277. selectWidget: selectWidget.value,
  31278. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => selectWidget.value = $event),
  31279. element: colElement,
  31280. list: col.list,
  31281. index: colIndex,
  31282. configurationItems: __props.configurationItems
  31283. }, null, 8, ["selectWidget", "element", "list", "index", "configurationItems"])
  31284. ]),
  31285. _: 2
  31286. }, 1032, ["style", "list", "onAdd"]);
  31287. }), 128)) : __props.element.type === "table" ? (openBlock(), createBlock(_component_el_table, {
  31288. key: 1,
  31289. class: "w-0 flex-1",
  31290. border: "",
  31291. data: __props.element.options.defaultValue
  31292. }, {
  31293. default: withCtx(() => [
  31294. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.columns, (i) => {
  31295. return openBlock(), createBlock(_component_el_table_column, mergeProps({
  31296. key: i.prop,
  31297. "header-align": __props.element.options.align,
  31298. align: __props.element.options.align
  31299. }, i), null, 16, ["header-align", "align"]);
  31300. }), 128))
  31301. ]),
  31302. _: 1
  31303. }, 8, ["data"])) : __props.element.type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
  31304. key: 2,
  31305. class: "pb-0",
  31306. data: __props.element.options.defaultValue,
  31307. "content-position": "left"
  31308. }, {
  31309. default: withCtx(() => [
  31310. createTextVNode(toDisplayString(__props.element.label), 1)
  31311. ]),
  31312. _: 1
  31313. }, 8, ["data"])) : __props.element ? (openBlock(), createBlock(_component_el_form_item, {
  31314. key: __props.element.key,
  31315. label: __props.element.label,
  31316. "label-width": __props.element.labelWidth,
  31317. rules: __props.element.options.rules
  31318. }, {
  31319. default: withCtx(() => [
  31320. __props.element.type === "input" ? (openBlock(), createBlock(_component_el_input, {
  31321. key: 0,
  31322. readonly: "",
  31323. "model-value": __props.element.options.defaultValue,
  31324. style: normalizeStyle({ width: __props.element.options.width }),
  31325. placeholder: __props.element.options.placeholder,
  31326. maxlength: parseInt(__props.element.options.maxlength),
  31327. clearable: __props.element.options.clearable,
  31328. disabled: __props.element.options.disabled
  31329. }, createSlots({ _: 2 }, [
  31330. __props.element.options.prefix ? {
  31331. name: "prefix",
  31332. fn: withCtx(() => [
  31333. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  31334. ])
  31335. } : void 0,
  31336. __props.element.options.suffix ? {
  31337. name: "suffix",
  31338. fn: withCtx(() => [
  31339. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  31340. ])
  31341. } : void 0,
  31342. __props.element.options.prepend ? {
  31343. name: "prepend",
  31344. fn: withCtx(() => [
  31345. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  31346. ])
  31347. } : void 0,
  31348. __props.element.options.append ? {
  31349. name: "append",
  31350. fn: withCtx(() => [
  31351. createTextVNode(toDisplayString(__props.element.options.append), 1)
  31352. ])
  31353. } : void 0
  31354. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled"])) : createCommentVNode("", true),
  31355. __props.element.type === "password" ? (openBlock(), createBlock(_component_el_input, {
  31356. key: 1,
  31357. readonly: "",
  31358. "model-value": __props.element.options.defaultValue,
  31359. style: normalizeStyle({ width: __props.element.options.width }),
  31360. placeholder: __props.element.options.placeholder,
  31361. maxlength: parseInt(__props.element.options.maxlength),
  31362. clearable: __props.element.options.clearable,
  31363. disabled: __props.element.options.disabled,
  31364. "show-password": __props.element.options.showPassword
  31365. }, createSlots({ _: 2 }, [
  31366. __props.element.options.prefix ? {
  31367. name: "prefix",
  31368. fn: withCtx(() => [
  31369. createTextVNode(toDisplayString(__props.element.options.prefix), 1)
  31370. ])
  31371. } : void 0,
  31372. __props.element.options.suffix ? {
  31373. name: "suffix",
  31374. fn: withCtx(() => [
  31375. createTextVNode(toDisplayString(__props.element.options.suffix), 1)
  31376. ])
  31377. } : void 0,
  31378. __props.element.options.prepend ? {
  31379. name: "prepend",
  31380. fn: withCtx(() => [
  31381. createTextVNode(toDisplayString(__props.element.options.prepend), 1)
  31382. ])
  31383. } : void 0,
  31384. __props.element.options.append ? {
  31385. name: "append",
  31386. fn: withCtx(() => [
  31387. createTextVNode(toDisplayString(__props.element.options.append), 1)
  31388. ])
  31389. } : void 0
  31390. ]), 1032, ["model-value", "style", "placeholder", "maxlength", "clearable", "disabled", "show-password"])) : createCommentVNode("", true),
  31391. __props.element.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  31392. key: 2,
  31393. type: "textarea",
  31394. resize: "none",
  31395. readonly: "",
  31396. rows: __props.element.options.rows,
  31397. "model-value": __props.element.options.defaultValue,
  31398. style: normalizeStyle({ width: __props.element.options.width }),
  31399. placeholder: __props.element.options.placeholder,
  31400. maxlength: parseInt(__props.element.options.maxlength),
  31401. "show-word-limit": __props.element.options.showWordLimit,
  31402. autosize: __props.element.options.autosize,
  31403. clearable: __props.element.options.clearable,
  31404. disabled: __props.element.options.disabled
  31405. }, null, 8, ["rows", "model-value", "style", "placeholder", "maxlength", "show-word-limit", "autosize", "clearable", "disabled"])) : createCommentVNode("", true),
  31406. __props.element.type === "number" ? (openBlock(), createBlock(_component_el_input_number, {
  31407. key: 3,
  31408. "model-value": __props.element.options.defaultValue,
  31409. style: normalizeStyle({ width: __props.element.options.width }),
  31410. max: __props.element.options.max,
  31411. min: __props.element.options.min,
  31412. disabled: __props.element.options.disabled,
  31413. "controls-position": "right"
  31414. }, null, 8, ["model-value", "style", "max", "min", "disabled"])) : createCommentVNode("", true),
  31415. __props.element.type === "radio" ? (openBlock(), createBlock(_component_el_radio_group, {
  31416. key: 4,
  31417. "model-value": __props.element.options.defaultValue,
  31418. style: normalizeStyle({ width: __props.element.options.width }),
  31419. disabled: __props.element.options.disabled
  31420. }, {
  31421. default: withCtx(() => [
  31422. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  31423. return openBlock(), createBlock(_component_el_radio, {
  31424. key: item.value,
  31425. label: item.value,
  31426. style: normalizeStyle({
  31427. display: __props.element.options.inline ? "inline-block" : "block"
  31428. })
  31429. }, {
  31430. default: withCtx(() => [
  31431. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  31432. ]),
  31433. _: 2
  31434. }, 1032, ["label", "style"]);
  31435. }), 128))
  31436. ]),
  31437. _: 1
  31438. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  31439. __props.element.type === "checkbox" ? (openBlock(), createBlock(_component_el_checkbox_group, {
  31440. key: 5,
  31441. "model-value": __props.element.options.defaultValue,
  31442. style: normalizeStyle({ width: __props.element.options.width }),
  31443. disabled: __props.element.options.disabled
  31444. }, {
  31445. default: withCtx(() => [
  31446. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  31447. return openBlock(), createBlock(_component_el_checkbox, {
  31448. key: item.value,
  31449. label: item.value,
  31450. style: normalizeStyle({
  31451. display: __props.element.options.inline ? "inline-block" : "block"
  31452. })
  31453. }, {
  31454. default: withCtx(() => [
  31455. createTextVNode(toDisplayString(__props.element.options.showLabel ? item.label : item.value), 1)
  31456. ]),
  31457. _: 2
  31458. }, 1032, ["label", "style"]);
  31459. }), 128))
  31460. ]),
  31461. _: 1
  31462. }, 8, ["model-value", "style", "disabled"])) : createCommentVNode("", true),
  31463. __props.element.type === "time" ? (openBlock(), createBlock(_component_el_time_picker, {
  31464. key: 6,
  31465. "model-value": __props.element.options.defaultValue,
  31466. placeholder: __props.element.options.placeholder,
  31467. readonly: __props.element.options.readonly,
  31468. editable: __props.element.options.editable,
  31469. clearable: __props.element.options.clearable,
  31470. format: __props.element.options.format,
  31471. disabled: __props.element.options.disabled,
  31472. style: normalizeStyle({ width: __props.element.options.width })
  31473. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  31474. __props.element.type === "date" ? (openBlock(), createBlock(_component_el_date_picker, {
  31475. key: 7,
  31476. "model-value": __props.element.options.defaultValue,
  31477. placeholder: __props.element.options.placeholder,
  31478. readonly: __props.element.options.readonly,
  31479. editable: __props.element.options.editable,
  31480. clearable: __props.element.options.clearable,
  31481. format: __props.element.options.format,
  31482. disabled: __props.element.options.disabled,
  31483. style: normalizeStyle({ width: __props.element.options.width })
  31484. }, null, 8, ["model-value", "placeholder", "readonly", "editable", "clearable", "format", "disabled", "style"])) : createCommentVNode("", true),
  31485. __props.element.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  31486. key: 8,
  31487. "model-value": __props.element.options.defaultValue,
  31488. max: __props.element.options.max,
  31489. "allow-half": __props.element.options.allowHalf,
  31490. disabled: __props.element.options.disabled
  31491. }, null, 8, ["model-value", "max", "allow-half", "disabled"])) : createCommentVNode("", true),
  31492. __props.element.type === "select" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
  31493. unref(userInfo).userNameNeedTranslate == 1 && __props.element.options.remoteFunc.indexOf("getSimpleActiveUserListNew") > -1 ? (openBlock(), createBlock(_sfc_main$9, {
  31494. key: 0,
  31495. "model-value": __props.element.options.defaultValue,
  31496. multiple: __props.element.options.multiple,
  31497. placeholder: __props.element.options.placeholder,
  31498. clearable: __props.element.options.clearable,
  31499. filterable: __props.element.options.filterable,
  31500. disabled: __props.element.options.disabled,
  31501. url: __props.element.options.remoteFunc,
  31502. size: __props.configurationItems.size,
  31503. options: [],
  31504. style: normalizeStyle({ width: __props.element.options.width })
  31505. }, null, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "url", "size", "style"])) : (openBlock(), createBlock(_component_el_select, {
  31506. key: 1,
  31507. "model-value": __props.element.options.defaultValue,
  31508. multiple: __props.element.options.multiple,
  31509. placeholder: __props.element.options.placeholder,
  31510. clearable: __props.element.options.clearable,
  31511. filterable: __props.element.options.filterable,
  31512. disabled: __props.element.options.disabled,
  31513. style: normalizeStyle({ width: __props.element.options.width })
  31514. }, {
  31515. default: withCtx(() => [
  31516. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.element.options.options, (item) => {
  31517. return openBlock(), createBlock(_component_el_option, {
  31518. key: item.value,
  31519. value: item.value,
  31520. label: __props.element.options.showLabel ? item.label : item.value
  31521. }, null, 8, ["value", "label"]);
  31522. }), 128))
  31523. ]),
  31524. _: 1
  31525. }, 8, ["model-value", "multiple", "placeholder", "clearable", "filterable", "disabled", "style"]))
  31526. ], 64)) : createCommentVNode("", true),
  31527. __props.element.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  31528. key: 10,
  31529. "model-value": __props.element.options.defaultValue,
  31530. "active-text": __props.element.options.activeText,
  31531. "inactive-text": __props.element.options.inactiveText,
  31532. disabled: __props.element.options.disabled
  31533. }, null, 8, ["model-value", "active-text", "inactive-text", "disabled"])) : createCommentVNode("", true),
  31534. __props.element.type === "slider" ? (openBlock(), createBlock(_component_el_slider, {
  31535. key: 11,
  31536. "model-value": __props.element.options.defaultValue,
  31537. min: __props.element.options.min,
  31538. max: __props.element.options.max,
  31539. step: __props.element.options.step,
  31540. range: __props.element.options.range,
  31541. disabled: __props.element.options.disabled,
  31542. style: normalizeStyle({ width: __props.element.options.width })
  31543. }, null, 8, ["model-value", "min", "max", "step", "range", "disabled", "style"])) : createCommentVNode("", true),
  31544. __props.element.type == "text" ? (openBlock(), createElementBlock("span", _hoisted_1$4, toDisplayString(__props.element.options.defaultValue), 1)) : createCommentVNode("", true),
  31545. __props.element.type === "img-upload" ? (openBlock(), createBlock(_component_el_upload, {
  31546. key: 13,
  31547. name: __props.element.options.file,
  31548. action: __props.element.options.action,
  31549. accept: __props.element.options.accept,
  31550. "list-type": __props.element.options.listType,
  31551. multiple: __props.element.options.multiple,
  31552. limit: __props.element.options.limit,
  31553. disabled: __props.element.options.disabled
  31554. }, {
  31555. default: withCtx(() => {
  31556. var _a3;
  31557. return [
  31558. __props.element.options.listType === "picture-card" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  31559. ((_a3 = __props.element.options.defaultValue) == null ? void 0 : _a3.length) ? (openBlock(), createBlock(_component_el_image, {
  31560. key: 0,
  31561. style: { "width": "100%", "height": "100%" },
  31562. "preview-src-list": [
  31563. "/api/sys/common/static/" + __props.element.options.defaultValue
  31564. ],
  31565. src: "/api/sys/common/static/" + __props.element.options.defaultValue
  31566. }, null, 8, ["preview-src-list", "src"])) : (openBlock(), createElementBlock("i", _hoisted_2$3))
  31567. ], 64)) : (openBlock(), createBlock(_component_el_button, { key: 1 }, {
  31568. default: withCtx(() => [
  31569. _hoisted_3$3,
  31570. _hoisted_4$3
  31571. ]),
  31572. _: 1
  31573. }))
  31574. ];
  31575. }),
  31576. _: 1
  31577. }, 8, ["name", "action", "accept", "list-type", "multiple", "limit", "disabled"])) : createCommentVNode("", true),
  31578. __props.element.type === "download" ? (openBlock(), createBlock(_component_el_button, {
  31579. key: 14,
  31580. type: "text",
  31581. style: { "margin-top": "-4px" }
  31582. }, {
  31583. default: withCtx(() => [
  31584. _hoisted_5$3
  31585. ]),
  31586. _: 1
  31587. })) : createCommentVNode("", true),
  31588. __props.element.type === "cascader" ? (openBlock(), createBlock(_component_el_cascader, {
  31589. key: 15,
  31590. "model-value": __props.element.options.defaultValue,
  31591. options: __props.element.options.remoteOptions,
  31592. placeholder: __props.element.options.placeholder,
  31593. filterable: __props.element.options.filterable,
  31594. clearable: __props.element.options.clearable,
  31595. disabled: __props.element.options.disabled,
  31596. style: normalizeStyle({ width: __props.element.options.width })
  31597. }, null, 8, ["model-value", "options", "placeholder", "filterable", "clearable", "disabled", "style"])) : createCommentVNode("", true)
  31598. ]),
  31599. _: 1
  31600. }, 8, ["label", "label-width", "rules"])) : createCommentVNode("", true),
  31601. ((_b2 = selectWidget.value) == null ? void 0 : _b2.key) === __props.element.key ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  31602. createElementVNode("div", {
  31603. absolute: "",
  31604. "z-10": "",
  31605. "left-0": "",
  31606. top: "-.5",
  31607. "bg-blue-500": "",
  31608. "text-white": "",
  31609. p: ".5 l-0 t-0",
  31610. "cursor-move": "",
  31611. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  31612. }, _hoisted_7$2, 2),
  31613. createElementVNode("div", {
  31614. absolute: "",
  31615. "z-10": "",
  31616. "right-0": "",
  31617. bottom: "-0.5",
  31618. "bg-blue-500": "",
  31619. flex: "",
  31620. "gap-1": "",
  31621. p: "1 r-.5",
  31622. "text-white": "",
  31623. "cursor-pointer": "",
  31624. class: normalizeClass({ "bg-yellow-500": __props.element.type === "grid" })
  31625. }, [
  31626. createCommentVNode("", true),
  31627. !__props.element.allDisable ? (openBlock(), createElementBlock("i", {
  31628. key: 1,
  31629. class: "fa6-regular:trash-can",
  31630. onClick: _cache[2] || (_cache[2] = withModifiers(($event) => handleDeleteClick(), ["stop"]))
  31631. })) : createCommentVNode("", true)
  31632. ], 2)
  31633. ], 64)) : createCommentVNode("", true)
  31634. ], 6);
  31635. };
  31636. }
  31637. });
  31638. var WidgetForm_vue_vue_type_style_index_0_lang = "";
  31639. const _hoisted_1$3 = {
  31640. key: 0,
  31641. text: "gray-400 lg",
  31642. absolute: "",
  31643. "top-50": "",
  31644. left: "1/2",
  31645. "translate-x": "-1/2"
  31646. };
  31647. const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  31648. props: {
  31649. list: null,
  31650. config: null,
  31651. selectWidget: null
  31652. },
  31653. emits: ["update:selectWidget"],
  31654. setup(__props) {
  31655. const props = __props;
  31656. const selectWidget = useVModel(props, "selectWidget");
  31657. return (_ctx, _cache) => {
  31658. const _component_el_form = ElForm;
  31659. return openBlock(), createBlock(_component_el_form, mergeProps({
  31660. "label-suffix": ":",
  31661. "bg-gray-50": "",
  31662. relative: "",
  31663. flex: "~ 1"
  31664. }, __props.config, { class: "layoutForm" }), {
  31665. default: withCtx(() => {
  31666. var _a2;
  31667. return [
  31668. !((_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),
  31669. createVNode(unref(Draggable), {
  31670. class: "flex-1 m-2 bg-white shadow p-1",
  31671. "item-key": "key",
  31672. handle: "[cursor-move]",
  31673. animation: 200,
  31674. group: "form-design",
  31675. list: __props.list,
  31676. onAdd: _cache[1] || (_cache[1] = ($event) => selectWidget.value = __props.list[$event.newIndex])
  31677. }, {
  31678. item: withCtx(({ element, index }) => [
  31679. createVNode(_sfc_main$5, {
  31680. selectWidget: unref(selectWidget),
  31681. "onUpdate:selectWidget": _cache[0] || (_cache[0] = ($event) => isRef(selectWidget) ? selectWidget.value = $event : null),
  31682. element,
  31683. index,
  31684. list: __props.list,
  31685. configurationItems: __props.config
  31686. }, null, 8, ["selectWidget", "element", "index", "list", "configurationItems"])
  31687. ]),
  31688. _: 1
  31689. }, 8, ["list"])
  31690. ];
  31691. }),
  31692. _: 1
  31693. }, 16);
  31694. };
  31695. }
  31696. });
  31697. var elSpace = "";
  31698. var elRadioButton = "";
  31699. var WidgetConfig_vue_vue_type_style_index_0_lang = "";
  31700. const _sfc_main$3 = defineComponent({
  31701. name: "ElWidgetConfig",
  31702. components: {
  31703. Draggable
  31704. },
  31705. props: {
  31706. select: {
  31707. type: Object
  31708. }
  31709. },
  31710. emits: ["update:select"],
  31711. setup(props, context) {
  31712. const data2 = ref(props.select);
  31713. watch(() => props.select, (val) => data2.value = val);
  31714. watch(data2, (val) => context.emit("update:select", val), { deep: true });
  31715. const hasKey = (key) => Object.keys(data2.value.options).includes(key);
  31716. const handleInsertColumn = () => {
  31717. data2.value.columns.push({
  31718. span: 0,
  31719. list: []
  31720. });
  31721. };
  31722. const handleInsertOption = () => {
  31723. const index = data2.value.options.options.length + 1;
  31724. data2.value.options.options.push({
  31725. label: `Option ${index}`,
  31726. value: `Option ${index}`
  31727. });
  31728. };
  31729. const handleOptionsRemove = (index) => {
  31730. if (data2.value.type === "grid")
  31731. data2.value.columns.splice(index, 1);
  31732. else
  31733. data2.value.options.options.splice(index, 1);
  31734. };
  31735. const handleSliderModeChange = (checked) => {
  31736. checked ? data2.value.options.defaultValue = [10, 90] : data2.value.options.defaultValue = 0;
  31737. };
  31738. const handleSelectModeChange = (val) => {
  31739. if (data2.value.type === "img-upload")
  31740. return;
  31741. if (val) {
  31742. if (data2.value.options.defaultValue) {
  31743. if (!(data2.value.options.defaultValue instanceof Array))
  31744. data2.value.options.defaultValue = [data2.value.options.defaultValue];
  31745. } else {
  31746. data2.value.options.defaultValue = [];
  31747. }
  31748. } else {
  31749. data2.value.options.defaultValue.length ? data2.value.options.defaultValue = data2.value.options.defaultValue[0] : data2.value.options.defaultValue = null;
  31750. }
  31751. };
  31752. return {
  31753. data: data2,
  31754. hasKey,
  31755. handleInsertColumn,
  31756. handleInsertOption,
  31757. handleOptionsRemove,
  31758. handleSliderModeChange,
  31759. handleSelectModeChange
  31760. };
  31761. }
  31762. });
  31763. const _hoisted_1$2 = /* @__PURE__ */ createTextVNode(" \u884C\u5185 ");
  31764. const _hoisted_2$2 = /* @__PURE__ */ createTextVNode(" \u5757\u7EA7 ");
  31765. const _hoisted_3$2 = /* @__PURE__ */ createTextVNode(" \u9759\u6001\u6570\u636E ");
  31766. const _hoisted_4$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u6570\u636E ");
  31767. const _hoisted_5$2 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  31768. const _hoisted_6$2 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  31769. const _hoisted_7$1 = /* @__PURE__ */ createTextVNode(" \u503C ");
  31770. const _hoisted_8$1 = { class: "flex items-center" };
  31771. const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("i", {
  31772. style: { "margin": "0 5px", "cursor": "move" },
  31773. class: "drag-item custom:item"
  31774. }, null, -1);
  31775. const _hoisted_10$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  31776. const _hoisted_11$1 = { class: "flex items-center justify-center gap-2 mb-2" };
  31777. const _hoisted_12$1 = /* @__PURE__ */ createTextVNode(/* @__PURE__ */ toDisplayString(""));
  31778. const _hoisted_13$1 = /* @__PURE__ */ createElementVNode("i", { class: "cursor-move text-sm custom:item" }, null, -1);
  31779. const _hoisted_14$1 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  31780. const _hoisted_15 = { style: { "margin-top": "5px" } };
  31781. const _hoisted_16 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u9009\u9879 ");
  31782. const _hoisted_17 = /* @__PURE__ */ createTextVNode(" text ");
  31783. const _hoisted_18 = /* @__PURE__ */ createTextVNode(" picture ");
  31784. const _hoisted_19 = /* @__PURE__ */ createTextVNode(" picture-card ");
  31785. const _hoisted_20 = /* @__PURE__ */ createTextVNode(" POST ");
  31786. const _hoisted_21 = /* @__PURE__ */ createTextVNode(" PUT ");
  31787. const _hoisted_22 = /* @__PURE__ */ createTextVNode(" GET ");
  31788. const _hoisted_23 = /* @__PURE__ */ createTextVNode(" DELETE ");
  31789. const _hoisted_24 = /* @__PURE__ */ createTextVNode(" \u8FDC\u7AEF\u65B9\u6CD5 ");
  31790. const _hoisted_25 = /* @__PURE__ */ createTextVNode(" \u6807\u7B7E ");
  31791. const _hoisted_26 = /* @__PURE__ */ createTextVNode(" \u503C ");
  31792. const _hoisted_27 = /* @__PURE__ */ createTextVNode(" \u5B50\u9009\u9879 ");
  31793. const _hoisted_28 = { style: { "display": "flex", "gap": "5px", "margin-bottom": "5px" } };
  31794. const _hoisted_29 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  31795. const _hoisted_30 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  31796. const _hoisted_31 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  31797. const _hoisted_32 = /* @__PURE__ */ createTextVNode(" \u5C45\u5DE6\u5BF9\u9F50 ");
  31798. const _hoisted_33 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  31799. const _hoisted_34 = /* @__PURE__ */ createTextVNode(" \u5DE8\u53F3\u5BF9\u9F50 ");
  31800. const _hoisted_35 = { style: { "margin-bottom": "5px" } };
  31801. const _hoisted_36 = /* @__PURE__ */ createElementVNode("i", { class: "drag-item custom:item" }, null, -1);
  31802. const _hoisted_37 = /* @__PURE__ */ createElementVNode("i", { class: "fa6-regular:trash-can" }, null, -1);
  31803. const _hoisted_38 = /* @__PURE__ */ createTextVNode(" \u6DFB\u52A0\u5217 ");
  31804. const _hoisted_39 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  31805. const _hoisted_40 = /* @__PURE__ */ createTextVNode(" \u5C45\u4E2D\u5BF9\u9F50 ");
  31806. const _hoisted_41 = /* @__PURE__ */ createTextVNode(" \u5E95\u90E8\u5BF9\u9F50 ");
  31807. const _hoisted_42 = /* @__PURE__ */ createTextVNode(" \u5FC5\u586B ");
  31808. const _hoisted_43 = /* @__PURE__ */ createTextVNode(" \u53EA\u8BFB ");
  31809. const _hoisted_44 = /* @__PURE__ */ createTextVNode(" \u7981\u7528 ");
  31810. const _hoisted_45 = /* @__PURE__ */ createTextVNode(" \u6E05\u9664 ");
  31811. 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);
  31812. const _hoisted_47 = /* @__PURE__ */ createTextVNode(" Blur ");
  31813. const _hoisted_48 = /* @__PURE__ */ createTextVNode(" Change ");
  31814. const _hoisted_49 = /* @__PURE__ */ createTextVNode(" \u5B57\u7B26\u4E32 ");
  31815. const _hoisted_50 = /* @__PURE__ */ createTextVNode(" \u6570\u5B57 ");
  31816. const _hoisted_51 = /* @__PURE__ */ createTextVNode(" \u5E03\u5C14\u503C ");
  31817. const _hoisted_52 = /* @__PURE__ */ createTextVNode(" \u65B9\u6CD5 ");
  31818. const _hoisted_53 = /* @__PURE__ */ createTextVNode(" \u6B63\u5219\u8868\u8FBE\u5F0F ");
  31819. const _hoisted_54 = /* @__PURE__ */ createTextVNode(" \u6574\u6570 ");
  31820. const _hoisted_55 = /* @__PURE__ */ createTextVNode(" \u6D6E\u70B9\u6570 ");
  31821. const _hoisted_56 = /* @__PURE__ */ createTextVNode(" \u6570\u7EC4 ");
  31822. const _hoisted_57 = /* @__PURE__ */ createTextVNode(" \u5BF9\u8C61 ");
  31823. const _hoisted_58 = /* @__PURE__ */ createTextVNode(" \u679A\u4E3E ");
  31824. const _hoisted_59 = /* @__PURE__ */ createTextVNode(" \u65E5\u671F ");
  31825. const _hoisted_60 = /* @__PURE__ */ createTextVNode(" URL\u5730\u5740 ");
  31826. const _hoisted_61 = /* @__PURE__ */ createTextVNode(" \u5341\u516D\u8FDB\u5236 ");
  31827. const _hoisted_62 = /* @__PURE__ */ createTextVNode(" \u90AE\u7BB1\u5730\u5740 ");
  31828. const _hoisted_63 = /* @__PURE__ */ createTextVNode(" \u4EFB\u610F\u7C7B\u578B ");
  31829. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  31830. const _component_el_input = ElInput;
  31831. const _component_el_form_item = ElFormItem;
  31832. const _component_el_rate = ElRate;
  31833. const _component_el_switch = ElSwitch;
  31834. const _component_el_input_number = ElInputNumber;
  31835. const _component_el_radio_button = ElRadioButton;
  31836. const _component_el_radio_group = ElRadioGroup;
  31837. const _component_el_space = ElSpace;
  31838. const _component_el_radio = ElRadio;
  31839. const _component_el_button = ElButton;
  31840. const _component_Draggable = resolveComponent("Draggable");
  31841. const _component_el_checkbox = ElCheckbox;
  31842. const _component_el_checkbox_group = ElCheckboxGroup$1;
  31843. const _component_el_time_picker = ElTimePicker;
  31844. const _component_el_date_picker = ElDatePicker;
  31845. const _component_el_option = ElOption;
  31846. const _component_el_select = ElSelect;
  31847. const _component_el_form = ElForm;
  31848. return _ctx.data ? (openBlock(), createBlock(_component_el_form, {
  31849. key: _ctx.data.key,
  31850. "label-position": "top",
  31851. "p-2": "",
  31852. "flex-1": "",
  31853. "overflow-auto": ""
  31854. }, {
  31855. default: withCtx(() => [
  31856. !["grid"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  31857. key: 0,
  31858. label: "\u5B57\u6BB5\u6807\u8BC6"
  31859. }, {
  31860. default: withCtx(() => [
  31861. createVNode(_component_el_input, {
  31862. modelValue: _ctx.data.model,
  31863. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data.model = $event),
  31864. disabled: true
  31865. }, null, 8, ["modelValue"])
  31866. ]),
  31867. _: 1
  31868. })) : createCommentVNode("", true),
  31869. !["grid", "table"].includes(_ctx.data.type) ? (openBlock(), createBlock(_component_el_form_item, {
  31870. key: 1,
  31871. label: "\u6807\u9898"
  31872. }, {
  31873. default: withCtx(() => [
  31874. createVNode(_component_el_input, {
  31875. modelValue: _ctx.data.label,
  31876. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data.label = $event),
  31877. disabled: _ctx.data.allDisable
  31878. }, null, 8, ["modelValue", "disabled"])
  31879. ]),
  31880. _: 1
  31881. })) : createCommentVNode("", true),
  31882. _ctx.hasKey("width") ? (openBlock(), createBlock(_component_el_form_item, {
  31883. key: 2,
  31884. label: "\u5BBD\u5EA6"
  31885. }, {
  31886. default: withCtx(() => [
  31887. createVNode(_component_el_input, {
  31888. modelValue: _ctx.data.options.width,
  31889. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.data.options.width = $event)
  31890. }, null, 8, ["modelValue"])
  31891. ]),
  31892. _: 1
  31893. })) : createCommentVNode("", true),
  31894. _ctx.hasKey("placeholder") ? (openBlock(), createBlock(_component_el_form_item, {
  31895. key: 3,
  31896. label: "\u5360\u4F4D\u5185\u5BB9"
  31897. }, {
  31898. default: withCtx(() => [
  31899. createVNode(_component_el_input, {
  31900. modelValue: _ctx.data.options.placeholder,
  31901. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => _ctx.data.options.placeholder = $event),
  31902. disabled: _ctx.data.allDisable
  31903. }, null, 8, ["modelValue", "disabled"])
  31904. ]),
  31905. _: 1
  31906. })) : createCommentVNode("", true),
  31907. _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, {
  31908. key: 4,
  31909. label: "\u9ED8\u8BA4\u5185\u5BB9"
  31910. }, {
  31911. default: withCtx(() => [
  31912. _ctx.data.type === "input" || _ctx.data.type === "password" || _ctx.data.type === "text" ? (openBlock(), createBlock(_component_el_input, {
  31913. key: 0,
  31914. modelValue: _ctx.data.options.defaultValue,
  31915. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.data.options.defaultValue = $event)
  31916. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  31917. _ctx.data.type === "textarea" ? (openBlock(), createBlock(_component_el_input, {
  31918. key: 1,
  31919. modelValue: _ctx.data.options.defaultValue,
  31920. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => _ctx.data.options.defaultValue = $event),
  31921. type: "textarea"
  31922. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  31923. _ctx.data.type === "rate" ? (openBlock(), createBlock(_component_el_rate, {
  31924. key: 2,
  31925. modelValue: _ctx.data.options.defaultValue,
  31926. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => _ctx.data.options.defaultValue = $event),
  31927. max: _ctx.data.options.max,
  31928. "allow-half": _ctx.data.options.allowHalf
  31929. }, null, 8, ["modelValue", "max", "allow-half"])) : createCommentVNode("", true),
  31930. _ctx.data.type === "switch" ? (openBlock(), createBlock(_component_el_switch, {
  31931. key: 3,
  31932. modelValue: _ctx.data.options.defaultValue,
  31933. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.data.options.defaultValue = $event)
  31934. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  31935. _ctx.data.type === "slider" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
  31936. !_ctx.data.options.range ? (openBlock(), createBlock(_component_el_input_number, {
  31937. key: 0,
  31938. modelValue: _ctx.data.options.defaultValue,
  31939. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => _ctx.data.options.defaultValue = $event),
  31940. modelModifiers: { number: true }
  31941. }, null, 8, ["modelValue"])) : createCommentVNode("", true),
  31942. _ctx.data.options.range ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  31943. createVNode(_component_el_input_number, {
  31944. modelValue: _ctx.data.options.defaultValue[0],
  31945. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => _ctx.data.options.defaultValue[0] = $event),
  31946. modelModifiers: { number: true },
  31947. max: _ctx.data.options.max
  31948. }, null, 8, ["modelValue", "max"]),
  31949. createVNode(_component_el_input_number, {
  31950. modelValue: _ctx.data.options.defaultValue[1],
  31951. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => _ctx.data.options.defaultValue[1] = $event),
  31952. modelModifiers: { number: true },
  31953. max: _ctx.data.options.max
  31954. }, null, 8, ["modelValue", "max"])
  31955. ], 64)) : createCommentVNode("", true)
  31956. ], 64)) : createCommentVNode("", true)
  31957. ]),
  31958. _: 1
  31959. })) : createCommentVNode("", true),
  31960. _ctx.hasKey("maxlength") ? (openBlock(), createBlock(_component_el_form_item, {
  31961. key: 5,
  31962. label: "\u6700\u5927\u957F\u5EA6"
  31963. }, {
  31964. default: withCtx(() => [
  31965. createVNode(_component_el_input, {
  31966. modelValue: _ctx.data.options.maxlength,
  31967. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => _ctx.data.options.maxlength = $event),
  31968. modelModifiers: { number: true },
  31969. disabled: _ctx.data.allDisable
  31970. }, null, 8, ["modelValue", "disabled"])
  31971. ]),
  31972. _: 1
  31973. })) : createCommentVNode("", true),
  31974. _ctx.hasKey("max") ? (openBlock(), createBlock(_component_el_form_item, {
  31975. key: 6,
  31976. label: "\u6700\u5927\u503C"
  31977. }, {
  31978. default: withCtx(() => [
  31979. createVNode(_component_el_input_number, {
  31980. modelValue: _ctx.data.options.max,
  31981. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => _ctx.data.options.max = $event),
  31982. modelModifiers: { number: true },
  31983. disabled: _ctx.data.allDisable
  31984. }, null, 8, ["modelValue", "disabled"])
  31985. ]),
  31986. _: 1
  31987. })) : createCommentVNode("", true),
  31988. _ctx.hasKey("min") ? (openBlock(), createBlock(_component_el_form_item, {
  31989. key: 7,
  31990. label: "\u6700\u5C0F\u503C"
  31991. }, {
  31992. default: withCtx(() => [
  31993. createVNode(_component_el_input_number, {
  31994. modelValue: _ctx.data.options.min,
  31995. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => _ctx.data.options.min = $event),
  31996. modelModifiers: { number: true },
  31997. disabled: _ctx.data.allDisable
  31998. }, null, 8, ["modelValue", "disabled"])
  31999. ]),
  32000. _: 1
  32001. })) : createCommentVNode("", true),
  32002. _ctx.hasKey("step") ? (openBlock(), createBlock(_component_el_form_item, {
  32003. key: 8,
  32004. label: "\u6B65\u957F"
  32005. }, {
  32006. default: withCtx(() => [
  32007. createVNode(_component_el_input_number, {
  32008. modelValue: _ctx.data.options.step,
  32009. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => _ctx.data.options.step = $event),
  32010. modelModifiers: { number: true },
  32011. min: 0,
  32012. disabled: _ctx.data.allDisable
  32013. }, null, 8, ["modelValue", "disabled"])
  32014. ]),
  32015. _: 1
  32016. })) : createCommentVNode("", true),
  32017. _ctx.hasKey("prefix") ? (openBlock(), createBlock(_component_el_form_item, {
  32018. key: 9,
  32019. label: "\u524D\u7F00"
  32020. }, {
  32021. default: withCtx(() => [
  32022. createVNode(_component_el_input, {
  32023. modelValue: _ctx.data.options.prefix,
  32024. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.data.options.prefix = $event),
  32025. disabled: _ctx.data.allDisable
  32026. }, null, 8, ["modelValue", "disabled"])
  32027. ]),
  32028. _: 1
  32029. })) : createCommentVNode("", true),
  32030. _ctx.hasKey("suffix") ? (openBlock(), createBlock(_component_el_form_item, {
  32031. key: 10,
  32032. label: "\u540E\u7F00"
  32033. }, {
  32034. default: withCtx(() => [
  32035. createVNode(_component_el_input, {
  32036. modelValue: _ctx.data.options.suffix,
  32037. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.data.options.suffix = $event),
  32038. disabled: _ctx.data.allDisable
  32039. }, null, 8, ["modelValue", "disabled"])
  32040. ]),
  32041. _: 1
  32042. })) : createCommentVNode("", true),
  32043. _ctx.hasKey("prepend") ? (openBlock(), createBlock(_component_el_form_item, {
  32044. key: 11,
  32045. label: "\u524D\u7F6E\u6807\u7B7E"
  32046. }, {
  32047. default: withCtx(() => [
  32048. createVNode(_component_el_input, {
  32049. modelValue: _ctx.data.options.prepend,
  32050. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => _ctx.data.options.prepend = $event),
  32051. disabled: _ctx.data.allDisable
  32052. }, null, 8, ["modelValue", "disabled"])
  32053. ]),
  32054. _: 1
  32055. })) : createCommentVNode("", true),
  32056. _ctx.hasKey("append") ? (openBlock(), createBlock(_component_el_form_item, {
  32057. key: 12,
  32058. label: "\u540E\u7F6E\u6807\u7B7E"
  32059. }, {
  32060. default: withCtx(() => [
  32061. createVNode(_component_el_input, {
  32062. modelValue: _ctx.data.options.append,
  32063. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => _ctx.data.options.append = $event),
  32064. disabled: _ctx.data.allDisable
  32065. }, null, 8, ["modelValue", "disabled"])
  32066. ]),
  32067. _: 1
  32068. })) : createCommentVNode("", true),
  32069. _ctx.hasKey("activeText") ? (openBlock(), createBlock(_component_el_form_item, {
  32070. key: 13,
  32071. label: "\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  32072. }, {
  32073. default: withCtx(() => [
  32074. createVNode(_component_el_input, {
  32075. modelValue: _ctx.data.options.activeText,
  32076. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => _ctx.data.options.activeText = $event)
  32077. }, null, 8, ["modelValue"])
  32078. ]),
  32079. _: 1
  32080. })) : createCommentVNode("", true),
  32081. _ctx.hasKey("inactiveText") ? (openBlock(), createBlock(_component_el_form_item, {
  32082. key: 14,
  32083. label: "\u975E\u9009\u4E2D\u65F6\u7684\u5185\u5BB9"
  32084. }, {
  32085. default: withCtx(() => [
  32086. createVNode(_component_el_input, {
  32087. modelValue: _ctx.data.options.inactiveText,
  32088. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => _ctx.data.options.inactiveText = $event)
  32089. }, null, 8, ["modelValue"])
  32090. ]),
  32091. _: 1
  32092. })) : createCommentVNode("", true),
  32093. _ctx.hasKey("editable") ? (openBlock(), createBlock(_component_el_form_item, {
  32094. key: 15,
  32095. label: "\u6587\u672C\u6846\u53EF\u8F93\u5165"
  32096. }, {
  32097. default: withCtx(() => [
  32098. createVNode(_component_el_switch, {
  32099. modelValue: _ctx.data.options.editable,
  32100. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => _ctx.data.options.editable = $event)
  32101. }, null, 8, ["modelValue"])
  32102. ]),
  32103. _: 1
  32104. })) : createCommentVNode("", true),
  32105. _ctx.hasKey("range") ? (openBlock(), createBlock(_component_el_form_item, {
  32106. key: 16,
  32107. label: "\u8303\u56F4\u9009\u62E9"
  32108. }, {
  32109. default: withCtx(() => [
  32110. createVNode(_component_el_switch, {
  32111. modelValue: _ctx.data.options.range,
  32112. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => _ctx.data.options.range = $event),
  32113. onChange: _ctx.handleSliderModeChange
  32114. }, null, 8, ["modelValue", "onChange"])
  32115. ]),
  32116. _: 1
  32117. })) : createCommentVNode("", true),
  32118. _ctx.hasKey("showPassword") ? (openBlock(), createBlock(_component_el_form_item, {
  32119. key: 17,
  32120. label: "\u662F\u5426\u663E\u793A\u5207\u6362\u6309\u94AE"
  32121. }, {
  32122. default: withCtx(() => [
  32123. createVNode(_component_el_switch, {
  32124. modelValue: _ctx.data.options.showPassword,
  32125. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => _ctx.data.options.showPassword = $event)
  32126. }, null, 8, ["modelValue"])
  32127. ]),
  32128. _: 1
  32129. })) : createCommentVNode("", true),
  32130. _ctx.hasKey("showWordLimit") ? (openBlock(), createBlock(_component_el_form_item, {
  32131. key: 18,
  32132. label: "\u662F\u5426\u663E\u793A\u5B57\u6570"
  32133. }, {
  32134. default: withCtx(() => [
  32135. createVNode(_component_el_switch, {
  32136. modelValue: _ctx.data.options.showWordLimit,
  32137. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => _ctx.data.options.showWordLimit = $event)
  32138. }, null, 8, ["modelValue"])
  32139. ]),
  32140. _: 1
  32141. })) : createCommentVNode("", true),
  32142. _ctx.hasKey("autosize") ? (openBlock(), createBlock(_component_el_form_item, {
  32143. key: 19,
  32144. label: "\u662F\u5426\u81EA\u9002\u5E94\u5185\u5BB9\u9AD8\u5EA6"
  32145. }, {
  32146. default: withCtx(() => [
  32147. createVNode(_component_el_switch, {
  32148. modelValue: _ctx.data.options.autosize,
  32149. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => _ctx.data.options.autosize = $event)
  32150. }, null, 8, ["modelValue"])
  32151. ]),
  32152. _: 1
  32153. })) : createCommentVNode("", true),
  32154. _ctx.hasKey("rows") && !_ctx.data.options.autosize ? (openBlock(), createBlock(_component_el_form_item, {
  32155. key: 20,
  32156. label: "\u884C\u6570"
  32157. }, {
  32158. default: withCtx(() => [
  32159. createVNode(_component_el_input_number, {
  32160. modelValue: _ctx.data.options.rows,
  32161. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => _ctx.data.options.rows = $event),
  32162. min: 0
  32163. }, null, 8, ["modelValue"])
  32164. ]),
  32165. _: 1
  32166. })) : createCommentVNode("", true),
  32167. _ctx.hasKey("allowHalf") ? (openBlock(), createBlock(_component_el_form_item, {
  32168. key: 21,
  32169. label: "\u662F\u5426\u5141\u8BB8\u534A\u9009"
  32170. }, {
  32171. default: withCtx(() => [
  32172. createVNode(_component_el_switch, {
  32173. modelValue: _ctx.data.options.allowHalf,
  32174. "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => _ctx.data.options.allowHalf = $event)
  32175. }, null, 8, ["modelValue"])
  32176. ]),
  32177. _: 1
  32178. })) : createCommentVNode("", true),
  32179. _ctx.hasKey("inline") ? (openBlock(), createBlock(_component_el_form_item, {
  32180. key: 22,
  32181. label: "\u5E03\u5C40\u65B9\u5F0F"
  32182. }, {
  32183. default: withCtx(() => [
  32184. createVNode(_component_el_radio_group, {
  32185. modelValue: _ctx.data.options.inline,
  32186. "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => _ctx.data.options.inline = $event)
  32187. }, {
  32188. default: withCtx(() => [
  32189. createVNode(_component_el_radio_button, { label: true }, {
  32190. default: withCtx(() => [
  32191. _hoisted_1$2
  32192. ]),
  32193. _: 1
  32194. }),
  32195. createVNode(_component_el_radio_button, { label: false }, {
  32196. default: withCtx(() => [
  32197. _hoisted_2$2
  32198. ]),
  32199. _: 1
  32200. })
  32201. ]),
  32202. _: 1
  32203. }, 8, ["modelValue"])
  32204. ]),
  32205. _: 1
  32206. })) : createCommentVNode("", true),
  32207. _ctx.hasKey("multiple") ? (openBlock(), createBlock(_component_el_form_item, {
  32208. key: 23,
  32209. label: "\u662F\u5426\u591A\u9009"
  32210. }, {
  32211. default: withCtx(() => [
  32212. createVNode(_component_el_switch, {
  32213. modelValue: _ctx.data.options.multiple,
  32214. "onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => _ctx.data.options.multiple = $event),
  32215. onChange: _ctx.handleSelectModeChange,
  32216. disabled: _ctx.data.allDisable
  32217. }, null, 8, ["modelValue", "onChange", "disabled"])
  32218. ]),
  32219. _: 1
  32220. })) : createCommentVNode("", true),
  32221. _ctx.hasKey("filterable") ? (openBlock(), createBlock(_component_el_form_item, {
  32222. key: 24,
  32223. label: "\u662F\u5426\u53EF\u641C\u7D22"
  32224. }, {
  32225. default: withCtx(() => [
  32226. createVNode(_component_el_switch, {
  32227. modelValue: _ctx.data.options.filterable,
  32228. "onUpdate:modelValue": _cache[30] || (_cache[30] = ($event) => _ctx.data.options.filterable = $event),
  32229. disabled: _ctx.data.allDisable
  32230. }, null, 8, ["modelValue", "disabled"])
  32231. ]),
  32232. _: 1
  32233. })) : createCommentVNode("", true),
  32234. _ctx.hasKey("showLabel") ? (openBlock(), createBlock(_component_el_form_item, {
  32235. key: 25,
  32236. label: "\u662F\u5426\u663E\u793A\u6807\u7B7E"
  32237. }, {
  32238. default: withCtx(() => [
  32239. createVNode(_component_el_switch, {
  32240. modelValue: _ctx.data.options.showLabel,
  32241. "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => _ctx.data.options.showLabel = $event)
  32242. }, null, 8, ["modelValue"])
  32243. ]),
  32244. _: 1
  32245. })) : createCommentVNode("", true),
  32246. _ctx.hasKey("options") ? (openBlock(), createBlock(_component_el_form_item, {
  32247. key: 26,
  32248. label: "\u9009\u9879"
  32249. }, {
  32250. default: withCtx(() => [
  32251. createVNode(_component_el_radio_group, {
  32252. modelValue: _ctx.data.options.remote,
  32253. "onUpdate:modelValue": _cache[32] || (_cache[32] = ($event) => _ctx.data.options.remote = $event)
  32254. }, {
  32255. default: withCtx(() => [
  32256. createVNode(_component_el_radio_button, { label: false }, {
  32257. default: withCtx(() => [
  32258. _hoisted_3$2
  32259. ]),
  32260. _: 1
  32261. }),
  32262. createVNode(_component_el_radio_button, { label: true }, {
  32263. default: withCtx(() => [
  32264. _hoisted_4$2
  32265. ]),
  32266. _: 1
  32267. })
  32268. ]),
  32269. _: 1
  32270. }, 8, ["modelValue"]),
  32271. _ctx.data.options.remote ? (openBlock(), createBlock(_component_el_space, {
  32272. key: 0,
  32273. alignment: "start",
  32274. direction: "vertical",
  32275. style: { "margin-top": "10px" }
  32276. }, {
  32277. default: withCtx(() => [
  32278. createVNode(_component_el_input, {
  32279. modelValue: _ctx.data.options.remoteFunc,
  32280. "onUpdate:modelValue": _cache[33] || (_cache[33] = ($event) => _ctx.data.options.remoteFunc = $event)
  32281. }, {
  32282. prepend: withCtx(() => [
  32283. _hoisted_5$2
  32284. ]),
  32285. _: 1
  32286. }, 8, ["modelValue"]),
  32287. createVNode(_component_el_input, {
  32288. modelValue: _ctx.data.options.props.label,
  32289. "onUpdate:modelValue": _cache[34] || (_cache[34] = ($event) => _ctx.data.options.props.label = $event)
  32290. }, {
  32291. prepend: withCtx(() => [
  32292. _hoisted_6$2
  32293. ]),
  32294. _: 1
  32295. }, 8, ["modelValue"]),
  32296. createVNode(_component_el_input, {
  32297. modelValue: _ctx.data.options.props.value,
  32298. "onUpdate:modelValue": _cache[35] || (_cache[35] = ($event) => _ctx.data.options.props.value = $event)
  32299. }, {
  32300. prepend: withCtx(() => [
  32301. _hoisted_7$1
  32302. ]),
  32303. _: 1
  32304. }, 8, ["modelValue"])
  32305. ]),
  32306. _: 1
  32307. })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  32308. _ctx.data.type === "radio" || _ctx.data.type === "select" && !_ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_radio_group, {
  32309. key: 0,
  32310. modelValue: _ctx.data.options.defaultValue,
  32311. "onUpdate:modelValue": _cache[36] || (_cache[36] = ($event) => _ctx.data.options.defaultValue = $event),
  32312. style: { "margin-top": "8px" }
  32313. }, {
  32314. default: withCtx(() => [
  32315. createVNode(_component_Draggable, {
  32316. "item-key": "index",
  32317. "ghost-class": "ghost",
  32318. handle: ".drag-item",
  32319. group: { name: "options" },
  32320. list: _ctx.data.options.options
  32321. }, {
  32322. item: withCtx(({ element, index }) => [
  32323. createElementVNode("div", _hoisted_8$1, [
  32324. createVNode(_component_el_radio, {
  32325. label: element.value,
  32326. style: { "margin-right": "0", "margin-bottom": "0" }
  32327. }, {
  32328. default: withCtx(() => [
  32329. createVNode(_component_el_input, {
  32330. modelValue: element.value,
  32331. "onUpdate:modelValue": ($event) => element.value = $event,
  32332. style: normalizeStyle({
  32333. width: _ctx.data.options.showLabel ? "90px" : "180px"
  32334. })
  32335. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  32336. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  32337. key: 0,
  32338. modelValue: element.label,
  32339. "onUpdate:modelValue": ($event) => element.label = $event,
  32340. class: "ml-1",
  32341. style: {
  32342. width: "90px"
  32343. }
  32344. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true)
  32345. ]),
  32346. _: 2
  32347. }, 1032, ["label"]),
  32348. _hoisted_9$1,
  32349. createVNode(_component_el_button, {
  32350. type: "primary",
  32351. circle: "",
  32352. onClick: ($event) => _ctx.handleOptionsRemove(index)
  32353. }, {
  32354. default: withCtx(() => [
  32355. _hoisted_10$1
  32356. ]),
  32357. _: 2
  32358. }, 1032, ["onClick"])
  32359. ])
  32360. ]),
  32361. _: 1
  32362. }, 8, ["list"])
  32363. ]),
  32364. _: 1
  32365. }, 8, ["modelValue"])) : createCommentVNode("", true),
  32366. _ctx.data.type === "checkbox" || _ctx.data.type === "select" && _ctx.data.options.multiple ? (openBlock(), createBlock(_component_el_checkbox_group, {
  32367. key: 1,
  32368. modelValue: _ctx.data.options.defaultValue,
  32369. "onUpdate:modelValue": _cache[37] || (_cache[37] = ($event) => _ctx.data.options.defaultValue = $event),
  32370. style: { "margin-top": "8px" }
  32371. }, {
  32372. default: withCtx(() => [
  32373. createVNode(_component_Draggable, {
  32374. "item-key": "index",
  32375. "ghost-class": "ghost",
  32376. handle: "[cursor-move]",
  32377. group: { name: "options" },
  32378. list: _ctx.data.options.options
  32379. }, {
  32380. item: withCtx(({ element, index }) => [
  32381. createElementVNode("div", _hoisted_11$1, [
  32382. createVNode(_component_el_checkbox, {
  32383. label: element.value
  32384. }, {
  32385. default: withCtx(() => [
  32386. _hoisted_12$1
  32387. ]),
  32388. _: 2
  32389. }, 1032, ["label"]),
  32390. createVNode(_component_el_input, {
  32391. modelValue: element.value,
  32392. "onUpdate:modelValue": ($event) => element.value = $event,
  32393. style: normalizeStyle({
  32394. width: _ctx.data.options.showLabel ? "90px" : "180px"
  32395. })
  32396. }, null, 8, ["modelValue", "onUpdate:modelValue", "style"]),
  32397. _ctx.data.options.showLabel ? (openBlock(), createBlock(_component_el_input, {
  32398. key: 0,
  32399. modelValue: element.label,
  32400. "onUpdate:modelValue": ($event) => element.label = $event,
  32401. style: { width: "90px" }
  32402. }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true),
  32403. _hoisted_13$1,
  32404. createVNode(_component_el_button, {
  32405. type: "primary",
  32406. circle: "",
  32407. onClick: ($event) => _ctx.handleOptionsRemove(index)
  32408. }, {
  32409. default: withCtx(() => [
  32410. _hoisted_14$1
  32411. ]),
  32412. _: 2
  32413. }, 1032, ["onClick"])
  32414. ])
  32415. ]),
  32416. _: 1
  32417. }, 8, ["list"])
  32418. ]),
  32419. _: 1
  32420. }, 8, ["modelValue"])) : createCommentVNode("", true),
  32421. createElementVNode("div", _hoisted_15, [
  32422. createVNode(_component_el_button, {
  32423. type: "text",
  32424. onClick: _ctx.handleInsertOption
  32425. }, {
  32426. default: withCtx(() => [
  32427. _hoisted_16
  32428. ]),
  32429. _: 1
  32430. }, 8, ["onClick"])
  32431. ])
  32432. ], 64))
  32433. ]),
  32434. _: 1
  32435. })) : createCommentVNode("", true),
  32436. _ctx.data.type === "time" ? (openBlock(), createBlock(_component_el_form_item, {
  32437. key: 27,
  32438. label: "\u9ED8\u8BA4\u503C"
  32439. }, {
  32440. default: withCtx(() => [
  32441. createVNode(_component_el_time_picker, {
  32442. modelValue: _ctx.data.options.defaultValue,
  32443. "onUpdate:modelValue": _cache[38] || (_cache[38] = ($event) => _ctx.data.options.defaultValue = $event),
  32444. style: { "width": "100%" },
  32445. format: _ctx.data.options.format,
  32446. placeholder: _ctx.data.options.placeholder
  32447. }, null, 8, ["modelValue", "format", "placeholder"])
  32448. ]),
  32449. _: 1
  32450. })) : createCommentVNode("", true),
  32451. _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  32452. key: 28,
  32453. label: "\u9ED8\u8BA4\u503C"
  32454. }, {
  32455. default: withCtx(() => [
  32456. createVNode(_component_el_date_picker, {
  32457. modelValue: _ctx.data.options.defaultValue,
  32458. "onUpdate:modelValue": _cache[39] || (_cache[39] = ($event) => _ctx.data.options.defaultValue = $event),
  32459. style: { "width": "100%" },
  32460. format: _ctx.data.options.format,
  32461. placeholder: _ctx.data.options.placeholder
  32462. }, null, 8, ["modelValue", "format", "placeholder"])
  32463. ]),
  32464. _: 1
  32465. })) : createCommentVNode("", true),
  32466. _ctx.data.type === "time" || _ctx.data.type === "date" ? (openBlock(), createBlock(_component_el_form_item, {
  32467. key: 29,
  32468. label: "\u683C\u5F0F"
  32469. }, {
  32470. default: withCtx(() => [
  32471. createVNode(_component_el_input, {
  32472. modelValue: _ctx.data.options.format,
  32473. "onUpdate:modelValue": _cache[40] || (_cache[40] = ($event) => _ctx.data.options.format = $event)
  32474. }, null, 8, ["modelValue"])
  32475. ]),
  32476. _: 1
  32477. })) : createCommentVNode("", true),
  32478. _ctx.data.type === "download" ? (openBlock(), createBlock(_component_el_form_item, {
  32479. key: 30,
  32480. label: "\u5730\u5740"
  32481. }, {
  32482. default: withCtx(() => [
  32483. createVNode(_component_el_input, {
  32484. modelValue: _ctx.data.options.defaultValue,
  32485. "onUpdate:modelValue": _cache[41] || (_cache[41] = ($event) => _ctx.data.options.defaultValue = $event)
  32486. }, null, 8, ["modelValue"])
  32487. ]),
  32488. _: 1
  32489. })) : createCommentVNode("", true),
  32490. _ctx.data.type === "img-upload" ? (openBlock(), createElementBlock(Fragment, { key: 31 }, [
  32491. createVNode(_component_el_form_item, { label: "\u6A21\u5F0F" }, {
  32492. default: withCtx(() => [
  32493. createVNode(_component_el_radio_group, {
  32494. modelValue: _ctx.data.options.listType,
  32495. "onUpdate:modelValue": _cache[42] || (_cache[42] = ($event) => _ctx.data.options.listType = $event)
  32496. }, {
  32497. default: withCtx(() => [
  32498. createVNode(_component_el_radio_button, { label: "text" }, {
  32499. default: withCtx(() => [
  32500. _hoisted_17
  32501. ]),
  32502. _: 1
  32503. }),
  32504. createVNode(_component_el_radio_button, { label: "picture" }, {
  32505. default: withCtx(() => [
  32506. _hoisted_18
  32507. ]),
  32508. _: 1
  32509. }),
  32510. createVNode(_component_el_radio_button, { label: "picture-card" }, {
  32511. default: withCtx(() => [
  32512. _hoisted_19
  32513. ]),
  32514. _: 1
  32515. })
  32516. ]),
  32517. _: 1
  32518. }, 8, ["modelValue"])
  32519. ]),
  32520. _: 1
  32521. }),
  32522. createVNode(_component_el_form_item, { label: "\u6587\u4EF6\u53C2\u6570\u540D" }, {
  32523. default: withCtx(() => [
  32524. createVNode(_component_el_input, {
  32525. modelValue: _ctx.data.options.name,
  32526. "onUpdate:modelValue": _cache[43] || (_cache[43] = ($event) => _ctx.data.options.name = $event)
  32527. }, null, 8, ["modelValue"])
  32528. ]),
  32529. _: 1
  32530. }),
  32531. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u5730\u5740" }, {
  32532. default: withCtx(() => [
  32533. createVNode(_component_el_input, {
  32534. modelValue: _ctx.data.options.action,
  32535. "onUpdate:modelValue": _cache[44] || (_cache[44] = ($event) => _ctx.data.options.action = $event)
  32536. }, null, 8, ["modelValue"])
  32537. ]),
  32538. _: 1
  32539. }),
  32540. createVNode(_component_el_form_item, { label: "\u63A5\u53D7\u4E0A\u4F20\u7684\u6587\u4EF6\u7C7B\u578B(\u591A\u4E2A\u4F7F\u7528 , \u9694\u5F00)" }, {
  32541. default: withCtx(() => [
  32542. createVNode(_component_el_input, {
  32543. modelValue: _ctx.data.options.accept,
  32544. "onUpdate:modelValue": _cache[45] || (_cache[45] = ($event) => _ctx.data.options.accept = $event)
  32545. }, null, 8, ["modelValue"])
  32546. ]),
  32547. _: 1
  32548. }),
  32549. createVNode(_component_el_form_item, { label: "\u6700\u5927\u4E0A\u4F20\u6570\u91CF" }, {
  32550. default: withCtx(() => [
  32551. createVNode(_component_el_input_number, {
  32552. modelValue: _ctx.data.options.limit,
  32553. "onUpdate:modelValue": _cache[46] || (_cache[46] = ($event) => _ctx.data.options.limit = $event),
  32554. modelModifiers: { number: true },
  32555. min: 1
  32556. }, null, 8, ["modelValue"])
  32557. ]),
  32558. _: 1
  32559. }),
  32560. createVNode(_component_el_form_item, { label: "\u4E0A\u4F20\u8BF7\u6C42\u65B9\u6CD5" }, {
  32561. default: withCtx(() => [
  32562. createVNode(_component_el_radio_group, {
  32563. modelValue: _ctx.data.options.method,
  32564. "onUpdate:modelValue": _cache[47] || (_cache[47] = ($event) => _ctx.data.options.method = $event)
  32565. }, {
  32566. default: withCtx(() => [
  32567. createVNode(_component_el_radio_button, { label: "post" }, {
  32568. default: withCtx(() => [
  32569. _hoisted_20
  32570. ]),
  32571. _: 1
  32572. }),
  32573. createVNode(_component_el_radio_button, { label: "put" }, {
  32574. default: withCtx(() => [
  32575. _hoisted_21
  32576. ]),
  32577. _: 1
  32578. }),
  32579. createVNode(_component_el_radio_button, { label: "get" }, {
  32580. default: withCtx(() => [
  32581. _hoisted_22
  32582. ]),
  32583. _: 1
  32584. }),
  32585. createVNode(_component_el_radio_button, { label: "delete" }, {
  32586. default: withCtx(() => [
  32587. _hoisted_23
  32588. ]),
  32589. _: 1
  32590. })
  32591. ]),
  32592. _: 1
  32593. }, 8, ["modelValue"])
  32594. ]),
  32595. _: 1
  32596. })
  32597. ], 64)) : createCommentVNode("", true),
  32598. _ctx.data.type === "cascader" ? (openBlock(), createBlock(_component_el_form_item, {
  32599. key: 32,
  32600. label: "\u8FDC\u7AEF\u6570\u636E"
  32601. }, {
  32602. default: withCtx(() => [
  32603. createVNode(_component_el_space, {
  32604. direction: "vertical",
  32605. alignment: "start"
  32606. }, {
  32607. default: withCtx(() => [
  32608. createVNode(_component_el_input, {
  32609. modelValue: _ctx.data.options.remoteFunc,
  32610. "onUpdate:modelValue": _cache[48] || (_cache[48] = ($event) => _ctx.data.options.remoteFunc = $event)
  32611. }, {
  32612. prepend: withCtx(() => [
  32613. _hoisted_24
  32614. ]),
  32615. _: 1
  32616. }, 8, ["modelValue"]),
  32617. createVNode(_component_el_input, {
  32618. modelValue: _ctx.data.options.props.label,
  32619. "onUpdate:modelValue": _cache[49] || (_cache[49] = ($event) => _ctx.data.options.props.label = $event)
  32620. }, {
  32621. prepend: withCtx(() => [
  32622. _hoisted_25
  32623. ]),
  32624. _: 1
  32625. }, 8, ["modelValue"]),
  32626. createVNode(_component_el_input, {
  32627. modelValue: _ctx.data.options.props.value,
  32628. "onUpdate:modelValue": _cache[50] || (_cache[50] = ($event) => _ctx.data.options.props.value = $event)
  32629. }, {
  32630. prepend: withCtx(() => [
  32631. _hoisted_26
  32632. ]),
  32633. _: 1
  32634. }, 8, ["modelValue"]),
  32635. createVNode(_component_el_input, {
  32636. modelValue: _ctx.data.options.props.children,
  32637. "onUpdate:modelValue": _cache[51] || (_cache[51] = ($event) => _ctx.data.options.props.children = $event)
  32638. }, {
  32639. prepend: withCtx(() => [
  32640. _hoisted_27
  32641. ]),
  32642. _: 1
  32643. }, 8, ["modelValue"])
  32644. ]),
  32645. _: 1
  32646. })
  32647. ]),
  32648. _: 1
  32649. })) : createCommentVNode("", true),
  32650. _ctx.data.type === "table" ? (openBlock(), createElementBlock(Fragment, { key: 33 }, [
  32651. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  32652. default: withCtx(() => [
  32653. createVNode(_component_Draggable, {
  32654. tag: "ul",
  32655. "item-key": "index",
  32656. "ghost-class": "ghost",
  32657. handle: ".drag-item",
  32658. group: { name: "options" },
  32659. list: _ctx.data.columns
  32660. }, {
  32661. item: withCtx(({ element, index }) => [
  32662. createElementVNode("li", _hoisted_28, [
  32663. _hoisted_29,
  32664. createVNode(_component_el_input, {
  32665. modelValue: element.label,
  32666. "onUpdate:modelValue": ($event) => element.label = $event,
  32667. placeholder: "\u663E\u793A\u540D\u79F0"
  32668. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  32669. createVNode(_component_el_input, {
  32670. modelValue: element.prop,
  32671. "onUpdate:modelValue": ($event) => element.prop = $event,
  32672. placeholder: "\u5B57\u6BB5\u5B57\u6BB5"
  32673. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  32674. createVNode(_component_el_button, {
  32675. type: "primary",
  32676. circle: "",
  32677. style: { "margin-left": "5px" },
  32678. onClick: ($event) => _ctx.data.columns.splice(index, 1)
  32679. }, {
  32680. default: withCtx(() => [
  32681. _hoisted_30
  32682. ]),
  32683. _: 2
  32684. }, 1032, ["onClick"])
  32685. ])
  32686. ]),
  32687. _: 1
  32688. }, 8, ["list"]),
  32689. createElementVNode("div", null, [
  32690. createVNode(_component_el_button, {
  32691. type: "text",
  32692. onClick: _cache[52] || (_cache[52] = ($event) => _ctx.data.columns.push({}))
  32693. }, {
  32694. default: withCtx(() => [
  32695. _hoisted_31
  32696. ]),
  32697. _: 1
  32698. })
  32699. ])
  32700. ]),
  32701. _: 1
  32702. }),
  32703. createVNode(_component_el_form_item, { label: "\u5BF9\u9F50\u65B9\u5F0F" }, {
  32704. default: withCtx(() => [
  32705. createVNode(_component_el_radio_group, {
  32706. modelValue: _ctx.data.options.align,
  32707. "onUpdate:modelValue": _cache[53] || (_cache[53] = ($event) => _ctx.data.options.align = $event)
  32708. }, {
  32709. default: withCtx(() => [
  32710. createVNode(_component_el_radio_button, { label: "left" }, {
  32711. default: withCtx(() => [
  32712. _hoisted_32
  32713. ]),
  32714. _: 1
  32715. }),
  32716. createVNode(_component_el_radio_button, { label: "center" }, {
  32717. default: withCtx(() => [
  32718. _hoisted_33
  32719. ]),
  32720. _: 1
  32721. }),
  32722. createVNode(_component_el_radio_button, { label: "right" }, {
  32723. default: withCtx(() => [
  32724. _hoisted_34
  32725. ]),
  32726. _: 1
  32727. })
  32728. ]),
  32729. _: 1
  32730. }, 8, ["modelValue"])
  32731. ]),
  32732. _: 1
  32733. })
  32734. ], 64)) : createCommentVNode("", true),
  32735. _ctx.data.type === "grid" ? (openBlock(), createElementBlock(Fragment, { key: 34 }, [
  32736. createVNode(_component_el_form_item, { label: "\u6805\u683C\u95F4\u9694" }, {
  32737. default: withCtx(() => [
  32738. createVNode(_component_el_input_number, {
  32739. modelValue: _ctx.data.options.gutter,
  32740. "onUpdate:modelValue": _cache[54] || (_cache[54] = ($event) => _ctx.data.options.gutter = $event),
  32741. modelModifiers: { number: true },
  32742. min: 0
  32743. }, null, 8, ["modelValue"])
  32744. ]),
  32745. _: 1
  32746. }),
  32747. createVNode(_component_el_form_item, { label: "\u5217\u914D\u7F6E\u9879" }, {
  32748. default: withCtx(() => [
  32749. createVNode(_component_Draggable, {
  32750. tag: "ul",
  32751. "item-key": "index",
  32752. "ghost-class": "ghost",
  32753. handle: ".drag-item",
  32754. group: { name: "options" },
  32755. list: _ctx.data.columns
  32756. }, {
  32757. item: withCtx(({ element, index }) => [
  32758. createElementVNode("li", _hoisted_35, [
  32759. _hoisted_36,
  32760. createVNode(_component_el_input_number, {
  32761. modelValue: element.span,
  32762. "onUpdate:modelValue": ($event) => element.span = $event,
  32763. modelModifiers: { number: true },
  32764. placeholder: "\u6805\u683C\u503C",
  32765. min: 0,
  32766. max: 24
  32767. }, null, 8, ["modelValue", "onUpdate:modelValue"]),
  32768. createVNode(_component_el_button, {
  32769. type: "primary",
  32770. circle: "",
  32771. style: { "margin-left": "5px" },
  32772. onClick: ($event) => _ctx.handleOptionsRemove(index)
  32773. }, {
  32774. default: withCtx(() => [
  32775. _hoisted_37
  32776. ]),
  32777. _: 2
  32778. }, 1032, ["onClick"])
  32779. ])
  32780. ]),
  32781. _: 1
  32782. }, 8, ["list"]),
  32783. createElementVNode("div", null, [
  32784. createVNode(_component_el_button, {
  32785. type: "text",
  32786. onClick: _ctx.handleInsertColumn
  32787. }, {
  32788. default: withCtx(() => [
  32789. _hoisted_38
  32790. ]),
  32791. _: 1
  32792. }, 8, ["onClick"])
  32793. ])
  32794. ]),
  32795. _: 1
  32796. }),
  32797. createVNode(_component_el_form_item, { label: "\u5782\u76F4\u5BF9\u9F50\u65B9\u5F0F" }, {
  32798. default: withCtx(() => [
  32799. createVNode(_component_el_radio_group, {
  32800. modelValue: _ctx.data.options.align,
  32801. "onUpdate:modelValue": _cache[55] || (_cache[55] = ($event) => _ctx.data.options.align = $event)
  32802. }, {
  32803. default: withCtx(() => [
  32804. createVNode(_component_el_radio_button, { label: "initial" }, {
  32805. default: withCtx(() => [
  32806. _hoisted_39
  32807. ]),
  32808. _: 1
  32809. }),
  32810. createVNode(_component_el_radio_button, { label: "center" }, {
  32811. default: withCtx(() => [
  32812. _hoisted_40
  32813. ]),
  32814. _: 1
  32815. }),
  32816. createVNode(_component_el_radio_button, { label: "flex-end" }, {
  32817. default: withCtx(() => [
  32818. _hoisted_41
  32819. ]),
  32820. _: 1
  32821. })
  32822. ]),
  32823. _: 1
  32824. }, 8, ["modelValue"])
  32825. ]),
  32826. _: 1
  32827. })
  32828. ], 64)) : createCommentVNode("", true),
  32829. _ctx.data.type !== "grid" ? (openBlock(), createElementBlock(Fragment, { key: 35 }, [
  32830. _ctx.hasKey("rules") || _ctx.hasKey("readonly") || _ctx.hasKey("disabled") || _ctx.hasKey("allowClear") ? (openBlock(), createBlock(_component_el_form_item, {
  32831. key: 0,
  32832. label: "\u64CD\u4F5C\u5C5E\u6027"
  32833. }, {
  32834. default: withCtx(() => [
  32835. _ctx.hasKey("rules") ? (openBlock(), createBlock(_component_el_checkbox, {
  32836. key: 0,
  32837. modelValue: _ctx.data.options.rules.required,
  32838. "onUpdate:modelValue": _cache[56] || (_cache[56] = ($event) => _ctx.data.options.rules.required = $event),
  32839. disabled: _ctx.data.allDisable
  32840. }, {
  32841. default: withCtx(() => [
  32842. _hoisted_42
  32843. ]),
  32844. _: 1
  32845. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  32846. _ctx.hasKey("readonly") ? (openBlock(), createBlock(_component_el_checkbox, {
  32847. key: 1,
  32848. modelValue: _ctx.data.options.readonly,
  32849. "onUpdate:modelValue": _cache[57] || (_cache[57] = ($event) => _ctx.data.options.readonly = $event),
  32850. disabled: _ctx.data.allDisable
  32851. }, {
  32852. default: withCtx(() => [
  32853. _hoisted_43
  32854. ]),
  32855. _: 1
  32856. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  32857. _ctx.hasKey("disabled") ? (openBlock(), createBlock(_component_el_checkbox, {
  32858. key: 2,
  32859. modelValue: _ctx.data.options.disabled,
  32860. "onUpdate:modelValue": _cache[58] || (_cache[58] = ($event) => _ctx.data.options.disabled = $event),
  32861. disabled: _ctx.data.allDisable
  32862. }, {
  32863. default: withCtx(() => [
  32864. _hoisted_44
  32865. ]),
  32866. _: 1
  32867. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
  32868. _ctx.hasKey("clearable") ? (openBlock(), createBlock(_component_el_checkbox, {
  32869. key: 3,
  32870. modelValue: _ctx.data.options.clearable,
  32871. "onUpdate:modelValue": _cache[59] || (_cache[59] = ($event) => _ctx.data.options.clearable = $event),
  32872. disabled: _ctx.data.allDisable
  32873. }, {
  32874. default: withCtx(() => [
  32875. _hoisted_45
  32876. ]),
  32877. _: 1
  32878. }, 8, ["modelValue", "disabled"])) : createCommentVNode("", true)
  32879. ]),
  32880. _: 1
  32881. })) : createCommentVNode("", true),
  32882. _ctx.hasKey("rules") ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  32883. _hoisted_46,
  32884. createVNode(_component_el_form_item, { label: "\u89E6\u53D1\u65F6\u673A" }, {
  32885. default: withCtx(() => [
  32886. createVNode(_component_el_radio_group, {
  32887. modelValue: _ctx.data.options.rules.trigger,
  32888. "onUpdate:modelValue": _cache[60] || (_cache[60] = ($event) => _ctx.data.options.rules.trigger = $event)
  32889. }, {
  32890. default: withCtx(() => [
  32891. createVNode(_component_el_radio_button, { label: "blur" }, {
  32892. default: withCtx(() => [
  32893. _hoisted_47
  32894. ]),
  32895. _: 1
  32896. }),
  32897. createVNode(_component_el_radio_button, { label: "change" }, {
  32898. default: withCtx(() => [
  32899. _hoisted_48
  32900. ]),
  32901. _: 1
  32902. })
  32903. ]),
  32904. _: 1
  32905. }, 8, ["modelValue"])
  32906. ]),
  32907. _: 1
  32908. }),
  32909. createVNode(_component_el_form_item, { label: "\u679A\u4E3E\u7C7B\u578B" }, {
  32910. default: withCtx(() => [
  32911. createVNode(_component_el_input, {
  32912. value: _ctx.data.options.rules.enum,
  32913. "onUpdate:value": _cache[61] || (_cache[61] = ($event) => _ctx.data.options.rules.enum = $event)
  32914. }, null, 8, ["value"])
  32915. ]),
  32916. _: 1
  32917. }),
  32918. createVNode(_component_el_form_item, { label: "\u5B57\u6BB5\u957F\u5EA6" }, {
  32919. default: withCtx(() => [
  32920. createVNode(_component_el_input, {
  32921. modelValue: _ctx.data.options.rules.len,
  32922. "onUpdate:modelValue": _cache[62] || (_cache[62] = ($event) => _ctx.data.options.rules.len = $event),
  32923. modelModifiers: { number: true }
  32924. }, null, 8, ["modelValue"])
  32925. ]),
  32926. _: 1
  32927. }),
  32928. createVNode(_component_el_form_item, { label: "\u6700\u5927\u957F\u5EA6" }, {
  32929. default: withCtx(() => [
  32930. createVNode(_component_el_input, {
  32931. modelValue: _ctx.data.options.rules.max,
  32932. "onUpdate:modelValue": _cache[63] || (_cache[63] = ($event) => _ctx.data.options.rules.max = $event),
  32933. modelModifiers: { number: true }
  32934. }, null, 8, ["modelValue"])
  32935. ]),
  32936. _: 1
  32937. }),
  32938. createVNode(_component_el_form_item, { label: "\u6700\u5C0F\u957F\u5EA6" }, {
  32939. default: withCtx(() => [
  32940. createVNode(_component_el_input, {
  32941. modelValue: _ctx.data.options.rules.min,
  32942. "onUpdate:modelValue": _cache[64] || (_cache[64] = ($event) => _ctx.data.options.rules.min = $event),
  32943. modelModifiers: { number: true }
  32944. }, null, 8, ["modelValue"])
  32945. ]),
  32946. _: 1
  32947. }),
  32948. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u6587\u6848" }, {
  32949. default: withCtx(() => [
  32950. createVNode(_component_el_input, {
  32951. modelValue: _ctx.data.options.rules.message,
  32952. "onUpdate:modelValue": _cache[65] || (_cache[65] = ($event) => _ctx.data.options.rules.message = $event)
  32953. }, null, 8, ["modelValue"])
  32954. ]),
  32955. _: 1
  32956. }),
  32957. createVNode(_component_el_form_item, { label: "\u6B63\u5219\u8868\u8FBE\u5F0F" }, {
  32958. default: withCtx(() => [
  32959. createVNode(_component_el_input, {
  32960. modelValue: _ctx.data.options.rules.pattern,
  32961. "onUpdate:modelValue": _cache[66] || (_cache[66] = ($event) => _ctx.data.options.rules.pattern = $event)
  32962. }, null, 8, ["modelValue"])
  32963. ]),
  32964. _: 1
  32965. }),
  32966. createVNode(_component_el_form_item, { label: "\u6821\u9A8C\u7C7B\u578B" }, {
  32967. default: withCtx(() => [
  32968. createVNode(_component_el_select, {
  32969. modelValue: _ctx.data.options.rules.type,
  32970. "onUpdate:modelValue": _cache[67] || (_cache[67] = ($event) => _ctx.data.options.rules.type = $event)
  32971. }, {
  32972. default: withCtx(() => [
  32973. createVNode(_component_el_option, { value: "string" }, {
  32974. default: withCtx(() => [
  32975. _hoisted_49
  32976. ]),
  32977. _: 1
  32978. }),
  32979. createVNode(_component_el_option, { value: "number" }, {
  32980. default: withCtx(() => [
  32981. _hoisted_50
  32982. ]),
  32983. _: 1
  32984. }),
  32985. createVNode(_component_el_option, { value: "boolean" }, {
  32986. default: withCtx(() => [
  32987. _hoisted_51
  32988. ]),
  32989. _: 1
  32990. }),
  32991. createVNode(_component_el_option, { value: "method" }, {
  32992. default: withCtx(() => [
  32993. _hoisted_52
  32994. ]),
  32995. _: 1
  32996. }),
  32997. createVNode(_component_el_option, { value: "regexp" }, {
  32998. default: withCtx(() => [
  32999. _hoisted_53
  33000. ]),
  33001. _: 1
  33002. }),
  33003. createVNode(_component_el_option, { value: "integer" }, {
  33004. default: withCtx(() => [
  33005. _hoisted_54
  33006. ]),
  33007. _: 1
  33008. }),
  33009. createVNode(_component_el_option, { value: "float" }, {
  33010. default: withCtx(() => [
  33011. _hoisted_55
  33012. ]),
  33013. _: 1
  33014. }),
  33015. createVNode(_component_el_option, { value: "array" }, {
  33016. default: withCtx(() => [
  33017. _hoisted_56
  33018. ]),
  33019. _: 1
  33020. }),
  33021. createVNode(_component_el_option, { value: "object" }, {
  33022. default: withCtx(() => [
  33023. _hoisted_57
  33024. ]),
  33025. _: 1
  33026. }),
  33027. createVNode(_component_el_option, { value: "enum" }, {
  33028. default: withCtx(() => [
  33029. _hoisted_58
  33030. ]),
  33031. _: 1
  33032. }),
  33033. createVNode(_component_el_option, { value: "date" }, {
  33034. default: withCtx(() => [
  33035. _hoisted_59
  33036. ]),
  33037. _: 1
  33038. }),
  33039. createVNode(_component_el_option, { value: "url" }, {
  33040. default: withCtx(() => [
  33041. _hoisted_60
  33042. ]),
  33043. _: 1
  33044. }),
  33045. createVNode(_component_el_option, { value: "hex" }, {
  33046. default: withCtx(() => [
  33047. _hoisted_61
  33048. ]),
  33049. _: 1
  33050. }),
  33051. createVNode(_component_el_option, { value: "email" }, {
  33052. default: withCtx(() => [
  33053. _hoisted_62
  33054. ]),
  33055. _: 1
  33056. }),
  33057. createVNode(_component_el_option, { value: "any" }, {
  33058. default: withCtx(() => [
  33059. _hoisted_63
  33060. ]),
  33061. _: 1
  33062. })
  33063. ]),
  33064. _: 1
  33065. }, 8, ["modelValue"])
  33066. ]),
  33067. _: 1
  33068. })
  33069. ], 64)) : createCommentVNode("", true)
  33070. ], 64)) : createCommentVNode("", true)
  33071. ]),
  33072. _: 1
  33073. })) : createCommentVNode("", true);
  33074. }
  33075. var WidgetConfig = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
  33076. const _hoisted_1$1 = /* @__PURE__ */ createTextVNode(" \u5DE6\u5BF9\u9F50 ");
  33077. const _hoisted_2$1 = /* @__PURE__ */ createTextVNode(" \u53F3\u5BF9\u9F50 ");
  33078. const _hoisted_3$1 = /* @__PURE__ */ createTextVNode(" \u9876\u90E8\u5BF9\u9F50 ");
  33079. const _hoisted_4$1 = /* @__PURE__ */ createTextVNode(" \u5927 ");
  33080. const _hoisted_5$1 = /* @__PURE__ */ createTextVNode(" \u9ED8\u8BA4 ");
  33081. const _hoisted_6$1 = /* @__PURE__ */ createTextVNode(" \u5C0F ");
  33082. const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  33083. props: {
  33084. config: null
  33085. },
  33086. setup(__props) {
  33087. return (_ctx, _cache) => {
  33088. const _component_el_radio_button = ElRadioButton;
  33089. const _component_el_radio_group = ElRadioGroup;
  33090. const _component_el_form_item = ElFormItem;
  33091. const _component_el_input_number = ElInputNumber;
  33092. const _component_el_switch = ElSwitch;
  33093. const _component_el_form = ElForm;
  33094. return openBlock(), createBlock(_component_el_form, {
  33095. "p-2": "",
  33096. "label-position": "top",
  33097. onSubmit: _cache[4] || (_cache[4] = withModifiers(() => {
  33098. }, ["prevent"]))
  33099. }, {
  33100. default: withCtx(() => [
  33101. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BF9\u9F50\u65B9\u5F0F" }, {
  33102. default: withCtx(() => [
  33103. createVNode(_component_el_radio_group, {
  33104. modelValue: __props.config.labelPosition,
  33105. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.config.labelPosition = $event)
  33106. }, {
  33107. default: withCtx(() => [
  33108. createVNode(_component_el_radio_button, { label: "left" }, {
  33109. default: withCtx(() => [
  33110. _hoisted_1$1
  33111. ]),
  33112. _: 1
  33113. }),
  33114. createVNode(_component_el_radio_button, { label: "right" }, {
  33115. default: withCtx(() => [
  33116. _hoisted_2$1
  33117. ]),
  33118. _: 1
  33119. }),
  33120. createVNode(_component_el_radio_button, { label: "top" }, {
  33121. default: withCtx(() => [
  33122. _hoisted_3$1
  33123. ]),
  33124. _: 1
  33125. })
  33126. ]),
  33127. _: 1
  33128. }, 8, ["modelValue"])
  33129. ]),
  33130. _: 1
  33131. }),
  33132. createVNode(_component_el_form_item, { label: "\u6807\u7B7E\u5BBD\u5EA6" }, {
  33133. default: withCtx(() => [
  33134. createVNode(_component_el_input_number, {
  33135. modelValue: __props.config.labelWidth,
  33136. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => __props.config.labelWidth = $event),
  33137. modelModifiers: { number: true },
  33138. min: 0
  33139. }, null, 8, ["modelValue"])
  33140. ]),
  33141. _: 1
  33142. }),
  33143. createVNode(_component_el_form_item, { label: "\u7EC4\u4EF6\u5C3A\u5BF8" }, {
  33144. default: withCtx(() => [
  33145. createVNode(_component_el_radio_group, {
  33146. modelValue: __props.config.size,
  33147. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => __props.config.size = $event)
  33148. }, {
  33149. default: withCtx(() => [
  33150. createVNode(_component_el_radio_button, { label: "large" }, {
  33151. default: withCtx(() => [
  33152. _hoisted_4$1
  33153. ]),
  33154. _: 1
  33155. }),
  33156. createVNode(_component_el_radio_button, { label: "default" }, {
  33157. default: withCtx(() => [
  33158. _hoisted_5$1
  33159. ]),
  33160. _: 1
  33161. }),
  33162. createVNode(_component_el_radio_button, { label: "small" }, {
  33163. default: withCtx(() => [
  33164. _hoisted_6$1
  33165. ]),
  33166. _: 1
  33167. })
  33168. ]),
  33169. _: 1
  33170. }, 8, ["modelValue"])
  33171. ]),
  33172. _: 1
  33173. }),
  33174. createVNode(_component_el_form_item, { label: "\u9690\u85CF\u5FC5\u9009\u6807\u8BB0" }, {
  33175. default: withCtx(() => [
  33176. createVNode(_component_el_switch, {
  33177. modelValue: __props.config.hideRequiredAsterisk,
  33178. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => __props.config.hideRequiredAsterisk = $event)
  33179. }, null, 8, ["modelValue"])
  33180. ]),
  33181. _: 1
  33182. })
  33183. ]),
  33184. _: 1
  33185. });
  33186. };
  33187. }
  33188. });
  33189. function _extends() {
  33190. _extends = Object.assign || function(target) {
  33191. for (var i = 1; i < arguments.length; i++) {
  33192. var source = arguments[i];
  33193. for (var key in source) {
  33194. if (Object.prototype.hasOwnProperty.call(source, key)) {
  33195. target[key] = source[key];
  33196. }
  33197. }
  33198. }
  33199. return target;
  33200. };
  33201. return _extends.apply(this, arguments);
  33202. }
  33203. var KEYCODE_ENTER = 13;
  33204. var KEYCODE_TAB = 9;
  33205. var KEYCODE_BACKSPACE = 8;
  33206. var KEYCODE_Y = 89;
  33207. var KEYCODE_Z = 90;
  33208. var KEYCODE_M = 77;
  33209. var KEYCODE_PARENS = 57;
  33210. var KEYCODE_BRACKETS = 219;
  33211. var KEYCODE_QUOTE = 222;
  33212. var KEYCODE_BACK_QUOTE = 192;
  33213. var KEYCODE_ESCAPE = 27;
  33214. var HISTORY_LIMIT = 100;
  33215. var HISTORY_TIME_GAP = 3e3;
  33216. var isWindows = typeof window !== "undefined" && navigator && /* @__PURE__ */ /Win/i.test(navigator.platform);
  33217. var isMacLike = typeof window !== "undefined" && navigator && /* @__PURE__ */ /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);
  33218. var PrismEditor = /* @__PURE__ */ defineComponent({
  33219. props: {
  33220. lineNumbers: {
  33221. type: Boolean,
  33222. "default": false
  33223. },
  33224. autoStyleLineNumbers: {
  33225. type: Boolean,
  33226. "default": true
  33227. },
  33228. readonly: {
  33229. type: Boolean,
  33230. "default": false
  33231. },
  33232. modelValue: {
  33233. type: String,
  33234. "default": ""
  33235. },
  33236. highlight: {
  33237. type: Function,
  33238. required: true
  33239. },
  33240. tabSize: {
  33241. type: Number,
  33242. "default": 2
  33243. },
  33244. insertSpaces: {
  33245. type: Boolean,
  33246. "default": true
  33247. },
  33248. ignoreTabKey: {
  33249. type: Boolean,
  33250. "default": false
  33251. },
  33252. placeholder: {
  33253. type: String,
  33254. "default": ""
  33255. }
  33256. },
  33257. data: function data() {
  33258. return {
  33259. capture: true,
  33260. history: {
  33261. stack: [],
  33262. offset: -1
  33263. },
  33264. lineNumbersHeight: "20px",
  33265. codeData: ""
  33266. };
  33267. },
  33268. watch: {
  33269. modelValue: {
  33270. immediate: true,
  33271. handler: function handler(newVal) {
  33272. if (!newVal) {
  33273. this.codeData = "";
  33274. } else {
  33275. this.codeData = newVal;
  33276. }
  33277. }
  33278. },
  33279. content: {
  33280. immediate: true,
  33281. handler: function handler2() {
  33282. var _this = this;
  33283. if (this.lineNumbers) {
  33284. this.$nextTick(function() {
  33285. _this.setLineNumbersHeight();
  33286. });
  33287. }
  33288. }
  33289. },
  33290. lineNumbers: function lineNumbers() {
  33291. var _this2 = this;
  33292. this.$nextTick(function() {
  33293. _this2.styleLineNumbers();
  33294. _this2.setLineNumbersHeight();
  33295. });
  33296. }
  33297. },
  33298. computed: {
  33299. isEmpty: function isEmpty2() {
  33300. return this.codeData.length === 0;
  33301. },
  33302. content: function content() {
  33303. var result = this.highlight(this.codeData) + "<br />";
  33304. return result;
  33305. },
  33306. lineNumbersCount: function lineNumbersCount() {
  33307. var totalLines = this.codeData.split(/\r\n|\n/).length;
  33308. return totalLines;
  33309. }
  33310. },
  33311. mounted: function mounted() {
  33312. this._recordCurrentState();
  33313. this.styleLineNumbers();
  33314. },
  33315. methods: {
  33316. setLineNumbersHeight: function setLineNumbersHeight() {
  33317. this.lineNumbersHeight = getComputedStyle(this.$refs.pre).height;
  33318. },
  33319. styleLineNumbers: function styleLineNumbers() {
  33320. if (!this.lineNumbers || !this.autoStyleLineNumbers)
  33321. return;
  33322. var $editor = this.$refs.pre;
  33323. var $lineNumbers = this.$el.querySelector(".prism-editor__line-numbers");
  33324. var editorStyles = window.getComputedStyle($editor);
  33325. this.$nextTick(function() {
  33326. var btlr = "border-top-left-radius";
  33327. var bblr = "border-bottom-left-radius";
  33328. if (!$lineNumbers)
  33329. return;
  33330. $lineNumbers.style[btlr] = editorStyles[btlr];
  33331. $lineNumbers.style[bblr] = editorStyles[bblr];
  33332. $editor.style[btlr] = "0";
  33333. $editor.style[bblr] = "0";
  33334. var stylesList = ["background-color", "margin-top", "padding-top", "font-family", "font-size", "line-height"];
  33335. stylesList.forEach(function(style) {
  33336. $lineNumbers.style[style] = editorStyles[style];
  33337. });
  33338. $lineNumbers.style["margin-bottom"] = "-" + editorStyles["padding-top"];
  33339. });
  33340. },
  33341. _recordCurrentState: function _recordCurrentState() {
  33342. var input = this.$refs.textarea;
  33343. if (!input)
  33344. return;
  33345. var value = input.value, selectionStart = input.selectionStart, selectionEnd = input.selectionEnd;
  33346. this._recordChange({
  33347. value,
  33348. selectionStart,
  33349. selectionEnd
  33350. });
  33351. },
  33352. _getLines: function _getLines(text, position) {
  33353. return text.substring(0, position).split("\n");
  33354. },
  33355. _applyEdits: function _applyEdits(record) {
  33356. var input = this.$refs.textarea;
  33357. var last = this.history.stack[this.history.offset];
  33358. if (last && input) {
  33359. this.history.stack[this.history.offset] = _extends({}, last, {
  33360. selectionStart: input.selectionStart,
  33361. selectionEnd: input.selectionEnd
  33362. });
  33363. }
  33364. this._recordChange(record);
  33365. this._updateInput(record);
  33366. },
  33367. _recordChange: function _recordChange(record, overwrite) {
  33368. if (overwrite === void 0) {
  33369. overwrite = false;
  33370. }
  33371. var _this$history = this.history, stack = _this$history.stack, offset2 = _this$history.offset;
  33372. if (stack.length && offset2 > -1) {
  33373. this.history.stack = stack.slice(0, offset2 + 1);
  33374. var count = this.history.stack.length;
  33375. if (count > HISTORY_LIMIT) {
  33376. var extras = count - HISTORY_LIMIT;
  33377. this.history.stack = stack.slice(extras, count);
  33378. this.history.offset = Math.max(this.history.offset - extras, 0);
  33379. }
  33380. }
  33381. var timestamp = Date.now();
  33382. if (overwrite) {
  33383. var last = this.history.stack[this.history.offset];
  33384. if (last && timestamp - last.timestamp < HISTORY_TIME_GAP) {
  33385. var _this$_getLines$pop, _this$_getLines$pop2;
  33386. var re = /[^a-z0-9]([a-z0-9]+)$/i;
  33387. 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);
  33388. 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);
  33389. if (previous && current && current[1].startsWith(previous[1])) {
  33390. this.history.stack[this.history.offset] = _extends({}, record, {
  33391. timestamp
  33392. });
  33393. return;
  33394. }
  33395. }
  33396. }
  33397. this.history.stack.push(_extends({}, record, {
  33398. timestamp
  33399. }));
  33400. this.history.offset++;
  33401. },
  33402. _updateInput: function _updateInput(record) {
  33403. var input = this.$refs.textarea;
  33404. if (!input)
  33405. return;
  33406. input.value = record.value;
  33407. input.selectionStart = record.selectionStart;
  33408. input.selectionEnd = record.selectionEnd;
  33409. this.$emit("update:modelValue", record.value);
  33410. },
  33411. handleChange: function handleChange(e) {
  33412. var _e$target = e.target, value = _e$target.value, selectionStart = _e$target.selectionStart, selectionEnd = _e$target.selectionEnd;
  33413. this._recordChange({
  33414. value,
  33415. selectionStart,
  33416. selectionEnd
  33417. }, true);
  33418. this.$emit("update:modelValue", value);
  33419. },
  33420. _undoEdit: function _undoEdit() {
  33421. var _this$history2 = this.history, stack = _this$history2.stack, offset2 = _this$history2.offset;
  33422. var record = stack[offset2 - 1];
  33423. if (record) {
  33424. this._updateInput(record);
  33425. this.history.offset = Math.max(offset2 - 1, 0);
  33426. }
  33427. },
  33428. _redoEdit: function _redoEdit() {
  33429. var _this$history3 = this.history, stack = _this$history3.stack, offset2 = _this$history3.offset;
  33430. var record = stack[offset2 + 1];
  33431. if (record) {
  33432. this._updateInput(record);
  33433. this.history.offset = Math.min(offset2 + 1, stack.length - 1);
  33434. }
  33435. },
  33436. handleKeyDown: function handleKeyDown(e) {
  33437. var tabSize = this.tabSize, insertSpaces = this.insertSpaces, ignoreTabKey = this.ignoreTabKey;
  33438. this.$emit("keydown", e);
  33439. if (e.defaultPrevented) {
  33440. return;
  33441. }
  33442. if (e.keyCode === KEYCODE_ESCAPE) {
  33443. e.target.blur();
  33444. this.$emit("blur", e);
  33445. }
  33446. var _e$target2 = e.target, value = _e$target2.value, selectionStart = _e$target2.selectionStart, selectionEnd = _e$target2.selectionEnd;
  33447. var tabCharacter = (insertSpaces ? " " : " ").repeat(tabSize);
  33448. if (e.keyCode === KEYCODE_TAB && !ignoreTabKey && this.capture) {
  33449. e.preventDefault();
  33450. if (e.shiftKey) {
  33451. var linesBeforeCaret = this._getLines(value, selectionStart);
  33452. var startLine = linesBeforeCaret.length - 1;
  33453. var endLine = this._getLines(value, selectionEnd).length - 1;
  33454. var nextValue = value.split("\n").map(function(line2, i) {
  33455. if (i >= startLine && i <= endLine && line2.startsWith(tabCharacter)) {
  33456. return line2.substring(tabCharacter.length);
  33457. }
  33458. return line2;
  33459. }).join("\n");
  33460. if (value !== nextValue) {
  33461. var startLineText = linesBeforeCaret[startLine];
  33462. this._applyEdits({
  33463. value: nextValue,
  33464. selectionStart: startLineText.startsWith(tabCharacter) ? selectionStart - tabCharacter.length : selectionStart,
  33465. selectionEnd: selectionEnd - (value.length - nextValue.length)
  33466. });
  33467. }
  33468. } else if (selectionStart !== selectionEnd) {
  33469. var _linesBeforeCaret = this._getLines(value, selectionStart);
  33470. var _startLine = _linesBeforeCaret.length - 1;
  33471. var _endLine = this._getLines(value, selectionEnd).length - 1;
  33472. var _startLineText = _linesBeforeCaret[_startLine];
  33473. this._applyEdits({
  33474. value: value.split("\n").map(function(line2, i) {
  33475. if (i >= _startLine && i <= _endLine) {
  33476. return tabCharacter + line2;
  33477. }
  33478. return line2;
  33479. }).join("\n"),
  33480. selectionStart: /\S/.test(_startLineText) ? selectionStart + tabCharacter.length : selectionStart,
  33481. selectionEnd: selectionEnd + tabCharacter.length * (_endLine - _startLine + 1)
  33482. });
  33483. } else {
  33484. var updatedSelection = selectionStart + tabCharacter.length;
  33485. this._applyEdits({
  33486. value: value.substring(0, selectionStart) + tabCharacter + value.substring(selectionEnd),
  33487. selectionStart: updatedSelection,
  33488. selectionEnd: updatedSelection
  33489. });
  33490. }
  33491. } else if (e.keyCode === KEYCODE_BACKSPACE) {
  33492. var hasSelection = selectionStart !== selectionEnd;
  33493. var textBeforeCaret = value.substring(0, selectionStart);
  33494. if (textBeforeCaret.endsWith(tabCharacter) && !hasSelection) {
  33495. e.preventDefault();
  33496. var _updatedSelection = selectionStart - tabCharacter.length;
  33497. this._applyEdits({
  33498. value: value.substring(0, selectionStart - tabCharacter.length) + value.substring(selectionEnd),
  33499. selectionStart: _updatedSelection,
  33500. selectionEnd: _updatedSelection
  33501. });
  33502. }
  33503. } else if (e.keyCode === KEYCODE_ENTER) {
  33504. if (selectionStart === selectionEnd) {
  33505. var line = this._getLines(value, selectionStart).pop();
  33506. var matches = line === null || line === void 0 ? void 0 : line.match(/^\s+/);
  33507. if (matches && matches[0]) {
  33508. e.preventDefault();
  33509. var indent = "\n" + matches[0];
  33510. var _updatedSelection2 = selectionStart + indent.length;
  33511. this._applyEdits({
  33512. value: value.substring(0, selectionStart) + indent + value.substring(selectionEnd),
  33513. selectionStart: _updatedSelection2,
  33514. selectionEnd: _updatedSelection2
  33515. });
  33516. }
  33517. }
  33518. } else if (e.keyCode === KEYCODE_PARENS || e.keyCode === KEYCODE_BRACKETS || e.keyCode === KEYCODE_QUOTE || e.keyCode === KEYCODE_BACK_QUOTE) {
  33519. var chars;
  33520. if (e.keyCode === KEYCODE_PARENS && e.shiftKey) {
  33521. chars = ["(", ")"];
  33522. } else if (e.keyCode === KEYCODE_BRACKETS) {
  33523. if (e.shiftKey) {
  33524. chars = ["{", "}"];
  33525. } else {
  33526. chars = ["[", "]"];
  33527. }
  33528. } else if (e.keyCode === KEYCODE_QUOTE) {
  33529. if (e.shiftKey) {
  33530. chars = ['"', '"'];
  33531. } else {
  33532. chars = ["'", "'"];
  33533. }
  33534. } else if (e.keyCode === KEYCODE_BACK_QUOTE && !e.shiftKey) {
  33535. chars = ["`", "`"];
  33536. }
  33537. if (selectionStart !== selectionEnd && chars) {
  33538. e.preventDefault();
  33539. this._applyEdits({
  33540. value: value.substring(0, selectionStart) + chars[0] + value.substring(selectionStart, selectionEnd) + chars[1] + value.substring(selectionEnd),
  33541. selectionStart,
  33542. selectionEnd: selectionEnd + 2
  33543. });
  33544. }
  33545. } else if ((isMacLike ? e.metaKey && e.keyCode === KEYCODE_Z : e.ctrlKey && e.keyCode === KEYCODE_Z) && !e.shiftKey && !e.altKey) {
  33546. e.preventDefault();
  33547. this._undoEdit();
  33548. } 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) {
  33549. e.preventDefault();
  33550. this._redoEdit();
  33551. } else if (e.keyCode === KEYCODE_M && e.ctrlKey && (isMacLike ? e.shiftKey : true)) {
  33552. e.preventDefault();
  33553. this.capture = !this.capture;
  33554. }
  33555. }
  33556. },
  33557. render: function render() {
  33558. var _this3 = this;
  33559. var lineNumberWidthCalculator = h$1("div", {
  33560. "class": "prism-editor__line-width-calc",
  33561. style: "height: 0px; visibility: hidden; pointer-events: none;"
  33562. }, "999");
  33563. var lineNumbers2 = h$1("div", {
  33564. "class": "prism-editor__line-numbers",
  33565. style: {
  33566. "min-height": this.lineNumbersHeight
  33567. },
  33568. "aria-hidden": "true"
  33569. }, [lineNumberWidthCalculator, Array.from(Array(this.lineNumbersCount).keys()).map(function(_2, index) {
  33570. return h$1("div", {
  33571. "class": "prism-editor__line-number token comment"
  33572. }, "" + ++index);
  33573. })]);
  33574. var textarea = h$1("textarea", {
  33575. ref: "textarea",
  33576. onInput: this.handleChange,
  33577. onKeydown: this.handleKeyDown,
  33578. onClick: function onClick($event) {
  33579. _this3.$emit("click", $event);
  33580. },
  33581. onKeyup: function onKeyup($event) {
  33582. _this3.$emit("keyup", $event);
  33583. },
  33584. onFocus: function onFocus($event) {
  33585. _this3.$emit("focus", $event);
  33586. },
  33587. onBlur: function onBlur($event) {
  33588. _this3.$emit("blur", $event);
  33589. },
  33590. "class": {
  33591. "prism-editor__textarea": true,
  33592. "prism-editor__textarea--empty": this.isEmpty
  33593. },
  33594. spellCheck: "false",
  33595. autocapitalize: "off",
  33596. autocomplete: "off",
  33597. autocorrect: "off",
  33598. "data-gramm": "false",
  33599. placeholder: this.placeholder,
  33600. "data-testid": "textarea",
  33601. readonly: this.readonly,
  33602. value: this.codeData
  33603. });
  33604. var preview = h$1("pre", {
  33605. ref: "pre",
  33606. "class": "prism-editor__editor",
  33607. "data-testid": "preview",
  33608. innerHTML: this.content
  33609. });
  33610. var editorContainer = h$1("div", {
  33611. "class": "prism-editor__container"
  33612. }, [textarea, preview]);
  33613. return h$1("div", {
  33614. "class": "prism-editor-wrapper"
  33615. }, [this.lineNumbers && lineNumbers2, editorContainer]);
  33616. }
  33617. });
  33618. var prismeditor_min = "";
  33619. var prismCore = { exports: {} };
  33620. (function(module2) {
  33621. var _self = typeof window !== "undefined" ? window : typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope ? self : {};
  33622. /**
  33623. * Prism: Lightweight, robust, elegant syntax highlighting
  33624. *
  33625. * @license MIT <https://opensource.org/licenses/MIT>
  33626. * @author Lea Verou <https://lea.verou.me>
  33627. * @namespace
  33628. * @public
  33629. */
  33630. var Prism2 = function(_self2) {
  33631. var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
  33632. var uniqueId = 0;
  33633. var plainTextGrammar = {};
  33634. var _2 = {
  33635. manual: _self2.Prism && _self2.Prism.manual,
  33636. disableWorkerMessageHandler: _self2.Prism && _self2.Prism.disableWorkerMessageHandler,
  33637. util: {
  33638. encode: function encode(tokens) {
  33639. if (tokens instanceof Token) {
  33640. return new Token(tokens.type, encode(tokens.content), tokens.alias);
  33641. } else if (Array.isArray(tokens)) {
  33642. return tokens.map(encode);
  33643. } else {
  33644. return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
  33645. }
  33646. },
  33647. type: function(o2) {
  33648. return Object.prototype.toString.call(o2).slice(8, -1);
  33649. },
  33650. objId: function(obj) {
  33651. if (!obj["__id"]) {
  33652. Object.defineProperty(obj, "__id", { value: ++uniqueId });
  33653. }
  33654. return obj["__id"];
  33655. },
  33656. clone: function deepClone(o2, visited) {
  33657. visited = visited || {};
  33658. var clone2;
  33659. var id;
  33660. switch (_2.util.type(o2)) {
  33661. case "Object":
  33662. id = _2.util.objId(o2);
  33663. if (visited[id]) {
  33664. return visited[id];
  33665. }
  33666. clone2 = {};
  33667. visited[id] = clone2;
  33668. for (var key in o2) {
  33669. if (o2.hasOwnProperty(key)) {
  33670. clone2[key] = deepClone(o2[key], visited);
  33671. }
  33672. }
  33673. return clone2;
  33674. case "Array":
  33675. id = _2.util.objId(o2);
  33676. if (visited[id]) {
  33677. return visited[id];
  33678. }
  33679. clone2 = [];
  33680. visited[id] = clone2;
  33681. o2.forEach(function(v2, i) {
  33682. clone2[i] = deepClone(v2, visited);
  33683. });
  33684. return clone2;
  33685. default:
  33686. return o2;
  33687. }
  33688. },
  33689. getLanguage: function(element) {
  33690. while (element) {
  33691. var m2 = lang.exec(element.className);
  33692. if (m2) {
  33693. return m2[1].toLowerCase();
  33694. }
  33695. element = element.parentElement;
  33696. }
  33697. return "none";
  33698. },
  33699. setLanguage: function(element, language) {
  33700. element.className = element.className.replace(RegExp(lang, "gi"), "");
  33701. element.classList.add("language-" + language);
  33702. },
  33703. currentScript: function() {
  33704. if (typeof document === "undefined") {
  33705. return null;
  33706. }
  33707. if ("currentScript" in document && 1 < 2) {
  33708. return document.currentScript;
  33709. }
  33710. try {
  33711. throw new Error();
  33712. } catch (err) {
  33713. var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
  33714. if (src) {
  33715. var scripts = document.getElementsByTagName("script");
  33716. for (var i in scripts) {
  33717. if (scripts[i].src == src) {
  33718. return scripts[i];
  33719. }
  33720. }
  33721. }
  33722. return null;
  33723. }
  33724. },
  33725. isActive: function(element, className, defaultActivation) {
  33726. var no = "no-" + className;
  33727. while (element) {
  33728. var classList = element.classList;
  33729. if (classList.contains(className)) {
  33730. return true;
  33731. }
  33732. if (classList.contains(no)) {
  33733. return false;
  33734. }
  33735. element = element.parentElement;
  33736. }
  33737. return !!defaultActivation;
  33738. }
  33739. },
  33740. languages: {
  33741. plain: plainTextGrammar,
  33742. plaintext: plainTextGrammar,
  33743. text: plainTextGrammar,
  33744. txt: plainTextGrammar,
  33745. extend: function(id, redef) {
  33746. var lang2 = _2.util.clone(_2.languages[id]);
  33747. for (var key in redef) {
  33748. lang2[key] = redef[key];
  33749. }
  33750. return lang2;
  33751. },
  33752. insertBefore: function(inside, before, insert, root2) {
  33753. root2 = root2 || _2.languages;
  33754. var grammar = root2[inside];
  33755. var ret = {};
  33756. for (var token in grammar) {
  33757. if (grammar.hasOwnProperty(token)) {
  33758. if (token == before) {
  33759. for (var newToken in insert) {
  33760. if (insert.hasOwnProperty(newToken)) {
  33761. ret[newToken] = insert[newToken];
  33762. }
  33763. }
  33764. }
  33765. if (!insert.hasOwnProperty(token)) {
  33766. ret[token] = grammar[token];
  33767. }
  33768. }
  33769. }
  33770. var old = root2[inside];
  33771. root2[inside] = ret;
  33772. _2.languages.DFS(_2.languages, function(key, value) {
  33773. if (value === old && key != inside) {
  33774. this[key] = ret;
  33775. }
  33776. });
  33777. return ret;
  33778. },
  33779. DFS: function DFS(o2, callback, type4, visited) {
  33780. visited = visited || {};
  33781. var objId = _2.util.objId;
  33782. for (var i in o2) {
  33783. if (o2.hasOwnProperty(i)) {
  33784. callback.call(o2, i, o2[i], type4 || i);
  33785. var property = o2[i];
  33786. var propertyType = _2.util.type(property);
  33787. if (propertyType === "Object" && !visited[objId(property)]) {
  33788. visited[objId(property)] = true;
  33789. DFS(property, callback, null, visited);
  33790. } else if (propertyType === "Array" && !visited[objId(property)]) {
  33791. visited[objId(property)] = true;
  33792. DFS(property, callback, i, visited);
  33793. }
  33794. }
  33795. }
  33796. }
  33797. },
  33798. plugins: {},
  33799. highlightAll: function(async, callback) {
  33800. _2.highlightAllUnder(document, async, callback);
  33801. },
  33802. highlightAllUnder: function(container, async, callback) {
  33803. var env = {
  33804. callback,
  33805. container,
  33806. selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
  33807. };
  33808. _2.hooks.run("before-highlightall", env);
  33809. env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
  33810. _2.hooks.run("before-all-elements-highlight", env);
  33811. for (var i = 0, element; element = env.elements[i++]; ) {
  33812. _2.highlightElement(element, async === true, env.callback);
  33813. }
  33814. },
  33815. highlightElement: function(element, async, callback) {
  33816. var language = _2.util.getLanguage(element);
  33817. var grammar = _2.languages[language];
  33818. _2.util.setLanguage(element, language);
  33819. var parent = element.parentElement;
  33820. if (parent && parent.nodeName.toLowerCase() === "pre") {
  33821. _2.util.setLanguage(parent, language);
  33822. }
  33823. var code = element.textContent;
  33824. var env = {
  33825. element,
  33826. language,
  33827. grammar,
  33828. code
  33829. };
  33830. function insertHighlightedCode(highlightedCode) {
  33831. env.highlightedCode = highlightedCode;
  33832. _2.hooks.run("before-insert", env);
  33833. env.element.innerHTML = env.highlightedCode;
  33834. _2.hooks.run("after-highlight", env);
  33835. _2.hooks.run("complete", env);
  33836. callback && callback.call(env.element);
  33837. }
  33838. _2.hooks.run("before-sanity-check", env);
  33839. parent = env.element.parentElement;
  33840. if (parent && parent.nodeName.toLowerCase() === "pre" && !parent.hasAttribute("tabindex")) {
  33841. parent.setAttribute("tabindex", "0");
  33842. }
  33843. if (!env.code) {
  33844. _2.hooks.run("complete", env);
  33845. callback && callback.call(env.element);
  33846. return;
  33847. }
  33848. _2.hooks.run("before-highlight", env);
  33849. if (!env.grammar) {
  33850. insertHighlightedCode(_2.util.encode(env.code));
  33851. return;
  33852. }
  33853. if (async && _self2.Worker) {
  33854. var worker = new Worker(_2.filename);
  33855. worker.onmessage = function(evt) {
  33856. insertHighlightedCode(evt.data);
  33857. };
  33858. worker.postMessage(JSON.stringify({
  33859. language: env.language,
  33860. code: env.code,
  33861. immediateClose: true
  33862. }));
  33863. } else {
  33864. insertHighlightedCode(_2.highlight(env.code, env.grammar, env.language));
  33865. }
  33866. },
  33867. highlight: function(text, grammar, language) {
  33868. var env = {
  33869. code: text,
  33870. grammar,
  33871. language
  33872. };
  33873. _2.hooks.run("before-tokenize", env);
  33874. if (!env.grammar) {
  33875. throw new Error('The language "' + env.language + '" has no grammar.');
  33876. }
  33877. env.tokens = _2.tokenize(env.code, env.grammar);
  33878. _2.hooks.run("after-tokenize", env);
  33879. return Token.stringify(_2.util.encode(env.tokens), env.language);
  33880. },
  33881. tokenize: function(text, grammar) {
  33882. var rest = grammar.rest;
  33883. if (rest) {
  33884. for (var token in rest) {
  33885. grammar[token] = rest[token];
  33886. }
  33887. delete grammar.rest;
  33888. }
  33889. var tokenList = new LinkedList();
  33890. addAfter(tokenList, tokenList.head, text);
  33891. matchGrammar(text, tokenList, grammar, tokenList.head, 0);
  33892. return toArray(tokenList);
  33893. },
  33894. hooks: {
  33895. all: {},
  33896. add: function(name, callback) {
  33897. var hooks = _2.hooks.all;
  33898. hooks[name] = hooks[name] || [];
  33899. hooks[name].push(callback);
  33900. },
  33901. run: function(name, env) {
  33902. var callbacks = _2.hooks.all[name];
  33903. if (!callbacks || !callbacks.length) {
  33904. return;
  33905. }
  33906. for (var i = 0, callback; callback = callbacks[i++]; ) {
  33907. callback(env);
  33908. }
  33909. }
  33910. },
  33911. Token
  33912. };
  33913. _self2.Prism = _2;
  33914. function Token(type4, content2, alias, matchedStr) {
  33915. this.type = type4;
  33916. this.content = content2;
  33917. this.alias = alias;
  33918. this.length = (matchedStr || "").length | 0;
  33919. }
  33920. Token.stringify = function stringify(o2, language) {
  33921. if (typeof o2 == "string") {
  33922. return o2;
  33923. }
  33924. if (Array.isArray(o2)) {
  33925. var s2 = "";
  33926. o2.forEach(function(e) {
  33927. s2 += stringify(e, language);
  33928. });
  33929. return s2;
  33930. }
  33931. var env = {
  33932. type: o2.type,
  33933. content: stringify(o2.content, language),
  33934. tag: "span",
  33935. classes: ["token", o2.type],
  33936. attributes: {},
  33937. language
  33938. };
  33939. var aliases = o2.alias;
  33940. if (aliases) {
  33941. if (Array.isArray(aliases)) {
  33942. Array.prototype.push.apply(env.classes, aliases);
  33943. } else {
  33944. env.classes.push(aliases);
  33945. }
  33946. }
  33947. _2.hooks.run("wrap", env);
  33948. var attributes = "";
  33949. for (var name in env.attributes) {
  33950. attributes += " " + name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
  33951. }
  33952. return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + attributes + ">" + env.content + "</" + env.tag + ">";
  33953. };
  33954. function matchPattern(pattern4, pos, text, lookbehind) {
  33955. pattern4.lastIndex = pos;
  33956. var match = pattern4.exec(text);
  33957. if (match && lookbehind && match[1]) {
  33958. var lookbehindLength = match[1].length;
  33959. match.index += lookbehindLength;
  33960. match[0] = match[0].slice(lookbehindLength);
  33961. }
  33962. return match;
  33963. }
  33964. function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
  33965. for (var token in grammar) {
  33966. if (!grammar.hasOwnProperty(token) || !grammar[token]) {
  33967. continue;
  33968. }
  33969. var patterns = grammar[token];
  33970. patterns = Array.isArray(patterns) ? patterns : [patterns];
  33971. for (var j = 0; j < patterns.length; ++j) {
  33972. if (rematch && rematch.cause == token + "," + j) {
  33973. return;
  33974. }
  33975. var patternObj = patterns[j];
  33976. var inside = patternObj.inside;
  33977. var lookbehind = !!patternObj.lookbehind;
  33978. var greedy = !!patternObj.greedy;
  33979. var alias = patternObj.alias;
  33980. if (greedy && !patternObj.pattern.global) {
  33981. var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
  33982. patternObj.pattern = RegExp(patternObj.pattern.source, flags + "g");
  33983. }
  33984. var pattern4 = patternObj.pattern || patternObj;
  33985. for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {
  33986. if (rematch && pos >= rematch.reach) {
  33987. break;
  33988. }
  33989. var str = currentNode.value;
  33990. if (tokenList.length > text.length) {
  33991. return;
  33992. }
  33993. if (str instanceof Token) {
  33994. continue;
  33995. }
  33996. var removeCount = 1;
  33997. var match;
  33998. if (greedy) {
  33999. match = matchPattern(pattern4, pos, text, lookbehind);
  34000. if (!match || match.index >= text.length) {
  34001. break;
  34002. }
  34003. var from = match.index;
  34004. var to = match.index + match[0].length;
  34005. var p2 = pos;
  34006. p2 += currentNode.value.length;
  34007. while (from >= p2) {
  34008. currentNode = currentNode.next;
  34009. p2 += currentNode.value.length;
  34010. }
  34011. p2 -= currentNode.value.length;
  34012. pos = p2;
  34013. if (currentNode.value instanceof Token) {
  34014. continue;
  34015. }
  34016. for (var k = currentNode; k !== tokenList.tail && (p2 < to || typeof k.value === "string"); k = k.next) {
  34017. removeCount++;
  34018. p2 += k.value.length;
  34019. }
  34020. removeCount--;
  34021. str = text.slice(pos, p2);
  34022. match.index -= pos;
  34023. } else {
  34024. match = matchPattern(pattern4, 0, str, lookbehind);
  34025. if (!match) {
  34026. continue;
  34027. }
  34028. }
  34029. var from = match.index;
  34030. var matchStr = match[0];
  34031. var before = str.slice(0, from);
  34032. var after = str.slice(from + matchStr.length);
  34033. var reach = pos + str.length;
  34034. if (rematch && reach > rematch.reach) {
  34035. rematch.reach = reach;
  34036. }
  34037. var removeFrom = currentNode.prev;
  34038. if (before) {
  34039. removeFrom = addAfter(tokenList, removeFrom, before);
  34040. pos += before.length;
  34041. }
  34042. removeRange(tokenList, removeFrom, removeCount);
  34043. var wrapped = new Token(token, inside ? _2.tokenize(matchStr, inside) : matchStr, alias, matchStr);
  34044. currentNode = addAfter(tokenList, removeFrom, wrapped);
  34045. if (after) {
  34046. addAfter(tokenList, currentNode, after);
  34047. }
  34048. if (removeCount > 1) {
  34049. var nestedRematch = {
  34050. cause: token + "," + j,
  34051. reach
  34052. };
  34053. matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
  34054. if (rematch && nestedRematch.reach > rematch.reach) {
  34055. rematch.reach = nestedRematch.reach;
  34056. }
  34057. }
  34058. }
  34059. }
  34060. }
  34061. }
  34062. function LinkedList() {
  34063. var head = { value: null, prev: null, next: null };
  34064. var tail = { value: null, prev: head, next: null };
  34065. head.next = tail;
  34066. this.head = head;
  34067. this.tail = tail;
  34068. this.length = 0;
  34069. }
  34070. function addAfter(list, node, value) {
  34071. var next = node.next;
  34072. var newNode = { value, prev: node, next };
  34073. node.next = newNode;
  34074. next.prev = newNode;
  34075. list.length++;
  34076. return newNode;
  34077. }
  34078. function removeRange(list, node, count) {
  34079. var next = node.next;
  34080. for (var i = 0; i < count && next !== list.tail; i++) {
  34081. next = next.next;
  34082. }
  34083. node.next = next;
  34084. next.prev = node;
  34085. list.length -= i;
  34086. }
  34087. function toArray(list) {
  34088. var array4 = [];
  34089. var node = list.head.next;
  34090. while (node !== list.tail) {
  34091. array4.push(node.value);
  34092. node = node.next;
  34093. }
  34094. return array4;
  34095. }
  34096. if (!_self2.document) {
  34097. if (!_self2.addEventListener) {
  34098. return _2;
  34099. }
  34100. if (!_2.disableWorkerMessageHandler) {
  34101. _self2.addEventListener("message", function(evt) {
  34102. var message = JSON.parse(evt.data);
  34103. var lang2 = message.language;
  34104. var code = message.code;
  34105. var immediateClose = message.immediateClose;
  34106. _self2.postMessage(_2.highlight(code, _2.languages[lang2], lang2));
  34107. if (immediateClose) {
  34108. _self2.close();
  34109. }
  34110. }, false);
  34111. }
  34112. return _2;
  34113. }
  34114. var script = _2.util.currentScript();
  34115. if (script) {
  34116. _2.filename = script.src;
  34117. if (script.hasAttribute("data-manual")) {
  34118. _2.manual = true;
  34119. }
  34120. }
  34121. function highlightAutomaticallyCallback() {
  34122. if (!_2.manual) {
  34123. _2.highlightAll();
  34124. }
  34125. }
  34126. if (!_2.manual) {
  34127. var readyState = document.readyState;
  34128. if (readyState === "loading" || readyState === "interactive" && script && script.defer) {
  34129. document.addEventListener("DOMContentLoaded", highlightAutomaticallyCallback);
  34130. } else {
  34131. if (window.requestAnimationFrame) {
  34132. window.requestAnimationFrame(highlightAutomaticallyCallback);
  34133. } else {
  34134. window.setTimeout(highlightAutomaticallyCallback, 16);
  34135. }
  34136. }
  34137. }
  34138. return _2;
  34139. }(_self);
  34140. if (module2.exports) {
  34141. module2.exports = Prism2;
  34142. }
  34143. if (typeof commonjsGlobal !== "undefined") {
  34144. commonjsGlobal.Prism = Prism2;
  34145. }
  34146. })(prismCore);
  34147. Prism.languages.clike = {
  34148. "comment": [
  34149. {
  34150. pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
  34151. lookbehind: true,
  34152. greedy: true
  34153. },
  34154. {
  34155. pattern: /(^|[^\\:])\/\/.*/,
  34156. lookbehind: true,
  34157. greedy: true
  34158. }
  34159. ],
  34160. "string": {
  34161. pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
  34162. greedy: true
  34163. },
  34164. "class-name": {
  34165. pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
  34166. lookbehind: true,
  34167. inside: {
  34168. "punctuation": /[.\\]/
  34169. }
  34170. },
  34171. "keyword": /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
  34172. "boolean": /\b(?:false|true)\b/,
  34173. "function": /\b\w+(?=\()/,
  34174. "number": /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
  34175. "operator": /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
  34176. "punctuation": /[{}[\];(),.:]/
  34177. };
  34178. Prism.languages.json = {
  34179. "property": {
  34180. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
  34181. lookbehind: true,
  34182. greedy: true
  34183. },
  34184. "string": {
  34185. pattern: /(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
  34186. lookbehind: true,
  34187. greedy: true
  34188. },
  34189. "comment": {
  34190. pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
  34191. greedy: true
  34192. },
  34193. "number": /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
  34194. "punctuation": /[{}[\],]/,
  34195. "operator": /:/,
  34196. "boolean": /\b(?:false|true)\b/,
  34197. "null": {
  34198. pattern: /\bnull\b/,
  34199. alias: "keyword"
  34200. }
  34201. };
  34202. Prism.languages.webmanifest = Prism.languages.json;
  34203. var prismTomorrow = "";
  34204. var CodeEditor_vue_vue_type_style_index_0_lang = "";
  34205. const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  34206. props: {
  34207. modelValue: { default: "" },
  34208. language: { default: "json" },
  34209. readonly: { type: Boolean, default: false }
  34210. },
  34211. emits: ["update:modelValue"],
  34212. setup(__props, { emit }) {
  34213. const code = computed({
  34214. get() {
  34215. return __props.modelValue;
  34216. },
  34217. set(val) {
  34218. emit("update:modelValue", val);
  34219. }
  34220. });
  34221. return (_ctx, _cache) => {
  34222. return openBlock(), createBlock(unref(PrismEditor), {
  34223. modelValue: code.value,
  34224. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => code.value = $event),
  34225. "max-h-xl": "",
  34226. class: "form-design-editor",
  34227. highlight: (code2) => {
  34228. return unref(prismCore.exports.highlight)(code2, unref(prismCore.exports.languages)[__props.language]);
  34229. },
  34230. readonly: __props.readonly,
  34231. "line-numbers": ""
  34232. }, null, 8, ["modelValue", "highlight", "readonly"]);
  34233. };
  34234. }
  34235. });
  34236. var DesignForm_vue_vue_type_style_index_0_lang = "";
  34237. const _hoisted_1 = {
  34238. "h-full": "",
  34239. "bg-white": "",
  34240. flex: ""
  34241. };
  34242. const _hoisted_2 = {
  34243. "pt-2": "",
  34244. "w-62": ""
  34245. };
  34246. const _hoisted_3 = {
  34247. border: "0 x solid gray-200",
  34248. flex: "~ 1 col nowrap"
  34249. };
  34250. const _hoisted_4 = {
  34251. border: "0 b solid gray-200",
  34252. flex: "",
  34253. "gap-2": "",
  34254. "items-center": "",
  34255. "justify-end": "",
  34256. "h-11": "",
  34257. "py-0": "",
  34258. "px-2": ""
  34259. };
  34260. const _hoisted_5 = /* @__PURE__ */ createElementVNode("i", { class: "ep:edit" }, null, -1);
  34261. const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u4FEE\u6539 ");
  34262. const _hoisted_7 = /* @__PURE__ */ createElementVNode("i", { class: "custom:clearable" }, null, -1);
  34263. const _hoisted_8 = /* @__PURE__ */ createTextVNode("\u6E05\u7A7A ");
  34264. const _hoisted_9 = /* @__PURE__ */ createElementVNode("i", { class: "custom:preview" }, null, -1);
  34265. const _hoisted_10 = /* @__PURE__ */ createTextVNode("\u9884\u89C8 ");
  34266. const _hoisted_11 = {
  34267. relative: "",
  34268. "w-75": "",
  34269. flex: "~ col"
  34270. };
  34271. const _hoisted_12 = {
  34272. border: "0 b-1 gray-200",
  34273. grid: "~ cols-2",
  34274. "min-h-11": "",
  34275. "px-2": ""
  34276. };
  34277. const _hoisted_13 = /* @__PURE__ */ createTextVNode(" \u590D\u5236 ");
  34278. const _hoisted_14 = /* @__PURE__ */ createTextVNode(" \u786E\u8BA4\u4FEE\u6539 ");
  34279. const __default__ = { name: "DesignForm" };
  34280. const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
  34281. props: {
  34282. preview: {
  34283. type: Boolean,
  34284. default: true
  34285. },
  34286. generateJson: {
  34287. type: Boolean,
  34288. default: true
  34289. },
  34290. clearable: {
  34291. type: Boolean,
  34292. default: true
  34293. },
  34294. basicFieldsList: {
  34295. type: Array,
  34296. default: () => basicFields
  34297. },
  34298. advanceFieldsList: {
  34299. type: Array,
  34300. default: () => advanceFields
  34301. },
  34302. layoutFieldsList: {
  34303. type: Array,
  34304. default: () => layoutFields
  34305. },
  34306. request: {
  34307. type: Function
  34308. }
  34309. },
  34310. setup(__props, { expose }) {
  34311. let tab = ref(0);
  34312. let selectWidget = ref();
  34313. watch(() => selectWidget.value, (val) => {
  34314. tab.value = val ? 0 : 1;
  34315. });
  34316. let widgetForm = ref(getWidgetForm());
  34317. let generateJsonVisible = ref(false);
  34318. let generateJsonTemplate = ref(JSON.stringify(getWidgetForm(), null, 2));
  34319. const handleUploadJson = () => {
  34320. var _a2;
  34321. try {
  34322. widgetForm.value = JSON.parse(generateJsonTemplate.value);
  34323. selectWidget.value = (_a2 = widgetForm.value.list) == null ? void 0 : _a2[0];
  34324. generateJsonVisible.value = false;
  34325. ElMessage.success("\u4FEE\u6539\u6210\u529F");
  34326. } catch (error) {
  34327. ElMessage.error("\u4FEE\u6539\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5JSON\u683C\u5F0F\u662F\u5426\u6B63\u786E\u3002");
  34328. }
  34329. };
  34330. const handleGenerateJson = () => (generateJsonTemplate.value = JSON.stringify(widgetForm.value, null, 2)) && (generateJsonVisible.value = true);
  34331. const handleClearable = () => {
  34332. widgetForm.value = getWidgetForm();
  34333. selectWidget.value = void 0;
  34334. };
  34335. let dataVisible = ref(false);
  34336. const generateFormRef = ref(null);
  34337. const handleGetData = async () => {
  34338. var _a2;
  34339. dataVisible.value = !dataVisible.value;
  34340. if (!dataVisible.value)
  34341. return;
  34342. const res = await ((_a2 = generateFormRef.value) == null ? void 0 : _a2.getData());
  34343. generateJsonTemplate.value = JSON.stringify(res, null, 2);
  34344. };
  34345. const handleReset = () => {
  34346. var _a2;
  34347. return (_a2 = generateFormRef.value) == null ? void 0 : _a2.reset();
  34348. };
  34349. const handleCopyClick = (text) => {
  34350. navigator.clipboard.writeText(text);
  34351. ElMessage.success({ message: "Copy\u6210\u529F" });
  34352. };
  34353. const previewVisible = ref(false);
  34354. expose({
  34355. getJson: () => widgetForm.value,
  34356. setJson: (json) => {
  34357. var _a2;
  34358. widgetForm.value = json;
  34359. selectWidget.value = (_a2 = json.list) == null ? void 0 : _a2[0];
  34360. },
  34361. clear: handleClearable
  34362. });
  34363. return (_ctx, _cache) => {
  34364. const _component_el_button = ElButton;
  34365. const _component_el_dialog = ElDialog;
  34366. return openBlock(), createElementBlock("section", _hoisted_1, [
  34367. createElementVNode("aside", _hoisted_2, [
  34368. createVNode(_sfc_main$6, {
  34369. title: "\u57FA\u7840\u5B57\u6BB5",
  34370. fields: __props.basicFieldsList,
  34371. list: unref(basicComponents),
  34372. allList: widgetForm.value
  34373. }, null, 8, ["fields", "list", "allList"]),
  34374. createVNode(_sfc_main$6, {
  34375. title: "\u9AD8\u7EA7\u5B57\u6BB5",
  34376. fields: __props.advanceFieldsList,
  34377. list: unref(advanceComponents),
  34378. allList: widgetForm.value
  34379. }, null, 8, ["fields", "list", "allList"]),
  34380. createVNode(_sfc_main$6, {
  34381. title: "\u5E03\u5C40\u5B57\u6BB5",
  34382. fields: __props.layoutFieldsList,
  34383. list: unref(layoutComponents),
  34384. allList: widgetForm.value
  34385. }, null, 8, ["fields", "list", "allList"])
  34386. ]),
  34387. createElementVNode("main", _hoisted_3, [
  34388. createElementVNode("header", _hoisted_4, [
  34389. renderSlot(_ctx.$slots, "default"),
  34390. __props.generateJson ? (openBlock(), createBlock(_component_el_button, {
  34391. key: 0,
  34392. type: "text",
  34393. onClick: handleGenerateJson
  34394. }, {
  34395. icon: withCtx(() => [
  34396. _hoisted_5
  34397. ]),
  34398. default: withCtx(() => [
  34399. _hoisted_6
  34400. ]),
  34401. _: 1
  34402. })) : createCommentVNode("", true),
  34403. __props.clearable ? (openBlock(), createBlock(_component_el_button, {
  34404. key: 1,
  34405. type: "text",
  34406. onClick: handleClearable
  34407. }, {
  34408. icon: withCtx(() => [
  34409. _hoisted_7
  34410. ]),
  34411. default: withCtx(() => [
  34412. _hoisted_8
  34413. ]),
  34414. _: 1
  34415. })) : createCommentVNode("", true),
  34416. __props.preview ? (openBlock(), createBlock(_component_el_button, {
  34417. key: 2,
  34418. type: "text",
  34419. onClick: _cache[0] || (_cache[0] = ($event) => previewVisible.value = true)
  34420. }, {
  34421. icon: withCtx(() => [
  34422. _hoisted_9
  34423. ]),
  34424. default: withCtx(() => [
  34425. _hoisted_10
  34426. ]),
  34427. _: 1
  34428. })) : createCommentVNode("", true)
  34429. ]),
  34430. createVNode(_sfc_main$4, mergeProps({ ref: "widgetFormRef" }, widgetForm.value, {
  34431. selectWidget: selectWidget.value,
  34432. "onUpdate:selectWidget": _cache[1] || (_cache[1] = ($event) => selectWidget.value = $event)
  34433. }), null, 16, ["selectWidget"])
  34434. ]),
  34435. createElementVNode("aside", _hoisted_11, [
  34436. createElementVNode("header", _hoisted_12, [
  34437. createElementVNode("div", {
  34438. class: normalizeClass([{ active: !tab.value }, "config-tab"]),
  34439. onClick: _cache[2] || (_cache[2] = ($event) => tab.value = 0)
  34440. }, " \u5B57\u6BB5\u5C5E\u6027 ", 2),
  34441. createElementVNode("div", {
  34442. class: normalizeClass([{ active: tab.value }, "config-tab"]),
  34443. onClick: _cache[3] || (_cache[3] = ($event) => tab.value = 1)
  34444. }, " \u8868\u5355\u5C5E\u6027 ", 2)
  34445. ]),
  34446. withDirectives(createVNode(WidgetConfig, {
  34447. select: selectWidget.value,
  34448. "onUpdate:select": _cache[4] || (_cache[4] = ($event) => selectWidget.value = $event)
  34449. }, null, 8, ["select"]), [
  34450. [vShow, !tab.value]
  34451. ]),
  34452. withDirectives(createVNode(_sfc_main$2, {
  34453. config: widgetForm.value.config,
  34454. "onUpdate:config": _cache[5] || (_cache[5] = ($event) => widgetForm.value.config = $event)
  34455. }, null, 8, ["config"]), [
  34456. [vShow, tab.value]
  34457. ])
  34458. ]),
  34459. createVNode(_component_el_dialog, {
  34460. modelValue: previewVisible.value,
  34461. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => previewVisible.value = $event),
  34462. "destroy-on-close": "",
  34463. title: "\u9884\u89C8",
  34464. "z-index": 2e3,
  34465. width: 800,
  34466. onClose: _cache[9] || (_cache[9] = ($event) => dataVisible.value = false)
  34467. }, {
  34468. footer: withCtx(() => [
  34469. createVNode(_component_el_button, {
  34470. onClick: _cache[7] || (_cache[7] = ($event) => dataVisible.value ? handleCopyClick(generateJsonTemplate.value) : handleReset())
  34471. }, {
  34472. default: withCtx(() => [
  34473. createTextVNode(toDisplayString(dataVisible.value ? "\u590D\u5236" : "\u91CD\u7F6E"), 1)
  34474. ]),
  34475. _: 1
  34476. }),
  34477. createVNode(_component_el_button, {
  34478. type: "primary",
  34479. onClick: handleGetData
  34480. }, {
  34481. default: withCtx(() => [
  34482. createTextVNode(toDisplayString(dataVisible.value ? "\u8FD4\u56DE\u9884\u89C8" : "\u83B7\u53D6\u6570\u636E"), 1)
  34483. ]),
  34484. _: 1
  34485. })
  34486. ]),
  34487. default: withCtx(() => [
  34488. withDirectives(createVNode(_sfc_main$1, {
  34489. modelValue: generateJsonTemplate.value,
  34490. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => generateJsonTemplate.value = $event)
  34491. }, null, 8, ["modelValue"]), [
  34492. [vShow, dataVisible.value]
  34493. ]),
  34494. withDirectives(createVNode(GenerateForm, {
  34495. ref_key: "generateFormRef",
  34496. ref: generateFormRef,
  34497. request: __props.request,
  34498. data: widgetForm.value
  34499. }, null, 8, ["request", "data"]), [
  34500. [vShow, !dataVisible.value]
  34501. ])
  34502. ]),
  34503. _: 1
  34504. }, 8, ["modelValue"]),
  34505. createVNode(_component_el_dialog, {
  34506. modelValue: generateJsonVisible.value,
  34507. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => generateJsonVisible.value = $event),
  34508. "append-to-body": "",
  34509. title: "\u4FEE\u6539JSON",
  34510. "z-index": 2e4,
  34511. width: 800
  34512. }, {
  34513. footer: withCtx(() => [
  34514. createVNode(_component_el_button, {
  34515. onClick: _cache[11] || (_cache[11] = ($event) => handleCopyClick(generateJsonTemplate.value))
  34516. }, {
  34517. default: withCtx(() => [
  34518. _hoisted_13
  34519. ]),
  34520. _: 1
  34521. }),
  34522. createVNode(_component_el_button, {
  34523. type: "primary",
  34524. onClick: handleUploadJson
  34525. }, {
  34526. default: withCtx(() => [
  34527. _hoisted_14
  34528. ]),
  34529. _: 1
  34530. })
  34531. ]),
  34532. default: withCtx(() => [
  34533. createVNode(_sfc_main$1, {
  34534. modelValue: generateJsonTemplate.value,
  34535. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => generateJsonTemplate.value = $event)
  34536. }, null, 8, ["modelValue"])
  34537. ]),
  34538. _: 1
  34539. }, 8, ["modelValue"])
  34540. ]);
  34541. };
  34542. }
  34543. }));
  34544. export { _sfc_main as DesignForm, GenerateForm, advanceFields, basicFields, layoutFields };
  34545. //# sourceMappingURL=index.es.js.map